2015-08-10 23:44:36 +02:00
// Test library configuration for std.cfg
//
// Usage:
2023-03-09 20:04:20 +01:00
// $ cppcheck --check-library --library=std --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/std.cpp
2015-08-10 23:44:36 +02:00
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
2023-01-20 15:46:06 +01:00
# include <algorithm>
2021-07-14 10:12:49 +02:00
# include <bitset>
# include <cassert>
2015-08-14 01:36:44 +02:00
# include <cctype>
2021-07-14 10:12:49 +02:00
# include <cfenv>
# include <cinttypes>
2021-05-03 09:39:33 +02:00
# include <clocale>
2021-07-14 10:12:49 +02:00
# include <cmath>
2015-08-14 02:06:48 +02:00
# include <complex>
2015-09-02 17:08:25 +02:00
# include <csetjmp>
2015-09-04 22:48:00 +02:00
# include <csignal>
2021-07-14 10:12:49 +02:00
# include <cstdarg>
# include <cstdio>
# include <cstdlib>
# include <cstring>
2022-05-01 12:47:13 +02:00
# define __STDC_WANT_LIB_EXT1__ 1
2021-07-14 10:12:49 +02:00
# include <ctime>
# include <cwchar>
# include <fstream>
# include <functional>
2022-05-10 23:09:10 +02:00
# ifndef __STDC_NO_THREADS__
# include <threads.h>
# endif
2015-09-09 16:32:52 +02:00
# include <iomanip>
2022-05-10 09:30:13 +02:00
# include <ios>
2021-07-14 10:12:49 +02:00
# include <iostream>
2016-08-25 19:17:07 +02:00
# include <istream>
2021-07-14 10:12:49 +02:00
# include <iterator>
2023-02-11 10:48:17 +01:00
# include <map>
2023-05-28 19:42:47 +02:00
# include <memory>
2022-09-20 07:30:24 +02:00
# include <numeric>
2023-01-20 15:46:06 +01:00
# include <string_view>
2023-02-11 10:48:17 +01:00
# include <unordered_map>
2023-01-20 15:46:06 +01:00
# include <unordered_set>
2023-03-02 21:45:15 +01:00
# include <utility>
2023-01-20 15:46:06 +01:00
# include <vector>
2023-02-05 18:10:08 +01:00
# include <version>
# ifdef __cpp_lib_span
# include <span>
# endif
2021-07-14 10:12:49 +02:00
2022-07-09 19:59:16 +02:00
int zerodiv_ldexp ( )
{
int i = std : : ldexp ( 0.0 , 42.0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
int zerodiv_ilogb ( )
{
int i = std : : ilogb ( 1.0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
int zerodiv_hypot ( )
{
int i = std : : hypot ( 0.0 , 0.0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
2022-07-09 19:21:58 +02:00
int zerodiv_fmod ( )
{
int i = std : : fmod ( 0.0 , 42.0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
int zerodiv_fmin ( )
{
int i = std : : fmin ( 0.0 , 0.0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
int zerodiv_fmax ( )
{
int i = std : : fmax ( 0.0 , 0.0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
int zerodiv_floor ( )
{
int i = std : : floor ( 0.0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
int zerodiv_fabs ( )
{
int i = std : : fabs ( - 0.0 ) + std : : fabs ( + 0.0 ) + std : : fabs ( 0.0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
int zerodiv_fdim ( )
{
int i = std : : fdim ( 1.0 , 1.0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
2022-07-09 22:36:17 +02:00
int zerodiv_trunc ( )
{
int i = std : : trunc ( 0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
2022-07-09 17:32:32 +02:00
int zerodiv_ceil ( )
{
int i = std : : ceil ( 0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
2022-07-09 07:40:32 +02:00
int zerodiv_sqrt ( )
{
int i = std : : sqrt ( 0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
2022-07-09 17:28:15 +02:00
int zerodiv_cbrt ( )
{
int i = std : : cbrt ( 0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
2022-07-09 17:38:28 +02:00
int zerodiv_erf ( )
{
int i = std : : erf ( 0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
2022-07-09 17:43:17 +02:00
int zerodiv_erfc ( )
{
int i = std : : erfc ( 42 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
2022-07-09 17:28:15 +02:00
int zerodiv_asin ( )
{
int i = std : : asin ( 0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
2022-07-09 16:32:21 +02:00
int zerodiv_acos ( )
{
int i = std : : acos ( 1 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
2022-07-09 16:14:58 +02:00
int zerodiv_asinh ( )
{
int i = std : : asinh ( 0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
2022-07-09 16:32:21 +02:00
int zerodiv_acosh ( )
{
int i = std : : acosh ( 1 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
2022-07-09 22:36:17 +02:00
int zerodiv_log1p ( )
{
int i = std : : log1p ( 0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
int zerodiv_nearbyint ( )
{
int i = std : : nearbyint ( 0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
int zerodiv_round ( )
{
int i = std : : round ( 0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
2022-07-09 16:32:21 +02:00
int zerodiv_sinh ( )
{
int i = std : : sinh ( 0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
int zerodiv_tanh ( )
{
int i = std : : tanh ( 0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
2022-07-09 17:28:15 +02:00
int zerodiv_atanh ( )
{
int i = std : : atanh ( 0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
int zerodiv_atan ( )
{
int i = std : : atan ( 0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
}
2022-07-09 07:40:32 +02:00
int zerodiv_sin ( )
{
2022-07-09 10:09:43 +02:00
int i = std : : sin ( 0 ) + std : : sin ( M_PI ) + std : : sin ( 2 * M_PI ) ;
2022-07-09 07:40:32 +02:00
// cppcheck-suppress zerodiv
return 42 / i ;
}
2022-07-09 19:21:58 +02:00
int zerodiv_expm1 ( )
2022-07-09 07:40:32 +02:00
{
2022-07-09 19:21:58 +02:00
int i = std : : expm1 ( 0 ) ;
// cppcheck-suppress zerodiv
return 42 / i ;
2022-07-09 07:40:32 +02:00
}
2022-07-09 19:21:58 +02:00
int moduloofone_cos ( )
2022-07-09 17:52:58 +02:00
{
2022-07-09 19:21:58 +02:00
int i = std : : cos ( 0 ) ;
2022-07-09 17:52:58 +02:00
// cppcheck-suppress moduloofone
return 42 % i ;
}
2022-07-09 07:40:32 +02:00
int moduloofone_exp ( )
{
int i = std : : exp ( 0 ) ;
// cppcheck-suppress moduloofone
return 42 % i ;
}
2022-07-09 17:47:21 +02:00
int moduloofone_exp2 ( )
{
int i = std : : exp2 ( 0 ) ;
// cppcheck-suppress moduloofone
return 42 % i ;
}
2022-07-09 07:40:32 +02:00
int moduloofone_pow ( )
{
int i = std : : pow ( 2 , 0 ) ;
// cppcheck-suppress moduloofone
return 42 % i ;
}
2022-06-02 19:30:29 +02:00
char * invalidFunctionArgStr_strncpy ( char * destination )
{
// Copies the first num characters of source to destination.
// If the end of the source C string (which is signaled by a null-character)
// is found before num characters have been copied, destination
// is padded with zeros until a total of num characters have been written to it.
const char source = ' x ' ;
const std : : size_t num = 1U ;
return strncpy ( destination , & source , num ) ;
}
2022-06-02 09:23:22 +02:00
void invalidFunctionArgStr_fprintf ( FILE * stream , const char * format )
{
const char formatBuf [ ] = { ' % ' , ' d ' } ;
// cppcheck-suppress invalidFunctionArgStr
( void ) fprintf ( stream , formatBuf , 42 ) ;
( void ) fprintf ( stream , format , 42 ) ;
}
2022-06-02 01:09:09 +02:00
void invalidFunctionArgStr_fopen ( const char * const fileName , const char * const mode )
{
const char fileNameBuf [ ] = { ' f ' , ' i ' , ' l ' , ' e ' } ;
const char modeBuf [ ] = { ' r ' } ;
// cppcheck-suppress invalidFunctionArgStr
FILE * fp = fopen ( fileName , modeBuf ) ;
fclose ( fp ) ;
// cppcheck-suppress invalidFunctionArgStr
fp = fopen ( fileNameBuf , mode ) ;
fclose ( fp ) ;
}
2022-05-14 16:05:18 +02:00
float invalidFunctionArg_remquo ( float x , float y , int * quo )
{
// cppcheck-suppress invalidFunctionArg
( void ) std : : remquo ( x , 0.0f , quo ) ;
// cppcheck-suppress invalidFunctionArg
( void ) std : : remquof ( x , 0.0f , quo ) ;
return std : : remquo ( x , y , quo ) ;
}
double invalidFunctionArg_remquo ( double x , double y , int * quo )
{
// cppcheck-suppress invalidFunctionArg
( void ) std : : remquo ( x , 0.0 , quo ) ;
// cppcheck-suppress invalidFunctionArg
( void ) std : : remquo ( x , 0.0f , quo ) ;
// cppcheck-suppress invalidFunctionArg
( void ) std : : remquo ( x , 0.0 L , quo ) ;
return std : : remquo ( x , y , quo ) ;
}
double invalidFunctionArg_remquo ( long double x , long double y , int * quo )
{
// cppcheck-suppress invalidFunctionArg
( void ) std : : remquo ( x , 0.0 L , quo ) ;
// cppcheck-suppress invalidFunctionArg
( void ) std : : remquol ( x , 0.0 L , quo ) ;
return std : : remquo ( x , y , quo ) ;
}
void invalidFunctionArg_remainderl ( long double f1 , long double f2 )
{
// cppcheck-suppress invalidFunctionArg
( void ) std : : remainderl ( f1 , 0.0 ) ;
// cppcheck-suppress invalidFunctionArg
( void ) std : : remainderl ( f1 , 0.0 L ) ;
( void ) std : : remainderl ( f1 , f2 ) ;
}
void invalidFunctionArg_remainder ( double f1 , double f2 )
{
// cppcheck-suppress invalidFunctionArg
( void ) std : : remainder ( f1 , 0.0 ) ;
( void ) std : : remainder ( f1 , f2 ) ;
}
void invalidFunctionArg_remainderf ( float f1 , float f2 )
{
// cppcheck-suppress invalidFunctionArg
( void ) std : : remainderf ( f1 , 0.0 ) ;
// cppcheck-suppress invalidFunctionArg
( void ) std : : remainderf ( f1 , 0.0f ) ;
( void ) std : : remainderf ( f1 , f2 ) ;
}
2022-05-10 10:07:55 +02:00
void uninitvar_std_fstream_open ( std : : fstream & fs , const std : : string & strFileName , const char * filename , std : : ios_base : : openmode mode )
{
std : : string s ;
const char * ptr ;
std : : ios_base : : openmode m ;
fs . open ( s , mode ) ;
// cppcheck-suppress uninitvar
fs . open ( ptr , mode ) ;
// TODO cppcheck-suppress uninitvar
fs . open ( filename , m ) ;
// TODO cppcheck-suppress uninitvar
fs . open ( strFileName , m ) ;
fs . open ( s ) ;
// TODO cppcheck-suppress uninitvar
fs . open ( ptr ) ;
}
void uninitvar_std_ifstream_open ( std : : ifstream & ifs , const std : : string & strFileName , const char * filename , std : : ios_base : : openmode mode )
{
std : : string s ;
const char * ptr ;
std : : ios_base : : openmode m ;
ifs . open ( s , mode ) ;
// cppcheck-suppress uninitvar
ifs . open ( ptr , mode ) ;
// TODO cppcheck-suppress uninitvar
ifs . open ( filename , m ) ;
// TODO cppcheck-suppress uninitvar
ifs . open ( strFileName , m ) ;
ifs . open ( s ) ;
// TODO cppcheck-suppress uninitvar
ifs . open ( ptr ) ;
}
void uninitvar_std_ofstream_open ( std : : ofstream & os , const std : : string & strFileName , const char * filename , std : : ios_base : : openmode mode )
{
std : : string s ;
const char * ptr ;
std : : ios_base : : openmode m ;
os . open ( s , mode ) ;
// cppcheck-suppress uninitvar
os . open ( ptr , mode ) ;
// TODO cppcheck-suppress uninitvar
os . open ( filename , m ) ;
// TODO cppcheck-suppress uninitvar
os . open ( strFileName , m ) ;
os . open ( s ) ;
// TODO cppcheck-suppress uninitvar
os . open ( ptr ) ;
}
2022-09-20 17:23:18 +02:00
void uninitvar_std_ofstream_precision ( std : : ofstream & os )
{
std : : streamsize s ;
// cppcheck-suppress uninitvar
os . precision ( s ) ;
}
2022-05-10 10:17:27 +02:00
void nullPointer_std_filebuf_open ( std : : filebuf & fb , const std : : string & strFileName , const char * filename , std : : ios_base : : openmode mode )
{
// cppcheck-suppress nullPointer
( void ) fb . open ( nullptr , mode ) ;
( void ) fb . open ( filename , mode ) ;
( void ) fb . open ( strFileName , mode ) ;
}
2022-05-10 10:07:55 +02:00
void nullPointer_std_ofstream_open ( std : : ofstream & os , const std : : string & strFileName , const char * filename , std : : ios_base : : openmode mode )
{
// cppcheck-suppress nullPointer
os . open ( nullptr , mode ) ;
os . open ( filename , mode ) ;
os . open ( strFileName , mode ) ;
// cppcheck-suppress nullPointer
os . open ( nullptr ) ;
os . open ( filename ) ;
os . open ( strFileName ) ;
}
void nullPointer_std_fstream_open ( std : : fstream & fs , const std : : string & strFileName , const char * filename , std : : ios_base : : openmode mode )
2022-05-10 09:50:02 +02:00
{
// cppcheck-suppress nullPointer
fs . open ( nullptr , mode ) ;
fs . open ( filename , mode ) ;
fs . open ( strFileName , mode ) ;
// cppcheck-suppress nullPointer
fs . open ( nullptr ) ;
fs . open ( filename ) ;
fs . open ( strFileName ) ;
}
void nullPointer_std_ifstream_open ( std : : ifstream & is , const std : : string & strFileName , const char * filename , std : : ios_base : : openmode mode )
{
// cppcheck-suppress nullPointer
is . open ( nullptr , mode ) ;
is . open ( filename , mode ) ;
is . open ( strFileName , mode ) ;
// cppcheck-suppress nullPointer
is . open ( nullptr ) ;
is . open ( filename ) ;
is . open ( strFileName ) ;
}
2022-05-05 15:05:46 +02:00
2022-05-10 09:30:13 +02:00
void bufferAccessOutOfBounds_std_fstream_write ( std : : fstream & fs , const char * s , std : : streamsize n )
{
2023-08-05 18:48:43 +02:00
const char buf [ 42 ] = { 0 } ;
2022-05-10 09:30:13 +02:00
( void ) fs . write ( buf , 42 ) ;
// cppcheck-suppress bufferAccessOutOfBounds
( void ) fs . write ( buf , 43 ) ;
( void ) fs . write ( buf , n ) ;
( void ) fs . write ( s , n ) ;
}
void bufferAccessOutOfBounds_std_ostream_write ( std : : ostream & os , const char * s , std : : streamsize n )
{
2023-08-05 18:48:43 +02:00
const char buf [ 42 ] = { 0 } ;
2022-05-10 09:30:13 +02:00
( void ) os . write ( buf , 42 ) ;
// cppcheck-suppress bufferAccessOutOfBounds
( void ) os . write ( buf , 43 ) ;
( void ) os . write ( buf , n ) ;
( void ) os . write ( s , n ) ;
}
void bufferAccessOutOfBounds_std_ostringstream_write ( std : : ostringstream & oss , const char * s , std : : streamsize n )
{
2023-08-05 18:48:43 +02:00
const char buf [ 42 ] = { 0 } ;
2022-05-10 09:30:13 +02:00
( void ) oss . write ( buf , 42 ) ;
// cppcheck-suppress bufferAccessOutOfBounds
( void ) oss . write ( buf , 43 ) ;
( void ) oss . write ( buf , n ) ;
( void ) oss . write ( s , n ) ;
}
void bufferAccessOutOfBounds_std_ofstream_write ( std : : ofstream & os , const char * s , std : : streamsize n )
{
2023-08-05 18:48:43 +02:00
const char buf [ 42 ] = { 0 } ;
2022-05-10 09:30:13 +02:00
( void ) os . write ( buf , 42 ) ;
// cppcheck-suppress bufferAccessOutOfBounds
( void ) os . write ( buf , 43 ) ;
( void ) os . write ( buf , n ) ;
( void ) os . write ( s , n ) ;
}
2023-08-05 18:48:43 +02:00
void invalidFunctionArg_fesetexceptflag ( const fexcept_t * flagp , int excepts )
2022-05-05 15:05:46 +02:00
{
( void ) std : : fesetexceptflag ( flagp , excepts ) ;
// cppcheck-suppress invalidFunctionArg
( void ) std : : fesetexceptflag ( flagp , 0 ) ;
( void ) std : : fesetexceptflag ( flagp , FE_DIVBYZERO ) ;
( void ) std : : fesetexceptflag ( flagp , FE_INEXACT ) ;
( void ) std : : fesetexceptflag ( flagp , FE_INVALID ) ;
( void ) std : : fesetexceptflag ( flagp , FE_OVERFLOW ) ;
( void ) std : : fesetexceptflag ( flagp , FE_UNDERFLOW ) ;
( void ) std : : fesetexceptflag ( flagp , FE_ALL_EXCEPT ) ;
// cppcheck-suppress invalidFunctionArg
( void ) std : : fesetexceptflag ( flagp , FE_ALL_EXCEPT + 1 ) ;
}
void invalidFunctionArg_fetestexcept ( int excepts )
{
( void ) std : : fetestexcept ( excepts ) ;
// cppcheck-suppress invalidFunctionArg
( void ) std : : fetestexcept ( 0 ) ;
( void ) std : : fetestexcept ( FE_DIVBYZERO ) ;
( void ) std : : fetestexcept ( FE_INEXACT ) ;
( void ) std : : fetestexcept ( FE_INVALID ) ;
( void ) std : : fetestexcept ( FE_OVERFLOW ) ;
( void ) std : : fetestexcept ( FE_UNDERFLOW ) ;
( void ) std : : fetestexcept ( FE_ALL_EXCEPT ) ;
// cppcheck-suppress invalidFunctionArg
( void ) std : : fetestexcept ( FE_ALL_EXCEPT + 1 ) ;
}
2023-08-05 18:48:43 +02:00
void nullPointer_fprintf ( FILE * Stream , const char * Format , int Argument )
2022-05-08 18:02:10 +02:00
{
// cppcheck-suppress nullPointer
( void ) std : : fprintf ( Stream , nullptr , Argument ) ;
// no warning is expected
( void ) std : : fprintf ( Stream , Format , Argument ) ;
}
void bufferAccessOutOfBounds_wcsftime ( wchar_t * ptr , size_t maxsize , const wchar_t * format , const struct tm * timeptr )
{
wchar_t buf [ 42 ] ;
( void ) std : : wcsftime ( buf , 42 , format , timeptr ) ;
// TODO cppcheck-suppress bufferAccessOutOfBounds
( void ) std : : wcsftime ( buf , 43 , format , timeptr ) ;
( void ) std : : wcsftime ( ptr , maxsize , format , timeptr ) ;
}
2022-05-02 11:58:31 +02:00
int qsort_cmpfunc ( const void * a , const void * b ) {
return ( * static_cast < const int * > ( a ) - * static_cast < const int * > ( b ) ) ;
}
void nullPointer_qsort ( void * base , std : : size_t n , std : : size_t size , int ( * cmp ) ( const void * , const void * ) )
{
// cppcheck-suppress nullPointer
std : : qsort ( nullptr , n , size , qsort_cmpfunc ) ;
// cppcheck-suppress nullPointer
std : : qsort ( base , n , size , nullptr ) ;
std : : qsort ( base , n , size , qsort_cmpfunc ) ;
}
2022-05-08 18:06:30 +02:00
void nullPointer_vfprintf ( FILE * Stream , const char * Format , va_list Arg )
{
// cppcheck-suppress nullPointer
2022-05-08 18:15:22 +02:00
( void ) std : : vfprintf ( Stream , nullptr , Arg ) ;
2022-05-08 18:06:30 +02:00
( void ) std : : vfprintf ( Stream , Format , Arg ) ;
}
2023-08-05 18:48:43 +02:00
void nullPointer_vfwprintf ( FILE * Stream , const wchar_t * Format , va_list Arg )
2022-05-08 18:15:22 +02:00
{
// cppcheck-suppress nullPointer
( void ) std : : vfwprintf ( Stream , nullptr , Arg ) ;
( void ) std : : vfwprintf ( Stream , Format , Arg ) ;
}
2022-05-01 18:09:54 +02:00
void * bufferAccessOutOfBounds_memchr ( void * s , int c , size_t n )
{
char buf [ 42 ] = { 0 } ;
( void ) std : : memchr ( buf , c , 42 ) ;
// cppcheck-suppress bufferAccessOutOfBounds
( void ) std : : memchr ( buf , c , 43 ) ;
return std : : memchr ( s , c , n ) ;
}
2022-05-01 12:47:13 +02:00
// As with all bounds-checked functions, localtime_s is only guaranteed to be available if __STDC_LIB_EXT1__ is defined by the implementation and if the user defines __STDC_WANT_LIB_EXT1__ to the integer constant 1 before including time.h.
# ifdef __STDC_LIB_EXT1__
void uninitvar_localtime_s ( const std : : time_t * restrict time , struct tm * restrict result )
{
const std : : time_t * restrict Time ;
// TODO cppcheck-suppress uninitvar
( void ) std : : localtime_s ( Time , result ) ;
( void ) std : : localtime_s ( time , result ) ;
}
void nullPointer_localtime_s ( const std : : time_t * restrict time , struct tm * restrict result )
{
// cppcheck-suppress nullPointer
( void ) std : : localtime_s ( NULL , result ) ;
// cppcheck-suppress nullPointer
( void ) std : : localtime_s ( time , NULL ) ;
( void ) std : : localtime_s ( time , result ) ;
}
# endif // __STDC_LIB_EXT1__
2022-04-26 18:01:57 +02:00
size_t nullPointer_strftime ( char * s , size_t max , const char * fmt , const struct tm * p )
{
// cppcheck-suppress nullPointer
( void ) std : : strftime ( NULL , max , fmt , p ) ;
// cppcheck-suppress nullPointer
( void ) std : : strftime ( s , max , NULL , p ) ;
// cppcheck-suppress nullPointer
( void ) std : : strftime ( s , max , fmt , NULL ) ;
return std : : strftime ( s , max , fmt , p ) ;
}
2022-04-25 18:25:52 +02:00
size_t bufferAccessOutOfBounds_wcsrtombs ( char * dest , const wchar_t * * src , size_t len , mbstate_t * ps )
{
char buf [ 42 ] ;
( void ) std : : wcsrtombs ( buf , src , 42 , ps ) ;
// cppcheck-suppress bufferAccessOutOfBounds
( void ) std : : wcsrtombs ( buf , src , 43 , ps ) ;
return std : : wcsrtombs ( dest , src , len , ps ) ;
}
2022-02-04 12:30:37 +01:00
void invalidFunctionArg_std_string_substr ( const std : : string & str , std : : size_t pos , std : : size_t len ) {
// cppcheck-suppress invalidFunctionArg
( void ) str . substr ( - 1 , len ) ;
// cppcheck-suppress invalidFunctionArg
( void ) str . substr ( pos , - 1 ) ;
// no warning is expected for
( void ) str . substr ( pos , len ) ;
2022-02-04 12:39:43 +01:00
( void ) str . substr ( pos , std : : string : : npos ) ;
2022-02-04 12:30:37 +01:00
}
void invalidFunctionArg_std_wstring_substr ( const std : : wstring & str , std : : size_t pos , std : : size_t len ) {
// cppcheck-suppress invalidFunctionArg
( void ) str . substr ( - 1 , len ) ;
// cppcheck-suppress invalidFunctionArg
( void ) str . substr ( pos , - 1 ) ;
// no warning is expected for
( void ) str . substr ( pos , len ) ;
2022-02-04 12:39:43 +01:00
( void ) str . substr ( pos , std : : wstring : : npos ) ;
2022-02-04 12:30:37 +01:00
}
2021-08-09 18:30:29 +02:00
double invalidFunctionArg_log10 ( double d = 0.0 ) {
// cppcheck-suppress invalidFunctionArg
return log10 ( d ) ;
}
2021-07-14 10:12:49 +02:00
void uninitvar_std_next ( const std : : vector < int > & v , int count )
{
// No warning shall be shown:
if ( std : : next ( v . begin ( ) ) ! = v . end ( ) ) { }
if ( std : : next ( v . begin ( ) , count ) ! = v . end ( ) ) { }
std : : vector < int > : : iterator it ;
2022-07-09 07:39:04 +02:00
// cppcheck-suppress uninitvar
2021-07-14 10:12:49 +02:00
if ( std : : next ( it ) ! = v . end ( ) ) { }
std : : vector < int > : : const_iterator const_it ;
2022-07-09 07:39:04 +02:00
// cppcheck-suppress uninitvar
2021-07-14 10:12:49 +02:00
if ( std : : next ( const_it ) ! = v . end ( ) ) { }
std : : vector < int > : : reverse_iterator rit ;
2022-07-09 07:39:04 +02:00
// cppcheck-suppress uninitvar
2021-07-14 10:12:49 +02:00
if ( std : : next ( rit ) ! = v . rend ( ) ) { }
std : : vector < int > : : const_reverse_iterator const_rit ;
2022-07-09 07:39:04 +02:00
// cppcheck-suppress uninitvar
2021-07-14 10:12:49 +02:00
if ( std : : next ( const_rit ) ! = v . rend ( ) ) { }
}
void uninitvar_std_prev ( const std : : vector < int > & v , int count )
{
// No warning shall be shown:
if ( std : : prev ( v . begin ( ) ) ! = v . end ( ) ) { }
if ( std : : prev ( v . begin ( ) , count ) ! = v . end ( ) ) { }
std : : vector < int > : : iterator it ;
2022-07-09 07:39:04 +02:00
// cppcheck-suppress uninitvar
2021-07-14 10:12:49 +02:00
if ( std : : prev ( it ) ! = v . end ( ) ) { }
std : : vector < int > : : const_iterator const_it ;
2022-07-09 07:39:04 +02:00
// cppcheck-suppress uninitvar
2021-07-14 10:12:49 +02:00
if ( std : : prev ( const_it ) ! = v . end ( ) ) { }
std : : vector < int > : : reverse_iterator rit ;
2022-07-09 07:39:04 +02:00
// cppcheck-suppress uninitvar
2021-07-14 10:12:49 +02:00
if ( std : : prev ( rit ) ! = v . rend ( ) ) { }
std : : vector < int > : : const_reverse_iterator const_rit ;
2022-07-09 07:39:04 +02:00
// cppcheck-suppress uninitvar
2021-07-14 10:12:49 +02:00
if ( std : : prev ( const_rit ) ! = v . rend ( ) ) { }
}
2021-06-03 07:33:23 +02:00
2021-07-10 18:28:26 +02:00
void overlappingWriteFunction_wcscat ( wchar_t * src , wchar_t * dest )
{
// No warning shall be shown:
( void ) wcscat ( dest , src ) ;
// cppcheck-suppress overlappingWriteFunction
( void ) wcscat ( src , src ) ;
}
2023-08-05 18:48:43 +02:00
void overlappingWriteFunction_wcsxfrm ( wchar_t * s1 , const wchar_t * s2 , size_t n )
2022-04-22 08:00:45 +02:00
{
// No warning shall be shown:
( void ) wcsxfrm ( s1 , s2 , n ) ;
}
2021-07-10 18:28:26 +02:00
char * overlappingWriteFunction_strcat ( char * src , char * dest )
{
// No warning shall be shown:
( void ) strcat ( dest , src ) ;
// cppcheck-suppress overlappingWriteFunction
return strcat ( src , src ) ;
}
2022-04-22 08:00:45 +02:00
int nullPointer_wcsncmp ( const wchar_t * s1 , const wchar_t * s2 , size_t n )
{
// cppcheck-suppress nullPointer
( void ) std : : wcsncmp ( NULL , s2 , n ) ;
// cppcheck-suppress nullPointer
( void ) std : : wcsncmp ( s1 , NULL , n ) ;
return std : : wcsncmp ( s1 , s2 , n ) ;
}
wchar_t * nullPointer_wcsncpy ( wchar_t * s , const wchar_t * cs , size_t n )
{
// cppcheck-suppress nullPointer
( void ) std : : wcsncpy ( NULL , cs , n ) ;
// cppcheck-suppress nullPointer
( void ) std : : wcsncpy ( s , NULL , n ) ;
return std : : wcsncpy ( s , cs , n ) ;
}
2023-08-05 18:48:43 +02:00
char * overlappingWriteFunction_strncat ( const char * src , char * dest , const std : : size_t count )
2021-07-16 14:01:40 +02:00
{
// No warning shall be shown:
( void ) strncat ( dest , src , 42 ) ;
( void ) strncat ( dest , src , count ) ;
2021-07-16 14:25:04 +02:00
( void ) strncat ( dest , dest , count ) ;
2021-07-16 14:01:40 +02:00
// cppcheck-suppress overlappingWriteFunction
( void ) strncat ( dest , dest + 1 , 2 ) ;
char buffer [ ] = " strncat " ;
// cppcheck-suppress overlappingWriteFunction
2021-07-16 14:25:04 +02:00
return strncat ( buffer , buffer + 1 , 3 ) ;
2021-07-16 14:01:40 +02:00
}
2023-08-05 18:48:43 +02:00
wchar_t * overlappingWriteFunction_wcsncat ( const wchar_t * src , wchar_t * dest , const std : : size_t count )
2021-07-16 14:30:49 +02:00
{
// No warning shall be shown:
( void ) wcsncat ( dest , src , 42 ) ;
( void ) wcsncat ( dest , src , count ) ;
( void ) wcsncat ( dest , dest , count ) ;
// cppcheck-suppress overlappingWriteFunction
( void ) wcsncat ( dest , dest + 1 , 2 ) ;
wchar_t buffer [ ] = L " strncat " ;
// cppcheck-suppress overlappingWriteFunction
return wcsncat ( buffer , buffer + 1 , 3 ) ;
}
2021-07-10 09:20:51 +02:00
wchar_t * overlappingWriteFunction_wcscpy ( wchar_t * src , wchar_t * dest )
{
// No warning shall be shown:
( void ) wcscpy ( dest , src ) ;
const wchar_t * destBuf = dest ;
// TODO-cppcheck-suppress overlappingWriteFunction #10355
( void ) wcscpy ( dest , destBuf ) ;
// cppcheck-suppress overlappingWriteFunction
return wcscpy ( src , src ) ;
}
2021-07-09 16:32:54 +02:00
wchar_t * overlappingWriteFunction_wcsncpy ( wchar_t * buf , const std : : size_t count )
2021-07-09 09:48:24 +02:00
{
2021-07-09 16:32:54 +02:00
// No warning shall be shown:
( void ) wcsncpy ( & buf [ 0 ] , & buf [ 3 ] , count ) ; // size is not known
( void ) wcsncpy ( & buf [ 0 ] , & buf [ 3 ] , 3U ) ; // no-overlap
2021-07-09 09:48:24 +02:00
// cppcheck-suppress overlappingWriteFunction
2021-07-09 16:32:54 +02:00
return wcsncpy ( & buf [ 0 ] , & buf [ 3 ] , 4U ) ;
}
char * overlappingWriteFunction_strncpy ( char * buf , const std : : size_t count )
{
// No warning shall be shown:
( void ) strncpy ( & buf [ 0 ] , & buf [ 3 ] , count ) ; // size is not known
( void ) strncpy ( & buf [ 0 ] , & buf [ 3 ] , 3U ) ; // no-overlap
// cppcheck-suppress overlappingWriteFunction
return strncpy ( & buf [ 0 ] , & buf [ 3 ] , 4U ) ;
2021-07-09 09:48:24 +02:00
}
2021-07-10 18:28:26 +02:00
void * overlappingWriteFunction_memmove ( void )
{
// No warning shall be shown:
char str [ ] = " memmove handles overlapping data well " ;
return memmove ( str , str + 3 , 4 ) ;
}
2021-06-03 07:33:23 +02:00
std : : bitset < 10 > std_bitset_test_ignoredReturnValue ( )
{
std : : bitset < 10 > b1 ( " 1111010000 " ) ;
// cppcheck-suppress ignoredReturnValue
b1 . test ( 2 ) ;
return b1 ;
}
2015-08-10 23:44:36 +02:00
2021-06-03 07:55:26 +02:00
std : : bitset < 10 > std_bitset_all_ignoredReturnValue ( )
{
std : : bitset < 10 > b1 ( " 1111010000 " ) ;
// cppcheck-suppress ignoredReturnValue
b1 . all ( ) ;
return b1 ;
}
std : : bitset < 10 > std_bitset_none_ignoredReturnValue ( )
{
std : : bitset < 10 > b1 ( " 1111010000 " ) ;
// cppcheck-suppress ignoredReturnValue
b1 . none ( ) ;
return b1 ;
}
std : : bitset < 10 > std_bitset_any_ignoredReturnValue ( )
{
std : : bitset < 10 > b1 ( " 1111010000 " ) ;
// cppcheck-suppress ignoredReturnValue
b1 . any ( ) ;
return b1 ;
}
2021-06-03 08:07:53 +02:00
std : : bitset < 10 > std_bitset_size_ignoredReturnValue ( )
{
std : : bitset < 10 > b1 ( " 1111010000 " ) ;
// cppcheck-suppress ignoredReturnValue
b1 . size ( ) ;
return b1 ;
}
std : : bitset < 10 > std_bitset_count_ignoredReturnValue ( )
{
std : : bitset < 10 > b1 ( " 1111010000 " ) ;
// cppcheck-suppress ignoredReturnValue
b1 . count ( ) ;
return b1 ;
}
2022-09-16 07:12:36 +02:00
void std_unordered_set_count_ignoredReturnValue ( const std : : unordered_set < int > & u )
{
int i ;
// cppcheck-suppress [uninitvar, ignoredReturnValue]
u . count ( i ) ;
}
2023-02-11 10:48:17 +01:00
void std_unordered_map_count_ignoredReturnValue ( const std : : unordered_map < int , int > & u )
{
int i ;
// cppcheck-suppress [uninitvar, ignoredReturnValue]
u . count ( i ) ;
}
void std_multimap_count_ignoredReturnValue ( const std : : multimap < int , int > & m )
{
int i ;
// cppcheck-suppress [uninitvar, ignoredReturnValue]
m . count ( i ) ;
}
void std_unordered_map_insert_unnitvar ( std : : unordered_set < int > & u )
{
int i ;
// cppcheck-suppress uninitvar
u . insert ( i ) ;
}
void std_unordered_map_emplace_unnitvar ( std : : unordered_set < int > & u )
{
int i ;
// cppcheck-suppress uninitvar
u . emplace ( i ) ;
}
2019-10-18 12:24:57 +02:00
void valid_code ( )
{
std : : vector < int > vecInt { 0 , 1 , 2 } ;
std : : fill_n ( vecInt . begin ( ) , 2 , 0 ) ;
2019-10-18 12:40:10 +02:00
vecInt . push_back ( 1 ) ;
vecInt . pop_back ( ) ;
2019-10-18 12:24:57 +02:00
}
2018-11-20 16:58:33 +01:00
void returnValue_std_isgreater ( void )
{
// cppcheck-suppress knownConditionTrueFalse
if ( std : : isgreater ( 4 , 2 ) = = 0 ) { }
// @todo support floats
if ( std : : isgreater ( 4.0f , 2.0f ) = = 0 ) { }
}
void returnValue_std_isgreaterequal ( void )
{
// cppcheck-suppress knownConditionTrueFalse
if ( std : : isgreaterequal ( 4 , 2 ) = = 0 ) { }
// @todo support floats
if ( std : : isgreaterequal ( 4.0f , 2.0f ) = = 0 ) { }
}
void returnValue_std_isless ( void )
{
// cppcheck-suppress knownConditionTrueFalse
if ( std : : isless ( 4 , 2 ) = = 0 ) { }
// @todo support floats
if ( std : : isless ( 4.0f , 2.0f ) = = 0 ) { }
}
void returnValue_std_islessequal ( void )
{
// cppcheck-suppress knownConditionTrueFalse
if ( std : : islessequal ( 4 , 2 ) = = 0 ) { }
// @todo support floats
if ( std : : islessequal ( 4.0f , 2.0f ) = = 0 ) { }
}
void returnValue_std_islessgreater ( void )
{
// cppcheck-suppress knownConditionTrueFalse
if ( std : : islessgreater ( 4 , 2 ) = = 0 ) { }
// cppcheck-suppress knownConditionTrueFalse
if ( std : : islessgreater ( 2 , 4 ) = = 0 ) { }
if ( std : : islessgreater ( 4.0f , 2.0f ) = = 0 ) { } // @todo support floats
if ( std : : islessgreater ( 2.0f , 4.0f ) = = 0 ) { } // @todo support floats
}
2015-08-14 01:36:44 +02:00
void bufferAccessOutOfBounds ( void )
{
char a [ 5 ] ;
std : : strcpy ( a , " abcd " ) ;
// cppcheck-suppress bufferAccessOutOfBounds
2018-11-24 11:27:27 +01:00
// TODO cppcheck-suppress redundantCopy
2015-08-14 01:36:44 +02:00
std : : strcpy ( a , " abcde " ) ;
2018-11-24 11:27:27 +01:00
// TODO cppcheck-suppress redundantCopy
2019-09-11 19:25:09 +02:00
// cppcheck-suppress terminateStrncpy
2015-08-14 01:36:44 +02:00
std : : strncpy ( a , " abcde " , 5 ) ;
// cppcheck-suppress bufferAccessOutOfBounds
2018-11-24 11:27:27 +01:00
// TODO cppcheck-suppress redundantCopy
2015-08-14 01:36:44 +02:00
std : : strncpy ( a , " abcde " , 6 ) ;
}
2015-08-16 00:52:52 +02:00
void uninitvar_abs ( void )
2015-08-14 01:36:44 +02:00
{
int i ;
// cppcheck-suppress uninitvar
2015-08-15 14:35:23 +02:00
( void ) std : : abs ( i ) ;
2015-08-16 00:52:52 +02:00
}
2015-08-14 01:36:44 +02:00
2015-09-18 23:57:20 +02:00
void uninivar_imaxabs ( void )
{
2019-03-02 19:38:11 +01:00
intmax_t i1 , i2 ;
2015-09-18 23:57:20 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : imaxabs ( i1 ) ;
2015-09-18 23:57:20 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) imaxabs ( i2 ) ;
2015-09-18 23:57:20 +02:00
}
2015-08-16 00:52:52 +02:00
void uninitvar_isalnum ( void )
{
int i ;
2015-08-14 01:36:44 +02:00
// cppcheck-suppress uninitvar
2015-08-15 14:35:23 +02:00
( void ) std : : isalnum ( i ) ;
2015-08-16 00:52:52 +02:00
}
void uninitvar_isalpha ( void )
{
int i ;
2015-08-14 01:36:44 +02:00
// cppcheck-suppress uninitvar
2015-08-15 14:35:23 +02:00
( void ) std : : isalpha ( i ) ;
2015-08-16 00:52:52 +02:00
}
void uninitvar_iscntrl ( void )
{
int i ;
2015-08-14 01:36:44 +02:00
// cppcheck-suppress uninitvar
2015-08-15 14:35:23 +02:00
( void ) std : : iscntrl ( i ) ;
2015-08-16 00:52:52 +02:00
}
void uninitvar_isdigit ( void )
{
int i ;
2015-08-14 01:36:44 +02:00
// cppcheck-suppress uninitvar
2015-08-15 14:35:23 +02:00
( void ) std : : isdigit ( i ) ;
2015-08-16 00:52:52 +02:00
}
void uninitvar_isgraph ( void )
{
int i ;
2015-08-14 01:36:44 +02:00
// cppcheck-suppress uninitvar
2015-08-15 14:35:23 +02:00
( void ) std : : isgraph ( i ) ;
2015-08-16 00:52:52 +02:00
}
void uninitvar_islower ( void )
{
int i ;
2015-08-14 01:36:44 +02:00
// cppcheck-suppress uninitvar
2015-08-15 14:35:23 +02:00
( void ) std : : islower ( i ) ;
2015-08-16 00:52:52 +02:00
}
void uninitvar_isprint ( void )
{
int i ;
2015-08-14 01:36:44 +02:00
// cppcheck-suppress uninitvar
2015-08-15 14:35:23 +02:00
( void ) std : : isprint ( i ) ;
2015-08-16 00:52:52 +02:00
}
void uninitvar_isspace ( void )
{
int i ;
2015-08-14 01:36:44 +02:00
// cppcheck-suppress uninitvar
2015-08-15 14:35:23 +02:00
( void ) std : : isspace ( i ) ;
2015-08-16 00:52:52 +02:00
}
void uninitvar_isupper ( void )
{
int i ;
2015-08-14 01:36:44 +02:00
// cppcheck-suppress uninitvar
2015-08-15 14:35:23 +02:00
( void ) std : : isupper ( i ) ;
2015-08-16 00:52:52 +02:00
}
void uninitvar_isxdigit ( void )
{
int i ;
2015-08-14 01:36:44 +02:00
// cppcheck-suppress uninitvar
2015-08-15 14:35:23 +02:00
( void ) std : : isxdigit ( i ) ;
2015-08-16 00:52:52 +02:00
}
void uninitvar_proj ( void )
{
double d ;
const std : : complex < double > dc ( d , d ) ;
2018-01-10 15:52:06 +01:00
// TODO cppcheck-suppress uninitvar
2015-08-16 00:52:52 +02:00
( void ) std : : proj ( dc ) ;
}
void uninitvar_acos ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : acos ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : acos ( d ) ;
2015-08-14 01:36:44 +02:00
2015-08-16 00:52:52 +02:00
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : acos ( ld ) ;
}
void uninitvar_acosh ( void )
{
float f ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : acoshf ( f ) ;
2015-08-16 00:52:52 +02:00
double d ;
// cppcheck-suppress uninitvar
( void ) std : : acosh ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : acoshl ( ld ) ;
2015-08-16 00:52:52 +02:00
}
void uninitvar_asctime ( void )
{
2015-08-14 01:36:44 +02:00
const struct tm * tm ;
// cppcheck-suppress uninitvar
2015-11-22 17:52:47 +01:00
// cppcheck-suppress asctimeCalled
2015-08-15 14:35:23 +02:00
( void ) std : : asctime ( tm ) ;
2015-08-10 23:44:36 +02:00
}
2015-08-16 00:52:52 +02:00
void uninitvar_sqrt ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : sqrt ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : sqrt ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : sqrt ( ld ) ;
}
void uninitvar_sinh ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : sinh ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : sinh ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : sinh ( ld ) ;
}
void uninitvar_sin ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : sin ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : sin ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : sin ( ld ) ;
}
void uninitvar_asin ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : asin ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : asin ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : asin ( ld ) ;
}
void uninitvar_asinh ( void )
{
float f ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : asinhf ( f ) ;
2015-08-16 00:52:52 +02:00
double d ;
// cppcheck-suppress uninitvar
( void ) std : : asinh ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : asinhl ( ld ) ;
2015-08-16 00:52:52 +02:00
}
2015-08-16 01:09:03 +02:00
void uninitvar_wcsftime ( wchar_t * ptr )
{
size_t maxsize ;
2023-08-05 18:48:43 +02:00
const wchar_t * format ;
const struct tm * timeptr ;
2015-08-16 01:09:03 +02:00
// cppcheck-suppress uninitvar
( void ) std : : wcsftime ( ptr , maxsize , format , timeptr ) ;
}
2015-08-16 01:21:11 +02:00
void uninitvar_tan ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : tan ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : tan ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : tan ( ld ) ;
}
void uninitvar_tanh ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : tanh ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : tanh ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : tanh ( ld ) ;
}
2015-08-16 14:38:13 +02:00
void uninitvar_atan ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : atan ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : atan ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : atan ( ld ) ;
}
void uninitvar_tgamma ( void )
{
float f ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : tgammaf ( f ) ;
2015-08-16 14:38:13 +02:00
double d ;
// cppcheck-suppress uninitvar
( void ) std : : tgamma ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : tgammal ( ld ) ;
2015-08-16 14:38:13 +02:00
}
void uninitvar_trunc ( void )
{
float f ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : truncf ( f ) ;
2015-08-16 14:38:13 +02:00
double d ;
// cppcheck-suppress uninitvar
( void ) std : : trunc ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : truncl ( ld ) ;
2015-08-16 14:38:13 +02:00
}
void uninitvar_atanh ( void )
{
float f ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : atanhf ( f ) ;
2015-08-16 14:38:13 +02:00
double d ;
// cppcheck-suppress uninitvar
( void ) std : : atanh ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : atanhl ( ld ) ;
2015-08-16 14:38:13 +02:00
}
void uninitvar_atan2 ( void )
{
float f1 , f2 ;
// cppcheck-suppress uninitvar
( void ) std : : atan2 ( f1 , f2 ) ;
double d1 , d2 ;
// cppcheck-suppress uninitvar
( void ) std : : atan2 ( d1 , d2 ) ;
long double ld1 , ld2 ;
// cppcheck-suppress uninitvar
( void ) std : : atan2 ( ld1 , ld2 ) ;
}
2015-08-16 14:49:35 +02:00
2015-09-11 16:50:59 +02:00
void uninitvar_atof ( void )
{
2023-08-05 18:48:43 +02:00
const char * c ;
2015-09-11 16:50:59 +02:00
// cppcheck-suppress uninitvar
( void ) std : : atof ( c ) ;
}
2015-08-16 14:49:35 +02:00
void uninitvar_atol ( void )
{
2023-08-05 18:48:43 +02:00
const char * c1 , * c2 , * c3 ;
2015-08-16 14:49:35 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : atoi ( c1 ) ;
2015-08-16 14:49:35 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : atol ( c2 ) ;
2015-08-16 14:49:35 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : atoll ( c3 ) ;
2015-08-16 14:49:35 +02:00
}
2015-08-16 15:05:42 +02:00
2015-08-28 17:04:47 +02:00
void uninitvar_ceil ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : ceil ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : ceil ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : ceil ( ld ) ;
}
void uninitvar_copysign ( void )
{
float f1 , f2 ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : copysignf ( f1 , f2 ) ;
2015-08-28 17:04:47 +02:00
double d1 , d2 ;
// cppcheck-suppress uninitvar
( void ) std : : copysign ( d1 , d2 ) ;
long double ld1 , ld2 ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : copysignl ( ld1 , ld2 ) ;
2015-08-28 17:04:47 +02:00
}
void uninitvar_cbrt ( void )
{
float f ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : cbrtf ( f ) ;
2015-08-28 17:04:47 +02:00
double d ;
// cppcheck-suppress uninitvar
( void ) std : : cbrt ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : cbrtl ( ld ) ;
2015-08-28 17:04:47 +02:00
}
void uninitvar_cos ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : cos ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : cos ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : cos ( ld ) ;
}
void uninitvar_clearerr ( void )
{
FILE * stream ;
// cppcheck-suppress uninitvar
std : : clearerr ( stream ) ;
}
void uninitvar_cosh ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : cosh ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : cosh ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : cosh ( ld ) ;
}
2015-08-16 15:05:42 +02:00
void uninitvar_feraiseexcept ( void )
{
2020-12-05 08:00:31 +01:00
int expects ;
2015-08-16 15:05:42 +02:00
// cppcheck-suppress uninitvar
2020-12-05 08:00:31 +01:00
( void ) std : : feraiseexcept ( expects ) ;
2015-08-16 15:05:42 +02:00
}
2023-08-05 18:48:43 +02:00
void uninitvar_fesetexceptflag ( const fexcept_t * flagp )
2015-08-16 15:05:42 +02:00
{
2020-12-05 08:00:31 +01:00
int expects ;
2015-08-16 15:05:42 +02:00
// cppcheck-suppress uninitvar
2020-12-05 08:00:31 +01:00
( void ) std : : fesetexceptflag ( flagp , expects ) ;
2015-08-16 15:05:42 +02:00
}
void uninitvar_feclearexcept ( void )
{
int i ;
// cppcheck-suppress uninitvar
( void ) std : : feclearexcept ( i ) ;
}
void uninitvar_fesetenv ( void )
{
2023-08-05 18:48:43 +02:00
const fenv_t * envp ;
2015-08-16 15:05:42 +02:00
// cppcheck-suppress uninitvar
( void ) std : : fesetenv ( envp ) ;
}
void uninitvar_fesetround ( void )
{
int i ;
// cppcheck-suppress uninitvar
( void ) std : : fesetround ( i ) ;
}
void uninitvar_fetestexcept ( void )
{
int i ;
// cppcheck-suppress uninitvar
( void ) std : : fetestexcept ( i ) ;
}
void uninitvar_feupdateenv ( void )
{
2023-08-05 18:48:43 +02:00
const fenv_t * envp ;
2015-08-16 15:05:42 +02:00
// cppcheck-suppress uninitvar
( void ) std : : feupdateenv ( envp ) ;
}
2015-08-29 00:09:33 +02:00
void uninitvar_ctime ( void )
{
2023-08-05 18:48:43 +02:00
const time_t * tp ;
2015-08-29 00:09:33 +02:00
// cppcheck-suppress uninitvar
( void ) std : : ctime ( tp ) ;
}
void uninitvar_difftime ( void )
{
time_t t1 , t2 ;
// cppcheck-suppress uninitvar
( void ) std : : difftime ( t1 , t2 ) ;
}
void uninitvar_div ( void )
{
int num ;
int denom ;
// cppcheck-suppress uninitvar
( void ) std : : div ( num , denom ) ;
}
2015-09-18 23:57:20 +02:00
void uninitvar_imaxdiv ( void )
{
2019-03-02 19:38:11 +01:00
intmax_t numer1 , numer2 ;
intmax_t denom1 , denom2 ;
2015-09-18 23:57:20 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : imaxdiv ( numer1 , denom1 ) ;
2015-09-18 23:57:20 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) imaxdiv ( numer2 , denom2 ) ;
2015-09-18 23:57:20 +02:00
}
2015-08-29 00:09:33 +02:00
void uninitvar_exit ( void )
{
int i ;
// cppcheck-suppress uninitvar
std : : exit ( i ) ;
}
void uninitvar_erf ( void )
{
float f ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : erff ( f ) ;
2015-08-29 00:09:33 +02:00
double d ;
// cppcheck-suppress uninitvar
( void ) std : : erf ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : erfl ( ld ) ;
2015-08-29 00:09:33 +02:00
}
void uninitvar_erfc ( void )
{
float f ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : erfcf ( f ) ;
2015-08-29 00:09:33 +02:00
double d ;
// cppcheck-suppress uninitvar
( void ) std : : erfc ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : erfcl ( ld ) ;
2015-08-29 00:09:33 +02:00
}
2015-08-29 01:43:17 +02:00
void uninitvar_exp ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : exp ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : exp ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : exp ( ld ) ;
}
void uninitvar_exp2 ( void )
{
float f ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : exp2f ( f ) ;
2015-08-29 01:43:17 +02:00
double d ;
// cppcheck-suppress uninitvar
( void ) std : : exp2 ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : exp2l ( ld ) ;
2015-08-29 01:43:17 +02:00
}
void uninitvar_expm1 ( void )
{
float f ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : expm1f ( f ) ;
2015-08-29 01:43:17 +02:00
double d ;
// cppcheck-suppress uninitvar
( void ) std : : expm1 ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
2015-09-02 15:43:52 +02:00
( void ) std : : expm1l ( ld ) ;
2015-08-29 01:43:17 +02:00
}
void uninitvar_fabs ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : fabs ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : fabs ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : fabs ( ld ) ;
}
void uninitvar_fdim ( void )
{
float f1 , f2 ;
// cppcheck-suppress uninitvar
2015-09-02 12:00:03 +02:00
( void ) std : : fdimf ( f1 , f2 ) ;
2015-08-29 01:43:17 +02:00
double d1 , d2 ;
// cppcheck-suppress uninitvar
( void ) std : : fdim ( d1 , d2 ) ;
long double ld1 , ld2 ;
// cppcheck-suppress uninitvar
2015-09-02 12:00:03 +02:00
( void ) std : : fdiml ( ld1 , ld2 ) ;
2015-08-29 01:43:17 +02:00
}
void uninitvar_fclose ( void )
{
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : fclose ( stream ) ;
}
void uninitvar_ferror ( void )
{
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : ferror ( stream ) ;
}
void uninitvar_feof ( void )
{
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : feof ( stream ) ;
}
void uninitvar_fflush ( void )
{
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : fflush ( stream ) ;
}
void uninitvar_fgetc ( void )
{
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : fgetc ( stream ) ;
}
void uninitvar_fgetwc ( void )
{
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : fgetwc ( stream ) ;
}
void uninitvar_fgetpos ( void )
{
FILE * stream ;
fpos_t * ptr ;
// cppcheck-suppress uninitvar
( void ) std : : fgetpos ( stream , ptr ) ;
}
void uninitvar_floor ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : floor ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : floor ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : floor ( ld ) ;
}
void uninitvar_fma ( void )
{
float f1 , f2 , f3 ;
// cppcheck-suppress uninitvar
2015-09-02 12:00:03 +02:00
( void ) std : : fmaf ( f1 , f2 , f3 ) ;
2015-08-29 01:43:17 +02:00
double d1 , d2 , d3 ;
// cppcheck-suppress uninitvar
( void ) std : : fma ( d1 , d2 , d3 ) ;
long double ld1 , ld2 , ld3 ;
// cppcheck-suppress uninitvar
2015-09-02 12:00:03 +02:00
( void ) std : : fmal ( ld1 , ld2 , ld3 ) ;
2015-08-29 01:43:17 +02:00
}
2015-08-30 11:59:33 +02:00
2015-08-30 12:05:38 +02:00
void uninitvar_fmax ( void )
{
float f1 , f2 ;
// cppcheck-suppress uninitvar
2015-09-02 12:00:03 +02:00
( void ) std : : fmaxf ( f1 , f2 ) ;
2015-08-30 12:05:38 +02:00
double d1 , d2 ;
// cppcheck-suppress uninitvar
( void ) std : : fmax ( d1 , d2 ) ;
long double ld1 , ld2 ;
// cppcheck-suppress uninitvar
2015-09-02 12:00:03 +02:00
( void ) std : : fmaxl ( ld1 , ld2 ) ;
2015-08-30 12:05:38 +02:00
}
void uninitvar_fmin ( void )
{
float f1 , f2 ;
// cppcheck-suppress uninitvar
2015-09-02 12:00:03 +02:00
( void ) std : : fminf ( f1 , f2 ) ;
2015-08-30 12:05:38 +02:00
double d1 , d2 ;
// cppcheck-suppress uninitvar
( void ) std : : fmin ( d1 , d2 ) ;
long double ld1 , ld2 ;
// cppcheck-suppress uninitvar
2015-09-02 12:00:03 +02:00
( void ) std : : fminl ( ld1 , ld2 ) ;
2015-08-30 12:05:38 +02:00
}
void uninitvar_fmod ( void )
{
float f1 , f2 ;
// cppcheck-suppress uninitvar
( void ) std : : fmod ( f1 , f2 ) ;
double d1 , d2 ;
// cppcheck-suppress uninitvar
( void ) std : : fmod ( d1 , d2 ) ;
long double ld1 , ld2 ;
// cppcheck-suppress uninitvar
( void ) std : : fmod ( ld1 , ld2 ) ;
}
2015-08-31 11:39:25 +02:00
void uninitar_fopen ( void )
{
2023-08-05 18:48:43 +02:00
const char * filename ;
const char * mode ;
2015-08-31 11:39:25 +02:00
// cppcheck-suppress uninitvar
FILE * fp = std : : fopen ( filename , mode ) ;
fclose ( fp ) ;
}
2023-08-05 18:48:43 +02:00
void uninitar_fprintf ( FILE * Stream , const char * Format , int Argument )
2015-08-31 11:39:25 +02:00
{
2021-10-03 20:32:39 +02:00
FILE * stream1 , * stream2 ;
2023-08-05 18:48:43 +02:00
const char * format1 , * format2 ;
2019-03-02 19:38:11 +01:00
int argument1 , argument2 ;
2015-08-31 11:39:25 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : fprintf ( stream1 , format1 , argument1 ) ;
2015-09-30 12:18:56 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : fprintf ( stream2 , Format , Argument ) ;
2015-09-30 12:18:56 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : fprintf ( Stream , format2 , Argument ) ;
2015-09-30 12:18:56 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : fprintf ( Stream , Format , argument2 ) ;
2015-09-30 12:18:56 +02:00
// no warning is expected
( void ) std : : fprintf ( Stream , Format , Argument ) ;
2015-08-31 11:39:25 +02:00
}
2015-09-30 12:18:56 +02:00
void uninitar_vfprintf ( FILE * Stream , const char * Format , va_list Arg )
2015-08-31 11:39:25 +02:00
{
2021-10-03 20:32:39 +02:00
FILE * stream1 , * stream2 ;
2023-08-05 18:48:43 +02:00
const char * format1 , * format2 ;
2015-08-31 11:39:25 +02:00
va_list arg ;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : vfprintf ( stream1 , format1 , arg ) ;
2015-09-30 12:18:56 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : vfprintf ( stream2 , Format , Arg ) ;
2015-09-30 12:18:56 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : vfprintf ( Stream , format2 , Arg ) ;
2015-09-30 12:18:56 +02:00
// no warning is expected
( void ) std : : vfprintf ( Stream , Format , Arg ) ;
2015-09-30 12:45:40 +02:00
// cppcheck-suppress va_list_usedBeforeStarted
( void ) std : : vfprintf ( Stream , Format , arg ) ;
2015-08-31 11:39:25 +02:00
}
2023-08-05 18:48:43 +02:00
void uninitar_vfwprintf ( FILE * Stream , const wchar_t * Format , va_list Arg )
2015-08-31 11:39:25 +02:00
{
2021-10-03 20:32:39 +02:00
FILE * stream1 , * stream2 ;
2023-08-05 18:48:43 +02:00
const wchar_t * format1 , * format2 ;
2015-08-31 11:39:25 +02:00
va_list arg ;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : vfwprintf ( stream1 , format1 , arg ) ;
2015-09-30 12:18:56 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : vfwprintf ( stream2 , Format , Arg ) ;
2015-09-30 12:18:56 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : vfwprintf ( Stream , format2 , Arg ) ;
2015-09-30 12:18:56 +02:00
// no warning is expected
( void ) std : : vfwprintf ( Stream , Format , Arg ) ;
2015-09-30 12:45:40 +02:00
// cppcheck-suppress va_list_usedBeforeStarted
( void ) std : : vfwprintf ( Stream , Format , arg ) ;
2015-08-31 11:39:25 +02:00
}
void uninitvar_fputc ( void )
{
int c ;
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : fputc ( c , stream ) ;
}
void uninitvar_fputwc ( void )
{
wchar_t c ;
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : fputwc ( c , stream ) ;
}
void uninitvar_fputs ( void )
{
2023-08-05 18:48:43 +02:00
const char * string ;
2015-08-31 11:39:25 +02:00
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : fputs ( string , stream ) ;
}
void uninitvar_fputws ( void )
{
2023-08-05 18:48:43 +02:00
const wchar_t * string ;
2015-08-31 11:39:25 +02:00
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : fputws ( string , stream ) ;
}
2015-08-31 11:59:57 +02:00
void uninitvar_fread ( void )
{
void * ptr ;
size_t size ;
size_t nobj ;
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : fread ( ptr , size , nobj , stream ) ;
}
void uninitvar_free ( void )
{
void * block ;
// cppcheck-suppress uninitvar
std : : free ( block ) ;
}
void uninitvar_freopen ( void )
{
2023-08-05 18:48:43 +02:00
const char * filename ;
const char * mode ;
2015-08-31 11:59:57 +02:00
FILE * stream ;
// cppcheck-suppress uninitvar
FILE * p = std : : freopen ( filename , mode , stream ) ;
free ( p ) ;
}
2015-08-31 13:35:57 +02:00
void uninitvar_frexp ( void )
{
float f1 ;
int * i1 ;
// cppcheck-suppress uninitvar
( void ) std : : frexp ( f1 , i1 ) ;
double d1 ;
int * i2 ;
// cppcheck-suppress uninitvar
( void ) std : : frexp ( d1 , i2 ) ;
long double ld1 ;
int * i3 ;
// cppcheck-suppress uninitvar
( void ) std : : frexp ( ld1 , i3 ) ;
}
void uninitvar_hypot ( void )
{
float f1 , f2 ;
// cppcheck-suppress uninitvar
2015-09-02 12:00:03 +02:00
( void ) std : : hypotf ( f1 , f2 ) ;
2015-08-31 13:35:57 +02:00
double d1 , d2 ;
// cppcheck-suppress uninitvar
( void ) std : : hypot ( d1 , d2 ) ;
long double ld1 , ld2 ;
// cppcheck-suppress uninitvar
2015-09-02 12:00:03 +02:00
( void ) std : : hypotl ( ld1 , ld2 ) ;
2015-08-31 13:35:57 +02:00
}
2015-08-31 17:10:10 +02:00
void uninitvar_fscanf ( void )
{
FILE * stream ;
2023-08-05 18:48:43 +02:00
const char * format ;
2015-08-31 17:10:10 +02:00
int i ;
// cppcheck-suppress uninitvar
( void ) std : : fscanf ( stream , format , i ) ;
}
2015-09-01 11:29:28 +02:00
void uninitvar_vfscanf ( void )
{
FILE * stream ;
2023-08-05 18:48:43 +02:00
const char * format ;
2015-09-01 11:29:28 +02:00
va_list arg ;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
( void ) std : : vfscanf ( stream , format , arg ) ;
}
void uninitvar_vfwscanf ( void )
{
FILE * stream ;
2023-08-05 18:48:43 +02:00
const wchar_t * format ;
2015-09-01 11:29:28 +02:00
va_list arg ;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
( void ) std : : vfwscanf ( stream , format , arg ) ;
}
void uninitvar_fseek ( void )
{
FILE * stream ;
long int offset ;
int origin ;
// cppcheck-suppress uninitvar
( void ) std : : fseek ( stream , offset , origin ) ;
}
2022-02-06 16:05:14 +01:00
void invalidFunctionArg_fseek ( FILE * stream , long int offset , int origin )
{
// cppcheck-suppress invalidFunctionArg
( void ) std : : fseek ( stream , offset , - 1 ) ;
// cppcheck-suppress invalidFunctionArg
( void ) std : : fseek ( stream , offset , 3 ) ;
// cppcheck-suppress invalidFunctionArg
( void ) std : : fseek ( stream , offset , 42 + SEEK_SET ) ;
// cppcheck-suppress invalidFunctionArg
( void ) std : : fseek ( stream , offset , SEEK_SET + 42 ) ;
// No warning is expected for
( void ) std : : fseek ( stream , offset , origin ) ;
( void ) std : : fseek ( stream , offset , SEEK_SET ) ;
( void ) std : : fseek ( stream , offset , SEEK_CUR ) ;
( void ) std : : fseek ( stream , offset , SEEK_END ) ;
}
2022-02-07 09:02:24 +01:00
void invalidFunctionArgBool_fseek ( FILE * stream , long int offset , int origin )
{
// cppcheck-suppress invalidFunctionArgBool
( void ) std : : fseek ( stream , offset , true ) ;
// cppcheck-suppress invalidFunctionArgBool
( void ) std : : fseek ( stream , offset , false ) ;
}
2015-09-01 11:29:28 +02:00
void uninitvar_fsetpos ( void )
{
FILE * stream ;
2023-08-05 18:48:43 +02:00
const fpos_t * ptr ;
2015-09-01 11:29:28 +02:00
// cppcheck-suppress uninitvar
( void ) std : : fsetpos ( stream , ptr ) ;
}
2022-04-20 08:50:45 +02:00
wchar_t * nullPointer_fgetws ( wchar_t * buffer , int n , FILE * stream )
{
// cppcheck-suppress nullPointer
( void ) std : : fgetws ( NULL , n , stream ) ;
// cppcheck-suppress nullPointer
( void ) std : : fgetws ( buffer , n , NULL ) ;
// No warning is expected
return std : : fgetws ( buffer , n , stream ) ;
}
2022-04-21 16:09:36 +02:00
void nullPointer_wmemcmp ( const wchar_t * s1 , const wchar_t * s2 , size_t n )
{
// cppcheck-suppress nullPointer
( void ) std : : wmemcmp ( NULL , s2 , n ) ;
// cppcheck-suppress nullPointer
( void ) std : : wmemcmp ( s1 , NULL , n ) ;
( void ) std : : wmemcmp ( s1 , s2 , n ) ;
}
2022-04-21 21:01:38 +02:00
void nullPointer_memcmp ( const void * s1 , const void * s2 , size_t n )
{
// cppcheck-suppress nullPointer
( void ) std : : memcmp ( NULL , s2 , n ) ;
// cppcheck-suppress nullPointer
( void ) std : : memcmp ( s1 , NULL , n ) ;
( void ) std : : memcmp ( s1 , s2 , n ) ;
}
2023-08-05 18:48:43 +02:00
void nullPointer_strncat ( char * d , const char * s , size_t n )
2022-04-21 16:43:52 +02:00
{
// cppcheck-suppress nullPointer
( void ) std : : strncat ( NULL , s , n ) ;
// cppcheck-suppress nullPointer
( void ) std : : strncat ( d , NULL , n ) ;
// no warning is expected for
( void ) std : : strncat ( d , s , n ) ;
}
2022-04-21 16:59:25 +02:00
void nullPointer_strcpy ( char * dest , const char * const source )
{
// cppcheck-suppress nullPointer
( void ) std : : strcpy ( NULL , source ) ;
// cppcheck-suppress nullPointer
( void ) std : : strcpy ( dest , NULL ) ;
// no warning shall be shown for
( void ) std : : strcpy ( dest , source ) ;
}
void nullPointer_strcat ( char * dest , const char * const source )
{
// cppcheck-suppress nullPointer
( void ) std : : strcat ( NULL , source ) ;
// cppcheck-suppress nullPointer
( void ) std : : strcat ( dest , NULL ) ;
// no warning shall be shown for
( void ) std : : strcat ( dest , source ) ;
}
2022-04-21 16:47:19 +02:00
void nullPointer_strncpy ( char * d , const char * s , size_t n )
{
// cppcheck-suppress nullPointer
( void ) std : : strncpy ( NULL , s , n ) ;
// cppcheck-suppress nullPointer
( void ) std : : strncpy ( d , NULL , n ) ;
// no warning is expected for
( void ) std : : strncpy ( d , s , n ) ;
}
2022-04-21 16:09:36 +02:00
void nullPointer_strncmp ( const char * s1 , const char * s2 , size_t n )
{
// cppcheck-suppress nullPointer
( void ) std : : strncmp ( NULL , s2 , n ) ;
// cppcheck-suppress nullPointer
( void ) std : : strncmp ( s1 , NULL , n ) ;
( void ) std : : strncmp ( s1 , s2 , n ) ;
}
2022-04-20 08:50:45 +02:00
char * nullPointer_fgets ( char * buffer , int n , FILE * stream )
{
// cppcheck-suppress nullPointer
( void ) std : : fgets ( NULL , n , stream ) ;
// cppcheck-suppress nullPointer
( void ) std : : fgets ( buffer , n , NULL ) ;
// No warning is expected
return std : : fgets ( buffer , n , stream ) ;
}
2015-09-01 11:29:28 +02:00
void uninitvar_fgets ( void )
{
char * buffer ;
int n ;
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : fgets ( buffer , n , stream ) ;
}
void uninitvar_fgetws ( void )
{
wchar_t * buffer ;
int n ;
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : fgetws ( buffer , n , stream ) ;
}
void uninitvar_ftell ( void )
{
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : ftell ( stream ) ;
}
void uninitvar_fwide ( void )
{
FILE * stream ;
int mode ;
// cppcheck-suppress uninitvar
( void ) std : : fwide ( stream , mode ) ;
}
void uninitvar_fwrite ( void )
{
2023-08-05 18:48:43 +02:00
const void * ptr ;
2015-09-01 11:29:28 +02:00
size_t size ;
size_t nobj ;
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : fwrite ( ptr , size , nobj , stream ) ;
}
void uninitvar_mblen ( void )
{
2023-08-05 18:48:43 +02:00
const char * string ;
2015-09-01 11:29:28 +02:00
size_t size ;
// cppcheck-suppress uninitvar
( void ) std : : mblen ( string , size ) ;
}
void uninitvar_mbtowc ( void )
{
wchar_t * pwc ;
2023-08-05 18:48:43 +02:00
const char * pmb ;
2015-09-01 11:29:28 +02:00
size_t max ;
// cppcheck-suppress uninitvar
( void ) std : : mbtowc ( pwc , pmb , max ) ;
}
void uninitvar_mbrlen ( const char * p , size_t m , mbstate_t * s )
{
2023-08-05 18:48:43 +02:00
const char * pmb1 , * pmb2 ;
2019-03-02 19:38:11 +01:00
size_t max1 , max2 ;
mbstate_t * ps1 , * ps2 ;
2015-09-01 11:29:28 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : mbrlen ( pmb1 , max1 , ps1 ) ;
2015-09-01 11:29:28 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : mbrlen ( pmb2 , m , s ) ;
2015-09-01 11:29:28 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : mbrlen ( p , max2 , s ) ;
2015-09-01 11:29:28 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : mbrlen ( p , m , ps2 ) ;
2015-09-01 11:29:28 +02:00
// no warning is expected
( void ) std : : mbrlen ( p , m , s ) ;
}
2019-08-27 08:18:19 +02:00
void nullPointer_mbrlen ( const char * p , size_t m , mbstate_t * s )
{
// no warning is expected: A call to the function with a null pointer as pmb resets the shift state (and ignores parameter max).
( void ) std : : mbrlen ( NULL , m , s ) ;
( void ) std : : mbrlen ( NULL , 0 , s ) ;
// cppcheck-suppress nullPointer
( void ) std : : mbrlen ( p , m , NULL ) ;
}
2015-09-01 11:29:28 +02:00
void uninitvar_btowc ( void )
{
int c ;
// cppcheck-suppress uninitvar
( void ) std : : btowc ( c ) ;
}
void uninitvar_mbsinit ( void )
{
2023-08-05 18:48:43 +02:00
const mbstate_t * ps ;
2015-09-01 11:29:28 +02:00
// cppcheck-suppress uninitvar
( void ) std : : mbsinit ( ps ) ;
}
void uninitvar_mbstowcs ( void )
{
wchar_t * ws ;
2023-08-05 18:48:43 +02:00
const char * s ;
2015-09-01 11:29:28 +02:00
size_t n ;
// cppcheck-suppress uninitvar
( void ) std : : mbstowcs ( ws , s , n ) ;
}
void uninitvar_mbsrtowcs ( void )
{
wchar_t * dest ;
const char * src ;
size_t max ;
mbstate_t * ps ;
// cppcheck-suppress uninitvar
( void ) std : : mbsrtowcs ( dest , & src , max , ps ) ;
}
void uninitvar_wctob ( void )
{
wint_t wc ;
// cppcheck-suppress uninitvar
( void ) std : : wctob ( wc ) ;
}
void uninitvar_wctomb ( void )
{
char * s ;
wchar_t wc ;
// cppcheck-suppress uninitvar
( void ) std : : wctomb ( s , wc ) ;
}
void uninitvar_wcstombs ( void )
{
char * mbstr ;
2023-08-05 18:48:43 +02:00
const wchar_t * wcstr ;
2015-09-01 11:29:28 +02:00
size_t n ;
// cppcheck-suppress uninitvar
( void ) std : : wcstombs ( mbstr , wcstr , n ) ;
}
void uninitvar_getc ( void )
{
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : getc ( stream ) ;
}
void uninitvar_getwc ( void )
{
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : getwc ( stream ) ;
}
void uninitvar_ungetc ( void )
{
int c ;
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : ungetc ( c , stream ) ;
}
void uninitvar_ungetwc ( void )
{
wint_t c ;
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : ungetwc ( c , stream ) ;
}
2015-09-01 11:59:24 +02:00
void uninitvar_getenv ( void )
{
2023-08-05 18:48:43 +02:00
const char * name ;
2015-09-01 11:59:24 +02:00
// cppcheck-suppress uninitvar
( void ) std : : getenv ( name ) ;
}
void uninitvar_gmtime ( void )
{
2023-08-05 18:48:43 +02:00
const time_t * tp ;
2015-09-01 11:59:24 +02:00
// cppcheck-suppress uninitvar
( void ) std : : gmtime ( tp ) ;
}
void uninitvar_iswalnum ( void )
{
wint_t i ;
// cppcheck-suppress uninitvar
( void ) std : : iswalnum ( i ) ;
}
void uninitvar_iswalpha ( void )
{
wint_t i ;
// cppcheck-suppress uninitvar
( void ) std : : iswalpha ( i ) ;
}
void uninitvar_isblank ( void )
{
int i ;
// cppcheck-suppress uninitvar
( void ) std : : isblank ( i ) ;
}
void uninitvar_iswblank ( void )
{
wint_t i ;
// cppcheck-suppress uninitvar
( void ) std : : iswblank ( i ) ;
}
void uninitvar_iswcntrl ( void )
{
wint_t i ;
// cppcheck-suppress uninitvar
( void ) std : : iswcntrl ( i ) ;
}
void uninitvar_iswctype ( void )
{
wint_t c ;
wctype_t desc ;
// cppcheck-suppress uninitvar
( void ) std : : iswctype ( c , desc ) ;
}
void uninitvar_iswdigit ( void )
{
wint_t i ;
// cppcheck-suppress uninitvar
( void ) std : : iswdigit ( i ) ;
}
void uninitvar_iswgraph ( void )
{
wint_t i ;
// cppcheck-suppress uninitvar
( void ) std : : iswgraph ( i ) ;
}
void uninitvar_iswlower ( void )
{
wint_t i ;
// cppcheck-suppress uninitvar
( void ) std : : iswlower ( i ) ;
}
void uninitvar_iswprint ( void )
{
wint_t i ;
// cppcheck-suppress uninitvar
( void ) std : : iswprint ( i ) ;
}
void uninitvar_ispunct ( void )
{
int i ;
// cppcheck-suppress uninitvar
( void ) std : : ispunct ( i ) ;
}
void uninitvar_iswpunct ( void )
{
wint_t i ;
// cppcheck-suppress uninitvar
( void ) std : : iswpunct ( i ) ;
}
void uninitvar_iswspace ( void )
{
wint_t i ;
// cppcheck-suppress uninitvar
( void ) std : : iswspace ( i ) ;
}
2015-09-01 16:50:36 +02:00
void uninitvar_iswupper ( void )
{
wint_t i ;
// cppcheck-suppress uninitvar
( void ) std : : iswupper ( i ) ;
}
void uninitvar_iswxdigit ( void )
{
wint_t i ;
// cppcheck-suppress uninitvar
( void ) std : : iswxdigit ( i ) ;
}
void uninitvar_towctrans ( void )
{
wint_t c ;
wctrans_t desc ;
// cppcheck-suppress uninitvar
( void ) std : : towctrans ( c , desc ) ;
}
void uninitvar_towlower ( void )
{
wint_t i ;
// cppcheck-suppress uninitvar
( void ) std : : towlower ( i ) ;
}
void uninitvar_towupper ( void )
{
wint_t i ;
// cppcheck-suppress uninitvar
( void ) std : : towupper ( i ) ;
}
void uninitvar_wctrans ( void )
{
2023-08-05 18:48:43 +02:00
const char * property ;
2015-09-01 16:50:36 +02:00
// cppcheck-suppress uninitvar
( void ) std : : wctrans ( property ) ;
}
void uninitvar_wctype ( void )
{
2023-08-05 18:48:43 +02:00
const char * property ;
2015-09-01 16:50:36 +02:00
// cppcheck-suppress uninitvar
( void ) std : : wctype ( property ) ;
}
void uninitvar_labs ( void )
{
long int li ;
// cppcheck-suppress uninitvar
( void ) std : : labs ( li ) ;
long long int lli ;
// cppcheck-suppress uninitvar
( void ) std : : llabs ( lli ) ;
}
void uninitvar_ldexp ( void )
{
float fd ;
int e1 ;
// cppcheck-suppress uninitvar
( void ) std : : ldexp ( fd , e1 ) ;
double dc ;
int e2 ;
// cppcheck-suppress uninitvar
( void ) std : : ldexp ( dc , e2 ) ;
long double ldc ;
int e3 ;
// cppcheck-suppress uninitvar
( void ) std : : ldexp ( ldc , e3 ) ;
}
void uninitvar_lgamma ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : lgammaf ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : lgamma ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : lgammal ( ld ) ;
}
void uninitvar_rint ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : rintf ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : rint ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : rintl ( ld ) ;
}
void uninitvar_lrint ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : lrintf ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : lrint ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : lrintl ( ld ) ;
}
void uninitvar_llrint ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : llrintf ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : llrint ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : llrintl ( ld ) ;
}
void uninitvar_lround ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : lroundf ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : lround ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : lroundl ( ld ) ;
}
void uninitvar_llround ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : llroundf ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : llround ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : llroundl ( ld ) ;
}
void uninitvar_srand ( void )
{
unsigned int seed ;
// cppcheck-suppress uninitvar
( void ) std : : srand ( seed ) ;
}
void uninitvar_ldiv ( void )
{
long int l1 ;
long int l2 ;
// cppcheck-suppress uninitvar
( void ) std : : ldiv ( l1 , l2 ) ;
long long int ll1 ;
long long int ll2 ;
// cppcheck-suppress uninitvar
( void ) std : : lldiv ( ll1 , ll2 ) ;
}
void uninitvar_localtime ( void )
{
2023-08-05 18:48:43 +02:00
const time_t * tp ;
2015-09-01 16:50:36 +02:00
// cppcheck-suppress uninitvar
( void ) std : : localtime ( tp ) ;
}
void uninitvar_log ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : log ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : log ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : log ( ld ) ;
}
void uninitvar_fpclassify ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : fpclassify ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : fpclassify ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : fpclassify ( ld ) ;
}
void uninitvar_isfinite ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : isfinite ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : isfinite ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : isfinite ( ld ) ;
}
void uninitvar_isgreater ( void )
{
float f1 , f2 ;
// cppcheck-suppress uninitvar
( void ) std : : isgreater ( f1 , f2 ) ;
double d1 , d2 ;
// cppcheck-suppress uninitvar
( void ) std : : isgreater ( d1 , d2 ) ;
long double ld1 , ld2 ;
// cppcheck-suppress uninitvar
( void ) std : : isgreater ( ld1 , ld2 ) ;
}
void uninitvar_isgreaterequal ( void )
{
float f1 , f2 ;
// cppcheck-suppress uninitvar
( void ) std : : isgreaterequal ( f1 , f2 ) ;
double d1 , d2 ;
// cppcheck-suppress uninitvar
( void ) std : : isgreaterequal ( d1 , d2 ) ;
long double ld1 , ld2 ;
// cppcheck-suppress uninitvar
( void ) std : : isgreaterequal ( ld1 , ld2 ) ;
}
void uninitvar_isinf ( void )
{
double d ;
// cppcheck-suppress uninitvar
( void ) std : : isinf ( d ) ;
}
void uninitvar_logb ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : logbf ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : logb ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : logbl ( ld ) ;
}
void uninitvar_isless ( void )
{
float f1 , f2 ;
// cppcheck-suppress uninitvar
( void ) std : : isless ( f1 , f2 ) ;
double d1 , d2 ;
// cppcheck-suppress uninitvar
( void ) std : : isless ( d1 , d2 ) ;
long double ld1 , ld2 ;
// cppcheck-suppress uninitvar
( void ) std : : isless ( ld1 , ld2 ) ;
}
void uninitvar_islessequal ( void )
{
float f1 , f2 ;
// cppcheck-suppress uninitvar
( void ) std : : islessequal ( f1 , f2 ) ;
double d1 , d2 ;
// cppcheck-suppress uninitvar
( void ) std : : islessequal ( d1 , d2 ) ;
long double ld1 , ld2 ;
// cppcheck-suppress uninitvar
( void ) std : : islessequal ( ld1 , ld2 ) ;
}
void uninitvar_islessgreater ( void )
{
float f1 , f2 ;
// cppcheck-suppress uninitvar
( void ) std : : islessgreater ( f1 , f2 ) ;
double d1 , d2 ;
// cppcheck-suppress uninitvar
( void ) std : : islessgreater ( d1 , d2 ) ;
long double ld1 , ld2 ;
// cppcheck-suppress uninitvar
( void ) std : : islessgreater ( ld1 , ld2 ) ;
}
void uninitvar_nan ( void )
{
2023-08-05 18:48:43 +02:00
const char * tagp1 , * tagp2 , * tagp3 ;
2015-09-01 16:50:36 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : nanf ( tagp1 ) ;
2015-09-01 16:50:36 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : nan ( tagp2 ) ;
2015-09-01 16:50:36 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : nanl ( tagp3 ) ;
2015-09-01 16:50:36 +02:00
}
void uninitvar_isnan ( void )
{
double d ;
// cppcheck-suppress uninitvar
( void ) std : : isnan ( d ) ;
}
void uninitvar_isnormal ( void )
{
double d ;
// cppcheck-suppress uninitvar
( void ) std : : isnormal ( d ) ;
}
void uninitvar_isunordered ( void )
{
double d1 , d2 ;
// cppcheck-suppress uninitvar
( void ) std : : isunordered ( d1 , d2 ) ;
}
void uninitvar_ilogb ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : ilogb ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : ilogb ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : ilogb ( ld ) ;
}
void uninitvar_log10 ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : log10 ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : log10 ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : log10 ( ld ) ;
}
void uninitvar_log1p ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : log1pf ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : log1p ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : log1pl ( ld ) ;
}
void uninitvar_log2 ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : log2f ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : log2 ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : log2l ( ld ) ;
}
void uninitvar_nearbyint ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : nearbyintf ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : nearbyint ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : nearbyintl ( ld ) ;
}
2015-09-02 17:08:25 +02:00
void uninitvar_nextafter ( void )
{
float f1 , f2 ;
// cppcheck-suppress uninitvar
( void ) std : : nextafterf ( f1 , f2 ) ;
double d1 , d2 ;
// cppcheck-suppress uninitvar
( void ) std : : nextafter ( d1 , d2 ) ;
long double ld1 , ld2 ;
// cppcheck-suppress uninitvar
( void ) std : : nextafterl ( ld1 , ld2 ) ;
}
void uninitvar_nexttoward ( void )
{
float f1 , f2 ;
// cppcheck-suppress uninitvar
( void ) std : : nexttowardf ( f1 , f2 ) ;
double d1 , d2 ;
// cppcheck-suppress uninitvar
( void ) std : : nexttoward ( d1 , d2 ) ;
long double ld1 , ld2 ;
// cppcheck-suppress uninitvar
( void ) std : : nexttowardl ( ld1 , ld2 ) ;
}
void uninitvar_longjmp ( void )
{
jmp_buf env ;
int val ;
// cppcheck-suppress uninitvar
( void ) std : : longjmp ( env , val ) ;
}
void uninitvar_malloc ( void )
{
size_t size ;
2022-02-10 20:48:51 +01:00
// cppcheck-suppress [uninitvar, cstyleCast]
2015-09-02 17:08:25 +02:00
int * p = ( int * ) std : : malloc ( size ) ;
free ( p ) ;
}
void uninitvar_memchr ( void )
{
void * cs ;
int c ;
size_t n ;
// cppcheck-suppress uninitvar
( void ) std : : memchr ( cs , c , n ) ;
}
void uninitvar_wmemchr ( void )
{
wchar_t * cs ;
wchar_t c ;
size_t n ;
// cppcheck-suppress uninitvar
( void ) std : : wmemchr ( cs , c , n ) ;
}
void uninitvar_memcmp ( void )
{
2023-08-05 18:48:43 +02:00
const void * s1 ;
const void * s2 ;
2015-09-02 17:08:25 +02:00
size_t n ;
// cppcheck-suppress uninitvar
( void ) std : : memcmp ( s1 , s2 , n ) ;
}
2015-09-03 16:03:16 +02:00
2015-09-23 22:46:36 +02:00
void uninitvar_wmemcmp ( void )
{
2023-08-05 18:48:43 +02:00
const wchar_t * s1 ;
const wchar_t * s2 ;
2015-09-23 22:46:36 +02:00
size_t n ;
// cppcheck-suppress uninitvar
( void ) std : : wmemcmp ( s1 , s2 , n ) ;
}
2015-09-03 16:03:16 +02:00
void uninitvar_memcpy ( void )
{
void * ct ;
2023-08-05 18:48:43 +02:00
const void * cs ;
2015-09-03 16:03:16 +02:00
size_t n ;
// cppcheck-suppress uninitvar
( void ) std : : memcpy ( ct , cs , n ) ;
}
void uninitvar_wmemcpy ( void )
{
wchar_t * cs ;
2023-08-05 18:48:43 +02:00
const wchar_t * c ;
2015-09-03 16:03:16 +02:00
size_t n ;
// cppcheck-suppress uninitvar
( void ) std : : wmemcpy ( cs , c , n ) ;
}
void uninitvar_memmove ( void )
{
void * ct ;
2023-08-05 18:48:43 +02:00
const void * cs ;
2015-09-03 16:03:16 +02:00
size_t n ;
// cppcheck-suppress uninitvar
( void ) std : : memmove ( ct , cs , n ) ;
}
void uninitvar_wmemmove ( void )
{
wchar_t * cs ;
wchar_t * c ;
size_t n ;
// cppcheck-suppress uninitvar
( void ) std : : wmemmove ( cs , c , n ) ;
}
void uninitvar_memset ( void )
{
void * s ;
int c ;
size_t n ;
// cppcheck-suppress uninitvar
( void ) std : : memset ( s , c , n ) ;
}
void uninitvar_wmemset ( void )
{
wchar_t * cs ;
2021-08-07 20:51:18 +02:00
wchar_t c ;
2015-09-03 16:03:16 +02:00
size_t n ;
// cppcheck-suppress uninitvar
( void ) std : : wmemset ( cs , c , n ) ;
}
void uninitvar_mktime ( void )
{
struct tm * tp ;
// cppcheck-suppress uninitvar
( void ) std : : mktime ( tp ) ;
}
void uninivar_modf ( void )
{
float f1 ;
float * f2 ;
// cppcheck-suppress uninitvar
( void ) std : : modf ( f1 , f2 ) ;
double d1 ;
double * d2 ;
// cppcheck-suppress uninitvar
( void ) std : : modf ( d1 , d2 ) ;
long double ld1 ;
long double * ld2 ;
// cppcheck-suppress uninitvar
( void ) std : : modf ( ld1 , ld2 ) ;
}
void uninivar_perror ( void )
{
2023-08-05 18:48:43 +02:00
const char * string ;
2015-09-03 16:03:16 +02:00
// cppcheck-suppress uninitvar
( void ) std : : perror ( string ) ;
}
2015-09-03 16:34:44 +02:00
void uninitvar_pow ( void )
{
float f1 , f2 ;
// cppcheck-suppress uninitvar
( void ) std : : pow ( f1 , f2 ) ;
double d1 , d2 ;
// cppcheck-suppress uninitvar
( void ) std : : pow ( d1 , d2 ) ;
long double ld1 , ld2 ;
// cppcheck-suppress uninitvar
( void ) std : : pow ( ld1 , ld2 ) ;
}
void uninitvar_remainder ( void )
{
float f1 , f2 ;
// cppcheck-suppress uninitvar
( void ) std : : remainderf ( f1 , f2 ) ;
double d1 , d2 ;
// cppcheck-suppress uninitvar
( void ) std : : remainder ( d1 , d2 ) ;
long double ld1 , ld2 ;
// cppcheck-suppress uninitvar
( void ) std : : remainderl ( ld1 , ld2 ) ;
}
void uninitvar_remquo ( void )
{
float f1 , f2 ;
int * i1 ;
// cppcheck-suppress uninitvar
( void ) std : : remquof ( f1 , f2 , i1 ) ;
double d1 , d2 ;
int * i2 ;
// cppcheck-suppress uninitvar
( void ) std : : remquo ( d1 , d2 , i2 ) ;
long double ld1 , ld2 ;
int * i3 ;
// cppcheck-suppress uninitvar
( void ) std : : remquol ( ld1 , ld2 , i3 ) ;
}
2023-08-05 18:48:43 +02:00
void uninivar_printf ( const char * Format , int Argument )
2015-09-03 16:34:44 +02:00
{
2023-08-05 18:48:43 +02:00
const char * format_1 , * format_2 , * format_3 ;
2019-03-02 19:38:11 +01:00
int argument1 , argument2 ;
2015-09-03 16:34:44 +02:00
// no warning is expected
( void ) std : : printf ( " x " ) ;
// cppcheck-suppress uninitvar
2019-03-04 22:57:40 +01:00
( void ) std : : printf ( format_1 , argument1 ) ;
2015-09-30 12:18:56 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : printf ( Format , argument2 ) ;
2015-09-30 12:18:56 +02:00
// cppcheck-suppress uninitvar
2019-03-04 22:57:40 +01:00
( void ) std : : printf ( format_2 , Argument ) ;
2015-09-03 16:34:44 +02:00
// cppcheck-suppress uninitvar
2019-03-04 22:57:40 +01:00
( void ) std : : printf ( format_3 , 1 ) ;
2015-09-30 12:18:56 +02:00
// no warning is expected
( void ) std : : printf ( Format , Argument ) ;
2015-09-03 16:34:44 +02:00
}
2023-08-05 18:48:43 +02:00
void uninivar_vprintf ( const char * Format , va_list Arg )
2015-09-03 16:34:44 +02:00
{
2023-08-05 18:48:43 +02:00
const char * format1 , * format2 ;
2015-09-03 16:34:44 +02:00
va_list arg ;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : vprintf ( format1 , arg ) ;
2015-09-30 12:18:56 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : vprintf ( format2 , Arg ) ;
2015-09-30 12:18:56 +02:00
// no warning is expected
( void ) std : : vprintf ( Format , Arg ) ;
2015-09-30 12:45:40 +02:00
// cppcheck-suppress va_list_usedBeforeStarted
( void ) std : : vprintf ( Format , arg ) ;
2015-09-03 16:34:44 +02:00
}
2023-08-05 18:48:43 +02:00
void uninivar_vwprintf ( const wchar_t * Format , va_list Arg )
2015-09-03 16:34:44 +02:00
{
2023-08-05 18:48:43 +02:00
const wchar_t * format1 , * format2 ;
2015-09-03 16:34:44 +02:00
va_list arg ;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : vwprintf ( format1 , arg ) ;
2015-09-30 12:18:56 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : vwprintf ( format2 , Arg ) ;
2015-09-30 12:18:56 +02:00
// no warning is expected
( void ) std : : vwprintf ( Format , Arg ) ;
2015-09-30 12:45:40 +02:00
// cppcheck-suppress va_list_usedBeforeStarted
( void ) std : : vwprintf ( Format , arg ) ;
2015-09-03 16:34:44 +02:00
}
2015-09-04 11:26:43 +02:00
void uninivar_bsearch ( void )
{
2023-08-05 18:48:43 +02:00
const void * key ;
const void * base ;
2015-09-04 11:26:43 +02:00
size_t num ;
size_t size ;
2022-02-10 20:48:51 +01:00
// cppcheck-suppress [uninitvar, cstyleCast]
2021-08-07 20:51:18 +02:00
( void ) std : : bsearch ( key , base , num , size , ( int ( * ) ( const void * , const void * ) ) strcmp ) ;
2015-09-04 11:26:43 +02:00
}
2020-07-01 16:14:59 +02:00
void minsize_bsearch ( const void * key , const void * base ,
size_t num , size_t size ,
int ( * compar ) ( const void * , const void * ) )
{
2023-08-05 18:48:43 +02:00
const int Base [ 3 ] = { 42 , 43 , 44 } ;
2020-07-01 16:14:59 +02:00
2022-02-10 20:48:51 +01:00
( void ) std : : bsearch ( key , Base , 2 , size , ( int ( * ) ( const void * , const void * ) ) strcmp ) ; // cppcheck-suppress cstyleCast
( void ) std : : bsearch ( key , Base , 3 , size , ( int ( * ) ( const void * , const void * ) ) strcmp ) ; // cppcheck-suppress cstyleCast
( void ) std : : bsearch ( key , Base , 4 , size , ( int ( * ) ( const void * , const void * ) ) strcmp ) ; // cppcheck-suppress cstyleCast
2020-07-01 16:14:59 +02:00
2022-02-10 20:48:51 +01:00
( void ) std : : bsearch ( key , base , 2 , size , ( int ( * ) ( const void * , const void * ) ) strcmp ) ; // cppcheck-suppress cstyleCast
2020-07-01 16:14:59 +02:00
}
2015-09-04 11:26:43 +02:00
void uninitvar_qsort ( void )
{
void * base ;
size_t n ;
size_t size ;
// cppcheck-suppress uninitvar
2022-02-10 20:48:51 +01:00
( void ) std : : qsort ( base , n , size , ( int ( * ) ( const void * , const void * ) ) strcmp ) ; // cppcheck-suppress cstyleCast
2015-09-04 11:26:43 +02:00
}
2022-09-15 19:56:45 +02:00
void uninitvar_stable_sort ( std : : vector < int > & v )
{
std : : vector < int > : : iterator end ;
// cppcheck-suppress uninitvar
std : : stable_sort ( v . begin ( ) , end ) ;
}
void uninitvar_merge ( const std : : vector < int > & a , const std : : vector < int > & b )
{
std : : vector < int > : : iterator dst ;
// cppcheck-suppress uninitvar
std : : merge ( a . begin ( ) , a . end ( ) , b . begin ( ) , b . end ( ) , dst ) ;
}
2022-09-16 07:12:36 +02:00
void uninitvar_push_heap ( std : : vector < int > & v )
{
std : : vector < int > : : iterator end ;
// cppcheck-suppress uninitvar
std : : push_heap ( v . begin ( ) , end ) ;
}
2022-09-15 19:56:45 +02:00
void uninitvar_copy_n ( const std : : vector < int > & v )
{
std : : vector < int > : : iterator dst ;
// cppcheck-suppress [uninitvar, invalidFunctionArg]
std : : copy_n ( v . begin ( ) , - 1 , dst ) ;
}
2022-09-20 07:30:24 +02:00
void uninitvar_iota ( std : : vector < int > & v )
{
int i ;
// cppcheck-suppress uninitvar
std : : iota ( v . begin ( ) , v . end ( ) , i ) ;
}
2015-09-04 11:26:43 +02:00
void uninitvar_putc ( void )
{
int c ;
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : putc ( c , stream ) ;
}
void uninitvar_putwc ( void )
{
wchar_t c ;
FILE * stream ;
// cppcheck-suppress uninitvar
( void ) std : : putc ( c , stream ) ;
}
void uninitvar_putchar ( void )
{
int c ;
// cppcheck-suppress uninitvar
( void ) std : : putchar ( c ) ;
}
void uninitvar_putwchar ( void )
{
wchar_t c ;
// cppcheck-suppress uninitvar
( void ) std : : putwchar ( c ) ;
}
void uninitvar_puts ( void )
{
2023-08-05 18:48:43 +02:00
const char * s ;
2015-09-04 11:26:43 +02:00
// cppcheck-suppress uninitvar
( void ) std : : puts ( s ) ;
}
void uninitvar_realloc ( void )
{
void * block ;
size_t newsize ;
// cppcheck-suppress uninitvar
void * p = std : : realloc ( block , newsize ) ;
free ( p ) ;
}
void uninitvar_remove ( void )
{
2023-08-05 18:48:43 +02:00
const char * s ;
2015-09-04 11:26:43 +02:00
// cppcheck-suppress uninitvar
( void ) std : : remove ( s ) ;
}
void uninitvar_rename ( void )
{
2023-08-05 18:48:43 +02:00
const char * s1 ;
const char * s2 ;
2015-09-04 11:26:43 +02:00
// cppcheck-suppress uninitvar
( void ) std : : rename ( s1 , s2 ) ;
}
void uninitvar_rewind ( void )
{
FILE * f ;
// cppcheck-suppress uninitvar
( void ) std : : rewind ( f ) ;
}
void uninitvar_round ( void )
{
float f ;
// cppcheck-suppress uninitvar
( void ) std : : roundf ( f ) ;
double d ;
// cppcheck-suppress uninitvar
( void ) std : : round ( d ) ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : roundl ( ld ) ;
}
2015-09-04 11:59:19 +02:00
void uninivar_scalbn ( void )
{
float f ;
int i1 ;
// cppcheck-suppress uninitvar
( void ) std : : scalbnf ( f , i1 ) ;
double d ;
int i2 ;
// cppcheck-suppress uninitvar
( void ) std : : scalbn ( d , i2 ) ;
long double ld ;
int i3 ;
// cppcheck-suppress uninitvar
( void ) std : : scalbnl ( ld , i3 ) ;
}
void uninivar_scalbln ( void )
{
float f ;
long int i1 ;
// cppcheck-suppress uninitvar
( void ) std : : scalblnf ( f , i1 ) ;
double d ;
long int i2 ;
// cppcheck-suppress uninitvar
( void ) std : : scalbln ( d , i2 ) ;
long double ld ;
long int i3 ;
// cppcheck-suppress uninitvar
( void ) std : : scalblnl ( ld , i3 ) ;
}
void uninitvar_signbit ( void )
{
double d ;
// cppcheck-suppress uninitvar
( void ) std : : signbit ( d ) ;
}
void uninivar_signal ( void )
{
int i ;
// cppcheck-suppress uninitvar
std : : signal ( i , exit ) ;
}
void uninivar_raise ( void )
{
int i ;
// cppcheck-suppress uninitvar
( void ) std : : raise ( i ) ;
}
2015-09-04 23:45:31 +02:00
void uninivar_scanf ( void )
{
2023-08-05 18:48:43 +02:00
const char * format ;
2015-09-04 23:45:31 +02:00
char str [ 42 ] ;
// cppcheck-suppress uninitvar
( void ) std : : scanf ( format , str ) ;
}
void uninivar_vsscanf ( void )
{
2023-08-05 18:48:43 +02:00
const char * s ;
const char * format ;
2015-09-04 23:45:31 +02:00
va_list arg ;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
( void ) std : : vsscanf ( s , format , arg ) ;
}
void uninivar_vswscanf ( void )
{
2023-08-05 18:48:43 +02:00
const wchar_t * s ;
const wchar_t * format ;
2015-09-04 23:45:31 +02:00
va_list arg ;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
( void ) std : : vswscanf ( s , format , arg ) ;
}
void uninivar_vscanf ( void )
{
2023-08-05 18:48:43 +02:00
const char * format ;
2015-09-04 23:45:31 +02:00
va_list arg ;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
( void ) std : : vscanf ( format , arg ) ;
}
void uninivar_vwscanf ( void )
{
2023-08-05 18:48:43 +02:00
const wchar_t * format ;
2015-09-04 23:45:31 +02:00
va_list arg ;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
( void ) std : : vwscanf ( format , arg ) ;
}
void uninivar_setbuf ( void )
{
FILE * stream ;
char * buf ;
// cppcheck-suppress uninitvar
( void ) std : : setbuf ( stream , buf ) ;
}
2022-04-27 10:09:23 +02:00
void nullPointer_setbuf ( FILE * stream , char * buf )
{
// cppcheck-suppress nullPointer
std : : setbuf ( NULL , buf ) ;
std : : setbuf ( stream , NULL ) ;
std : : setbuf ( stream , buf ) ;
}
int bufferAccessOutOfBounds_setvbuf ( FILE * stream , int mode , size_t size )
{
char buf [ 42 ] = { 0 } ;
// cppcheck-suppress bufferAccessOutOfBounds
( void ) std : : setvbuf ( stream , buf , mode , 43 ) ;
return std : : setvbuf ( stream , buf , mode , 42 ) ;
}
int nullPointer_setvbuf ( FILE * stream , char * buf , int mode , size_t size )
{
// cppcheck-suppress nullPointer
( void ) std : : setvbuf ( NULL , buf , mode , size ) ;
( void ) std : : setvbuf ( stream , NULL , mode , size ) ;
return std : : setvbuf ( stream , buf , mode , size ) ;
}
2015-09-04 23:45:31 +02:00
void uninivar_setvbuf ( void )
{
FILE * stream ;
char * buf ;
int mode ;
size_t size ;
// cppcheck-suppress uninitvar
( void ) std : : setvbuf ( stream , buf , mode , size ) ;
}
2015-09-07 16:57:34 +02:00
2018-05-27 10:16:02 +02:00
void uninitvar_strcat ( char * dest , const char * const source )
2015-09-07 16:57:34 +02:00
{
2019-03-02 19:38:11 +01:00
char * deststr1 , * deststr2 ;
2023-08-05 18:48:43 +02:00
const char * srcstr1 , * srcstr2 ;
2015-09-07 16:57:34 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : strcat ( deststr1 , srcstr1 ) ;
2018-05-27 10:16:02 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : strcat ( dest , srcstr2 ) ;
2018-05-27 10:16:02 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : strcat ( deststr2 , source ) ;
2018-05-27 10:16:02 +02:00
// no warning shall be shown for
( void ) std : : strcat ( dest , source ) ;
2015-09-07 16:57:34 +02:00
}
2018-05-27 10:16:02 +02:00
void uninitvar_wcscat ( wchar_t * dest , const wchar_t * const source )
2015-09-07 16:57:34 +02:00
{
2019-03-04 22:57:40 +01:00
wchar_t * deststr_1 , * deststr_2 ;
2023-08-05 18:48:43 +02:00
const wchar_t * srcstr1 , * srcstr2 ;
2015-09-07 16:57:34 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wcscat ( deststr_1 , srcstr1 ) ;
2018-05-27 10:16:02 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wcscat ( dest , srcstr2 ) ;
2018-05-27 10:16:02 +02:00
// cppcheck-suppress uninitvar
2019-03-04 22:57:40 +01:00
( void ) std : : wcscat ( deststr_2 , source ) ;
2018-05-27 10:16:02 +02:00
// no warning shall be shown for
( void ) std : : wcscat ( dest , source ) ;
2015-09-07 16:57:34 +02:00
}
2018-05-27 10:16:02 +02:00
2015-09-08 11:45:13 +02:00
void uninivar_wcrtomb ( void )
{
char * s ;
wchar_t wc ;
mbstate_t * ps ;
// cppcheck-suppress uninitvar
( void ) std : : wcrtomb ( s , wc , ps ) ;
}
void uninivar_strchr ( void )
{
2023-08-05 18:48:43 +02:00
const char * cs ;
2015-09-08 11:45:13 +02:00
int c ;
// cppcheck-suppress uninitvar
( void ) std : : strchr ( cs , c ) ;
}
void uninivar_wcschr ( void )
{
2023-08-05 18:48:43 +02:00
const wchar_t * cs ;
2015-09-08 11:45:13 +02:00
wchar_t c ;
// cppcheck-suppress uninitvar
( void ) std : : wcschr ( cs , c ) ;
}
void uninivar_strcmp ( void )
{
2023-08-05 18:48:43 +02:00
const char * str1 ;
const char * str2 ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
( void ) std : : strcmp ( str1 , str2 ) ;
}
void uninivar_wcscmp ( void )
{
2023-08-05 18:48:43 +02:00
const wchar_t * str1 ;
const wchar_t * str2 ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
( void ) std : : wcscmp ( str1 , str2 ) ;
}
void uninivar_strcpy ( void )
{
char * str1 ;
2023-08-05 18:48:43 +02:00
const char * str2 ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
( void ) std : : strcpy ( str1 , str2 ) ;
}
void uninivar_wcscpy ( void )
{
wchar_t * str1 ;
2023-08-05 18:48:43 +02:00
const wchar_t * str2 ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
( void ) std : : wcscpy ( str1 , str2 ) ;
}
void uninivar_strftime ( void )
{
char * s ;
size_t max ;
2023-08-05 18:48:43 +02:00
const char * fmt ;
const struct tm * p ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
( void ) std : : strftime ( s , max , fmt , p ) ;
}
void uninivar_strlen ( void )
{
2023-08-05 18:48:43 +02:00
const char * s ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
( void ) std : : strlen ( s ) ;
}
void uninivar_wcslen ( void )
{
2023-08-05 18:48:43 +02:00
const wchar_t * s ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
( void ) std : : wcslen ( s ) ;
}
void uninivar_strncpy ( void )
{
char * s ;
2023-08-05 18:48:43 +02:00
const char * ct ;
2015-09-08 11:45:13 +02:00
size_t n ;
// cppcheck-suppress uninitvar
( void ) std : : strncpy ( s , ct , n ) ;
}
void uninivar_strpbrk ( void )
{
2023-08-05 18:48:43 +02:00
const char * cs ;
const char * ct ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
( void ) std : : strpbrk ( cs , ct ) ;
}
2023-08-05 18:48:43 +02:00
void uninivar_strncat ( char * Ct , const char * S , size_t N )
2015-09-08 11:45:13 +02:00
{
2019-03-04 22:57:40 +01:00
char * ct_1 , * ct_2 ;
2023-08-05 18:48:43 +02:00
const char * s1 , * s2 ;
2019-03-02 19:38:11 +01:00
size_t n1 , n2 ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : strncat ( ct_1 , s1 , n1 ) ;
2015-09-30 13:10:31 +02:00
// cppcheck-suppress uninitvar
2019-03-04 22:57:40 +01:00
( void ) std : : strncat ( ct_2 , S , N ) ;
2015-09-30 13:10:31 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : strncat ( Ct , s2 , N ) ;
2015-09-30 13:10:31 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : strncat ( Ct , S , n2 ) ;
2015-09-30 13:10:31 +02:00
// no warning is expected for
( void ) std : : strncat ( Ct , S , N ) ;
2015-09-08 11:45:13 +02:00
}
2023-08-05 18:48:43 +02:00
void uninivar_wcsncat ( wchar_t * Ct , const wchar_t * S , size_t N )
2015-09-08 11:45:13 +02:00
{
2019-03-04 22:57:40 +01:00
wchar_t * ct_1 , * ct_2 ;
2023-08-05 18:48:43 +02:00
const wchar_t * s1 , * s2 ;
2019-03-02 19:38:11 +01:00
size_t n1 , n2 ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wcsncat ( ct_1 , s1 , n1 ) ;
2015-09-30 13:10:31 +02:00
// cppcheck-suppress uninitvar
2019-03-04 22:57:40 +01:00
( void ) std : : wcsncat ( ct_2 , S , N ) ;
2015-09-30 13:10:31 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wcsncat ( Ct , s2 , N ) ;
2015-09-30 13:10:31 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : wcsncat ( Ct , S , n2 ) ;
2015-09-30 13:10:31 +02:00
// no warning is expected for
( void ) std : : wcsncat ( Ct , S , N ) ;
2015-09-08 11:45:13 +02:00
}
2023-08-05 18:48:43 +02:00
void uninivar_strncmp ( const char * Ct , const char * S , size_t N )
2015-09-08 11:45:13 +02:00
{
2023-08-05 18:48:43 +02:00
const char * ct1 , * ct2 ;
const char * s1 , * s2 ;
2019-03-02 19:38:11 +01:00
size_t n1 , n2 ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : strncmp ( ct1 , s1 , n1 ) ;
2015-09-30 13:10:31 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : strncmp ( ct2 , S , N ) ;
2015-09-30 13:10:31 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : strncmp ( Ct , s2 , N ) ;
2015-09-30 13:10:31 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : strncmp ( Ct , S , n2 ) ;
2015-09-30 13:10:31 +02:00
// no warning is expected for
( void ) std : : strncmp ( Ct , S , N ) ;
2015-09-08 11:45:13 +02:00
}
2023-08-05 18:48:43 +02:00
void uninivar_wcsncmp ( const wchar_t * Ct , const wchar_t * S , size_t N )
2015-09-08 11:45:13 +02:00
{
2023-08-05 18:48:43 +02:00
const wchar_t * ct1 , * ct2 ;
const wchar_t * s1 , * s2 ;
2019-03-02 19:38:11 +01:00
size_t n1 , n2 ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wcsncmp ( ct1 , s1 , n1 ) ;
2015-09-30 13:10:31 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wcsncmp ( ct2 , S , N ) ;
2015-09-30 13:10:31 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wcsncmp ( Ct , s2 , N ) ;
2015-09-30 13:10:31 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : wcsncmp ( Ct , S , n2 ) ;
2015-09-30 13:10:31 +02:00
// no warning is expected for
( void ) std : : wcsncmp ( Ct , S , N ) ;
2015-09-08 11:45:13 +02:00
}
void uninivar_strstr ( void )
{
char * cs ;
2023-08-05 18:48:43 +02:00
const char * ct ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
( void ) std : : strstr ( cs , ct ) ;
}
void uninivar_wcsstr ( void )
{
wchar_t * cs ;
2023-08-05 18:48:43 +02:00
const wchar_t * ct ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
( void ) std : : wcsstr ( cs , ct ) ;
}
void uninivar_strspn ( void )
{
2023-08-05 18:48:43 +02:00
const char * cs ;
const char * ct ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
( void ) std : : strspn ( cs , ct ) ;
}
void uninivar_strxfrm ( void )
{
char * ds ;
2023-08-05 18:48:43 +02:00
const char * ss ;
2015-09-08 11:45:13 +02:00
size_t n ;
// cppcheck-suppress uninitvar
( void ) std : : strxfrm ( ds , ss , n ) ;
}
void uninivar_wcsxfrm ( void )
{
wchar_t * ds ;
2023-08-05 18:48:43 +02:00
const wchar_t * ss ;
2015-09-08 11:45:13 +02:00
size_t n ;
// cppcheck-suppress uninitvar
( void ) std : : wcsxfrm ( ds , ss , n ) ;
}
void uninivar_wcsspn ( void )
{
2023-08-05 18:48:43 +02:00
const wchar_t * ds ;
const wchar_t * ss ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
( void ) std : : wcsspn ( ds , ss ) ;
}
void uninivar_setlocale ( void )
{
int category ;
2023-08-05 18:48:43 +02:00
const char * locale ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
( void ) std : : setlocale ( category , locale ) ;
}
void uninivar_strerror ( void )
{
int i ;
// cppcheck-suppress uninitvar
( void ) std : : strerror ( i ) ;
}
void uninivar_strcspn ( void )
{
2023-08-05 18:48:43 +02:00
const char * cs ;
const char * ct ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
( void ) std : : strcspn ( cs , ct ) ;
}
void uninivar_wcscspn ( void )
{
2023-08-05 18:48:43 +02:00
const wchar_t * cs ;
const wchar_t * ct ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
( void ) std : : wcscspn ( cs , ct ) ;
}
void uninivar_wcspbrk ( void )
{
2023-08-05 18:48:43 +02:00
const wchar_t * cs ;
const wchar_t * ct ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
( void ) std : : wcspbrk ( cs , ct ) ;
}
void uninivar_wcsncpy ( void )
{
wchar_t * cs ;
2023-08-05 18:48:43 +02:00
const wchar_t * ct ;
2015-09-08 11:45:13 +02:00
size_t n ;
// cppcheck-suppress uninitvar
( void ) std : : wcsncpy ( cs , ct , n ) ;
}
void uninivar_strcoll ( void )
{
2023-08-05 18:48:43 +02:00
const char * cs ;
const char * ct ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
( void ) std : : strcoll ( cs , ct ) ;
}
void uninivar_wcscoll ( void )
{
2023-08-05 18:48:43 +02:00
const wchar_t * cs ;
const wchar_t * ct ;
2015-09-08 11:45:13 +02:00
// cppcheck-suppress uninitvar
( void ) std : : wcscoll ( cs , ct ) ;
}
void uninivar_strrchr ( void )
{
2023-08-05 18:48:43 +02:00
const char * str ;
2015-09-08 11:45:13 +02:00
int c ;
// cppcheck-suppress uninitvar
( void ) std : : strrchr ( str , c ) ;
}
void uninivar_wcsrchr ( void )
{
wchar_t * ws ;
wchar_t wc ;
// cppcheck-suppress uninitvar
( void ) std : : wcsrchr ( ws , wc ) ;
}
2015-09-08 15:43:22 +02:00
void uninivar_wcsrtombs ( void )
{
char * dst ;
const wchar_t * p ; ;
size_t len ;
mbstate_t * ps ;
// cppcheck-suppress uninitvar
( void ) std : : wcsrtombs ( dst , & p , len , ps ) ;
}
void uninivar_strtok ( void )
{
char * s ;
2023-08-05 18:48:43 +02:00
const char * ct ;
2015-09-08 15:43:22 +02:00
// cppcheck-suppress uninitvar
( void ) std : : strtok ( s , ct ) ;
}
void uninivar_strtoimax ( void )
{
2021-10-03 20:32:39 +02:00
const char * s1 , * s2 ;
char * * endp1 , * * endp2 ;
int base1 , base2 ;
2015-09-08 15:43:22 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : strtoimax ( s1 , endp1 , base1 ) ;
2015-09-08 15:43:22 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : strtoumax ( s2 , endp2 , base2 ) ;
2015-09-08 15:43:22 +02:00
}
void uninivar_strtof ( void )
{
2021-10-03 20:32:39 +02:00
const char * s1 , * s2 , * s3 ;
char * * endp1 , * * endp2 , * * endp3 ;
2015-09-08 15:43:22 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : strtof ( s1 , endp1 ) ;
2015-09-08 15:43:22 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : strtod ( s2 , endp2 ) ;
2015-09-08 15:43:22 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : strtold ( s3 , endp3 ) ;
2015-09-08 15:43:22 +02:00
}
void uninivar_strtol ( void )
{
2021-10-03 20:32:39 +02:00
const char * s1 , * s2 , * s3 , * s4 , * s5 , * s6 , * s7 , * s8 ;
char * * endp1 , * * endp2 , * * endp3 , * * endp4 , * * endp5 , * * endp6 , * * endp7 , * * endp8 ;
int base1 , base2 , base3 , base4 , base5 , base6 , base7 , base8 ;
2015-09-08 15:43:22 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : strtol ( s1 , endp1 , base1 ) ;
2015-09-08 15:43:22 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : strtoll ( s2 , endp2 , base2 ) ;
2015-09-08 15:43:22 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : strtoul ( s3 , endp3 , base3 ) ;
2015-09-08 15:43:22 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : strtoull ( s4 , endp4 , base4 ) ;
2015-09-18 23:57:20 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : strtoimax ( s5 , endp5 , base5 ) ;
2015-09-18 23:57:20 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) strtoimax ( s6 , endp6 , base6 ) ;
2015-09-18 23:57:20 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : strtoumax ( s7 , endp7 , base7 ) ;
2015-09-18 23:57:20 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) strtoumax ( s8 , endp8 , base8 ) ;
2015-09-08 15:43:22 +02:00
}
void uninitvar_time ( void )
{
time_t * tp ;
// cppcheck-suppress uninitvar
( void ) std : : time ( tp ) ;
}
2015-09-08 16:08:43 +02:00
void uninitvar_tmpnam ( void )
{
char * s ;
// cppcheck-suppress uninitvar
( void ) std : : tmpnam ( s ) ;
}
void uninivar_tolower ( void )
{
int c ;
// cppcheck-suppress uninitvar
( void ) std : : tolower ( c ) ;
}
void uninivar_toupper ( void )
{
int c ;
// cppcheck-suppress uninitvar
( void ) std : : toupper ( c ) ;
}
void uninivar_wcstof ( void )
{
2021-10-03 20:32:39 +02:00
const wchar_t * s1 , * s2 , * s3 ;
wchar_t * * endp1 , * * endp2 , * * endp3 ;
2015-09-08 16:08:43 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wcstof ( s1 , endp1 ) ;
2015-09-08 16:08:43 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wcstod ( s2 , endp2 ) ;
2015-09-08 16:08:43 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wcstold ( s3 , endp3 ) ;
2015-09-08 16:08:43 +02:00
}
2015-09-09 16:32:52 +02:00
2015-09-18 23:02:51 +02:00
void uninivar_stoX ( void )
2015-09-18 16:25:05 +02:00
{
std : : string str ;
std : : wstring wstr ;
2019-03-02 19:38:11 +01:00
size_t * idx1 ;
size_t * idx2 ;
size_t * idx3 ;
size_t * idx4 ;
size_t * idx5 ;
size_t * idx6 ;
size_t * idx7 ;
size_t * idx8 ;
size_t * idx9 ;
size_t * idx10 ;
size_t * idx11 ;
size_t * idx12 ;
size_t * idx13 ;
size_t * idx14 ;
size_t * idx15 ;
size_t * idx16 ;
2015-09-18 16:25:05 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : stod ( str , idx1 ) ;
2015-09-18 16:25:05 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : stod ( wstr , idx2 ) ;
2015-09-18 23:02:51 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : stof ( str , idx3 ) ;
2015-09-18 23:02:51 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : stof ( wstr , idx4 ) ;
2015-09-18 23:02:51 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : stoi ( str , idx5 ) ;
2015-09-18 23:02:51 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : stoi ( wstr , idx6 ) ;
2015-09-18 23:02:51 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : stol ( str , idx7 ) ;
2015-09-18 23:02:51 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : stol ( wstr , idx8 ) ;
2015-09-18 23:02:51 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : stold ( str , idx9 ) ;
2015-09-18 23:02:51 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : stold ( wstr , idx10 ) ;
2015-09-18 23:02:51 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : stoll ( str , idx11 ) ;
2015-09-18 23:02:51 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : stoll ( wstr , idx12 ) ;
2015-09-18 23:02:51 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : stoul ( str , idx13 ) ;
2015-09-18 23:02:51 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : stoul ( wstr , idx14 ) ;
2015-09-18 23:02:51 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : stoull ( str , idx15 ) ;
2015-09-18 23:02:51 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : stoull ( wstr , idx16 ) ;
2015-09-18 23:02:51 +02:00
}
void uninivar_to_string ( void )
{
int i ;
long l ;
long long ll ;
unsigned u ;
unsigned long ul ;
unsigned long long ull ;
float f ;
double d ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : to_string ( i ) ;
// cppcheck-suppress uninitvar
( void ) std : : to_string ( l ) ;
// cppcheck-suppress uninitvar
( void ) std : : to_string ( ll ) ;
// cppcheck-suppress uninitvar
( void ) std : : to_string ( u ) ;
// cppcheck-suppress uninitvar
( void ) std : : to_string ( ul ) ;
// cppcheck-suppress uninitvar
( void ) std : : to_string ( ull ) ;
// cppcheck-suppress uninitvar
( void ) std : : to_string ( f ) ;
// cppcheck-suppress uninitvar
( void ) std : : to_string ( d ) ;
// cppcheck-suppress uninitvar
( void ) std : : to_string ( ld ) ;
}
void uninivar_to_wstring ( void )
{
int i ;
long l ;
long long ll ;
unsigned u ;
unsigned long ul ;
unsigned long long ull ;
float f ;
double d ;
long double ld ;
// cppcheck-suppress uninitvar
( void ) std : : to_wstring ( i ) ;
// cppcheck-suppress uninitvar
( void ) std : : to_wstring ( l ) ;
// cppcheck-suppress uninitvar
( void ) std : : to_wstring ( ll ) ;
// cppcheck-suppress uninitvar
( void ) std : : to_wstring ( u ) ;
// cppcheck-suppress uninitvar
( void ) std : : to_wstring ( ul ) ;
// cppcheck-suppress uninitvar
( void ) std : : to_wstring ( ull ) ;
// cppcheck-suppress uninitvar
( void ) std : : to_wstring ( f ) ;
// cppcheck-suppress uninitvar
( void ) std : : to_wstring ( d ) ;
// cppcheck-suppress uninitvar
( void ) std : : to_wstring ( ld ) ;
2015-09-18 16:25:05 +02:00
}
2015-09-09 16:32:52 +02:00
void uninivar_mbrtowc ( void )
{
wchar_t * pwc ;
const char * pmb ;
size_t max ;
mbstate_t * ps ;
// cppcheck-suppress uninitvar
( void ) std : : mbrtowc ( pwc , pmb , max , ps ) ;
}
void uninivar_wcstok ( void )
{
wchar_t * s ;
const wchar_t * ct ;
wchar_t * * ptr ;
// cppcheck-suppress uninitvar
( void ) std : : wcstok ( s , ct , ptr ) ;
}
void uninivar_wcstoimax ( void )
{
2021-10-03 20:32:39 +02:00
const wchar_t * s1 , * s2 ;
wchar_t * * endp1 , * * endp2 ;
int base1 , base2 ;
2015-09-09 16:32:52 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wcstoimax ( s1 , endp1 , base1 ) ;
2015-09-09 16:32:52 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wcstoumax ( s2 , endp2 , base2 ) ;
2015-09-09 16:32:52 +02:00
}
void uninivar_wcstol ( void )
{
2021-10-03 20:32:39 +02:00
const wchar_t * s1 , * s2 , * s3 , * s4 , * s5 , * s6 , * s7 , * s8 ;
wchar_t * * endp1 , * * endp2 , * * endp3 , * * endp4 , * * endp5 , * * endp6 , * * endp7 , * * endp8 ;
int base1 , base2 , base3 , base4 , base5 , base6 , base7 , base8 ;
2015-09-09 16:32:52 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wcstol ( s1 , endp1 , base1 ) ;
2015-09-09 16:32:52 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wcstoll ( s2 , endp2 , base2 ) ;
2015-09-09 16:32:52 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wcstoul ( s3 , endp3 , base3 ) ;
2015-09-09 16:32:52 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wcstoull ( s4 , endp4 , base4 ) ;
2015-09-18 23:57:20 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wcstoimax ( s5 , endp5 , base5 ) ;
2015-09-18 23:57:20 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) wcstoimax ( s6 , endp6 , base6 ) ;
2015-09-18 23:57:20 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wcstoumax ( s7 , endp7 , base7 ) ;
2015-09-18 23:57:20 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) wcstoumax ( s8 , endp8 , base8 ) ;
2015-09-09 16:32:52 +02:00
}
2023-08-05 18:48:43 +02:00
void uninitvar_wprintf ( const wchar_t * Format , int Argument )
2015-09-09 16:32:52 +02:00
{
2021-10-03 20:32:39 +02:00
const wchar_t * format1 , * format2 , * format3 ;
2019-03-02 19:38:11 +01:00
int argument1 , argument2 ;
2015-09-09 16:32:52 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wprintf ( format1 , argument1 ) ;
2015-09-09 16:32:52 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wprintf ( format2 ) ;
2015-09-09 16:32:52 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : wprintf ( Format , argument2 ) ;
2015-09-09 16:32:52 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wprintf ( format3 , Argument ) ;
2015-09-09 16:32:52 +02:00
// no warning is expected
2015-09-30 12:18:56 +02:00
( void ) std : : wprintf ( Format , Argument ) ;
( void ) std : : wprintf ( Format ) ;
2015-09-09 16:32:52 +02:00
}
void uninitvar_sprintf ( void )
{
char * s ;
const char * format ;
int i ;
// cppcheck-suppress uninitvar
( void ) std : : sprintf ( s , format , i ) ;
}
void uninitvar_swprintf ( void )
{
wchar_t * s ;
size_t n ;
const wchar_t * format ;
// cppcheck-suppress uninitvar
( void ) std : : swprintf ( s , n , format ) ;
}
void uninitvar_vsprintf ( void )
{
char * s ;
const char * format ;
va_list arg ;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
( void ) std : : vsprintf ( s , format , arg ) ;
}
2019-11-11 09:29:16 +01:00
void nullPointer_vsprintf ( va_list arg , const char * format )
{
char * s = NULL ;
( void ) std : : vsprintf ( s , format , arg ) ; // Its allowed to provide 's' as NULL pointer
// cppcheck-suppress nullPointer
( void ) std : : vsprintf ( s , NULL , arg ) ;
}
2015-09-09 16:32:52 +02:00
void uninitvar_vswprintf ( void )
{
wchar_t * s ;
size_t n ;
const wchar_t * format ;
va_list arg ;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
( void ) std : : vswprintf ( s , n , format , arg ) ;
}
void uninivar_fwprintf ( void )
{
FILE * stream ;
const wchar_t * format ;
int i ;
// cppcheck-suppress uninitvar
( void ) std : : fwprintf ( stream , format , i ) ;
}
2023-08-05 18:48:43 +02:00
void uninivar_snprintf ( char * S , size_t N , const char * Format , int Int )
2015-09-09 16:32:52 +02:00
{
2019-03-02 19:38:11 +01:00
size_t n1 , n2 ;
2023-08-05 18:48:43 +02:00
const char * format1 , * format2 ;
2019-03-02 19:38:11 +01:00
int i1 , i2 ;
char * s1 , * s2 ;
2015-09-09 16:32:52 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : snprintf ( s1 , n1 , format1 , i1 ) ;
2015-09-29 21:33:39 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : snprintf ( S , n2 , Format , Int ) ; // n is uninitialized
2015-09-29 21:33:39 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : snprintf ( S , N , format2 , Int ) ; // format is uninitialized
2015-09-29 21:33:39 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : snprintf ( S , N , Format , i2 ) ; // i is uninitialized
2018-12-23 18:09:55 +01:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : snprintf ( s2 , N , Format , Int ) ;
2015-09-30 12:18:56 +02:00
// no warning is expected for
( void ) std : : snprintf ( S , N , Format , Int ) ;
2015-09-09 16:32:52 +02:00
}
2023-08-05 18:48:43 +02:00
void uninivar_vsnprintf ( char * S , size_t N , const char * Format , va_list Arg )
2015-09-09 16:32:52 +02:00
{
2019-03-02 19:38:11 +01:00
char * s1 , * s2 ;
size_t n1 , n2 ;
2023-08-05 18:48:43 +02:00
const char * format1 , * format2 ;
2015-09-09 16:32:52 +02:00
va_list arg ;
// cppcheck-suppress va_list_usedBeforeStarted
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : vsnprintf ( s1 , n1 , format1 , arg ) ;
2015-09-30 12:45:40 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : vsnprintf ( s2 , N , Format , Arg ) ;
2015-09-30 12:45:40 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : vsnprintf ( S , n2 , Format , Arg ) ;
2015-09-30 12:45:40 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : vsnprintf ( S , N , format2 , Arg ) ;
2015-09-30 12:45:40 +02:00
// no warning is expected for
( void ) std : : vsnprintf ( S , N , Format , Arg ) ;
// cppcheck-suppress va_list_usedBeforeStarted
( void ) std : : vsnprintf ( S , N , Format , arg ) ;
2015-09-09 16:32:52 +02:00
}
void uninivar_wscanf ( void )
{
2023-08-05 18:48:43 +02:00
const wchar_t * format1 , * format2 ;
2015-09-09 16:32:52 +02:00
int i ;
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wscanf ( format1 ) ;
2015-09-09 16:32:52 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : wscanf ( format2 , & i ) ;
2015-09-09 16:32:52 +02:00
}
void uninivar_sscanf ( void )
{
2023-08-05 18:48:43 +02:00
const char * string1 , * string2 ;
2015-09-09 16:32:52 +02:00
const char * format ;
int i ;
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : sscanf ( string1 , format ) ;
2015-09-09 16:32:52 +02:00
// cppcheck-suppress uninitvar
2021-10-03 20:32:39 +02:00
( void ) std : : sscanf ( string2 , format , & i ) ;
2015-09-09 16:32:52 +02:00
}
void uninivar_fwscanf ( void )
{
FILE * stream ;
2023-08-05 18:48:43 +02:00
const wchar_t * format1 , * format2 ;
2015-09-09 16:32:52 +02:00
int i ;
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : fwscanf ( stream , format1 ) ;
2015-09-09 16:32:52 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : fwscanf ( stream , format2 , & i ) ;
2015-09-09 16:32:52 +02:00
}
void uninivar_swscanf ( void )
{
2023-08-05 18:48:43 +02:00
const wchar_t * s ;
const wchar_t * format1 , * format2 ;
2015-09-09 16:32:52 +02:00
int i ;
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : swscanf ( s , format1 ) ;
2015-09-09 16:32:52 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) std : : swscanf ( s , format2 , & i ) ;
2015-09-09 16:32:52 +02:00
}
void uninitvar_system ( void )
{
2023-08-05 18:48:43 +02:00
const char * c ;
2015-09-09 16:32:52 +02:00
// cppcheck-suppress uninitvar
( void ) std : : system ( c ) ;
}
2022-05-10 23:09:10 +02:00
# ifndef __STDC_NO_THREADS__
2023-08-05 18:48:43 +02:00
void nullPointer_mtx_destroy ( mtx_t * mutex )
2022-05-10 19:21:07 +02:00
{
// cppcheck-suppress nullPointer
mtx_destroy ( nullptr ) ;
mtx_destroy ( mutex ) ;
}
void nullPointer_mtx_lock ( mtx_t * mutex )
{
// cppcheck-suppress nullPointer
mtx_lock ( nullptr ) ;
mtx_lock ( mutex ) ;
}
void nullPointer_mtx_trylock ( mtx_t * mutex )
{
// cppcheck-suppress nullPointer
mtx_trylock ( nullptr ) ;
mtx_trylock ( mutex ) ;
}
int nullPointer_mtx_timedlock ( mtx_t * mutex , const struct timespec * time_point )
{
// cppcheck-suppress nullPointer
( void ) mtx_timedlock ( nullptr , time_point ) ;
// cppcheck-suppress nullPointer
( void ) mtx_timedlock ( mutex , nullptr ) ;
return mtx_timedlock ( mutex , time_point ) ;
}
2022-05-10 23:09:10 +02:00
# endif
2022-05-10 19:21:07 +02:00
2023-08-05 18:48:43 +02:00
void nullPointer_system ( const char * c )
2022-05-10 13:53:16 +02:00
{
// If a null pointer is given, command processor is checked for existence
( void ) std : : system ( NULL ) ;
( void ) std : : system ( c ) ;
}
2015-09-09 16:32:52 +02:00
void uninitvar_setw ( void )
{
int i ;
// cppcheck-suppress uninitvar
std : : cout < < std : : setw ( i ) ;
}
void uninitvar_setiosflags ( void )
{
std : : ios_base : : fmtflags mask ;
2018-01-10 15:52:06 +01:00
// TODO cppcheck-suppress uninitvar
2015-09-09 16:32:52 +02:00
std : : cout < < std : : setiosflags ( mask ) ; // #6987 - false negative
}
2015-09-09 16:59:26 +02:00
void uninitvar_resetiosflags ( void )
{
std : : ios_base : : fmtflags mask ;
2018-01-10 15:52:06 +01:00
// TODO cppcheck-suppress uninitvar
2015-09-09 16:59:26 +02:00
std : : cout < < std : : resetiosflags ( mask ) ; // #6987 - false negative
}
void uninitvar_setfill ( void )
{
char c ;
// cppcheck-suppress uninitvar
std : : cout < < std : : setfill ( c ) ;
wchar_t wc ;
// cppcheck-suppress uninitvar
std : : wcout < < std : : setfill ( wc ) ;
}
void uninitvar_setprecision ( void )
{
int p ;
// cppcheck-suppress uninitvar
std : : cout < < std : : setprecision ( p ) ;
}
void uninitvar_setbase ( void )
{
int p ;
// cppcheck-suppress uninitvar
std : : cout < < std : : setbase ( p ) ;
}
2022-01-18 20:17:05 +01:00
// cppcheck-suppress passedByValue
2015-09-21 23:01:51 +02:00
void uninitvar_find ( std : : string s )
2015-09-10 17:03:50 +02:00
{
// testing of size_t find (const string& str, size_t pos = 0)
2019-03-02 19:38:11 +01:00
size_t pos1 , pos2 , pos3 , pos4 , pos5 , pos6 , pos7 ;
2015-09-10 17:03:50 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) s . find ( " find " , pos1 ) ; // #6991
2015-09-10 17:03:50 +02:00
// testing of size_t find (const char* s, size_t pos = 0) const;
2019-03-02 19:38:11 +01:00
char * pc , * pc2 ;
2015-09-21 23:01:51 +02:00
// cppcheck-suppress uninitvar
( void ) s . find ( pc , 0 ) ;
2015-09-10 17:03:50 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) s . find ( pc , pos2 ) ;
2016-08-25 19:17:07 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) s . find ( " test " , pos3 ) ;
2015-09-21 23:01:51 +02:00
// testing of size_t find (char c, size_t pos = 0) const;
char c ;
2015-09-10 17:03:50 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) s . find ( c , pos4 ) ;
2016-08-25 19:17:07 +02:00
// testing of size_t find (const char* pc, size_t pos, size_t n) const;
2019-03-02 19:38:11 +01:00
size_t n1 , n2 , n3 ;
2016-08-25 19:17:07 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) s . find ( pc , pos5 , n1 ) ; // #6991
2016-08-25 19:17:07 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) s . find ( " test " , pos6 , n2 ) ;
2016-08-25 19:17:07 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) s . find ( " test " , 1 , n3 ) ;
2016-08-25 19:17:07 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) s . find ( " test " , pos7 , 1 ) ;
2016-08-25 19:17:07 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
( void ) s . find ( pc2 , 1 , 1 ) ;
2016-08-25 19:17:07 +02:00
}
void uninivar_ifstream_read ( std : : ifstream & f )
{
int size ;
char buffer [ 10 ] ;
// cppcheck-suppress uninitvar
f . read ( buffer , size ) ;
}
void uninivar_istream_read ( std : : istream & f )
{
int size ;
char buffer [ 10 ] ;
// cppcheck-suppress uninitvar
f . read ( buffer , size ) ;
2015-09-10 17:03:50 +02:00
}
2018-04-10 21:07:39 +02:00
void uninitvar_string_compare ( std : : string & teststr , std : : wstring & testwstr )
{
2023-08-05 18:48:43 +02:00
const char * pStrUninit ;
2018-04-10 21:07:39 +02:00
// cppcheck-suppress uninitvar
( void ) teststr . compare ( pStrUninit ) ;
2023-08-05 18:48:43 +02:00
const wchar_t * pWStrUninit ;
2018-04-10 21:07:39 +02:00
// cppcheck-suppress uninitvar
( void ) testwstr . compare ( pWStrUninit ) ;
}
2015-09-10 16:45:14 +02:00
void invalidFunctionArgBool_abs ( bool b , double x , double y )
{
// cppcheck-suppress invalidFunctionArgBool
( void ) std : : abs ( true ) ; // #6990
// cppcheck-suppress invalidFunctionArgBool
( void ) std : : abs ( b ) ; // #6990
// cppcheck-suppress invalidFunctionArgBool
( void ) std : : abs ( x < y ) ; // #5635
}
void ignoredReturnValue_abs ( int i )
{
// cppcheck-suppress ignoredReturnValue
std : : abs ( i ) ;
2016-10-18 22:35:54 +02:00
// cppcheck-suppress ignoredReturnValue
2015-09-10 16:45:14 +02:00
std : : abs ( - 199 ) ;
}
2015-09-11 16:29:39 +02:00
2022-01-18 20:17:05 +01:00
// cppcheck-suppress passedByValue
2018-04-10 21:07:39 +02:00
void ignoredReturnValue_string_compare ( std : : string teststr , std : : wstring testwstr )
{
// cppcheck-suppress ignoredReturnValue
teststr . compare ( " test " ) ;
// cppcheck-suppress ignoredReturnValue
testwstr . compare ( L " wtest " ) ;
}
2023-04-07 20:14:53 +02:00
// cppcheck-suppress constParameterReference
2023-02-06 22:03:23 +01:00
void ignoredReturnValue_container_access ( std : : string & s , std : : string_view & sv , std : : vector < int > & v )
{
2023-02-25 10:23:45 +01:00
// cppcheck-suppress ignoredReturnValue
s . begin ( ) ;
// cppcheck-suppress ignoredReturnValue
v . end ( ) ;
// cppcheck-suppress ignoredReturnValue
sv . front ( ) ;
// cppcheck-suppress ignoredReturnValue
s . at ( 0 ) ;
2023-02-06 22:03:23 +01:00
}
2018-05-30 16:04:40 +02:00
void ignoredReturnValue_locale_global ( const std : : locale & loc )
{
// no ignoredReturnValue shall be shown for
std : : locale : : global ( loc ) ;
}
2018-04-11 19:16:55 +02:00
void ignoredReturnValue_make_pair ( )
{
// cppcheck-suppress ignoredReturnValue
std : : make_pair ( 1 , 2 ) ;
}
2016-08-25 19:17:07 +02:00
void nullPointer_ifstream_read ( std : : ifstream & f )
{
2018-03-19 11:02:58 +01:00
// cppcheck-suppress nullPointer
2016-08-25 19:17:07 +02:00
f . read ( NULL , 10 ) ;
}
void nullPointer_istream_read ( std : : istream & f )
{
2018-03-19 11:02:58 +01:00
// cppcheck-suppress nullPointer
2016-08-25 19:17:07 +02:00
f . read ( NULL , 10 ) ;
}
2015-09-11 16:29:39 +02:00
void nullPointer_asctime ( void )
{
2023-08-05 18:48:43 +02:00
const struct tm * tm = 0 ;
2015-11-22 17:52:47 +01:00
// cppcheck-suppress asctimeCalled
2015-09-11 16:29:39 +02:00
// cppcheck-suppress nullPointer
( void ) std : : asctime ( tm ) ;
2015-11-22 17:52:47 +01:00
// cppcheck-suppress asctimeCalled
2015-09-11 16:29:39 +02:00
// cppcheck-suppress nullPointer
( void ) std : : asctime ( 0 ) ;
}
2022-04-22 08:29:20 +02:00
void nullPointer_wcsftime ( wchar_t * ptr , size_t maxsize , const wchar_t * format , const struct tm * timeptr )
2015-09-11 16:29:39 +02:00
{
// cppcheck-suppress nullPointer
2022-04-22 08:29:20 +02:00
( void ) std : : wcsftime ( NULL , maxsize , format , timeptr ) ;
2015-09-11 16:29:39 +02:00
// cppcheck-suppress nullPointer
2022-04-22 08:29:20 +02:00
( void ) std : : wcsftime ( ptr , maxsize , NULL , timeptr ) ;
// cppcheck-suppress nullPointer
( void ) std : : wcsftime ( ptr , maxsize , format , NULL ) ;
( void ) std : : wcsftime ( ptr , maxsize , format , timeptr ) ;
2015-09-11 16:29:39 +02:00
}
void nullPointer_fegetenv ( void )
{
fenv_t * envp = 0 ;
// cppcheck-suppress nullPointer
( void ) std : : fegetenv ( envp ) ;
// cppcheck-suppress nullPointer
( void ) std : : fegetenv ( 0 ) ;
}
2020-12-05 08:00:31 +01:00
void nullPointer_fegetexceptflag ( int expects )
2015-09-11 16:29:39 +02:00
{
fexcept_t * flagp = 0 ;
// cppcheck-suppress nullPointer
2020-12-05 08:00:31 +01:00
( void ) std : : fegetexceptflag ( flagp , expects ) ;
2015-09-11 16:29:39 +02:00
// cppcheck-suppress nullPointer
2020-12-05 08:00:31 +01:00
( void ) std : : fegetexceptflag ( 0 , expects ) ;
2015-09-11 16:29:39 +02:00
}
void nullPointer_feholdexcept ( void )
{
fenv_t * envp = 0 ;
// cppcheck-suppress nullPointer
( void ) std : : feholdexcept ( envp ) ;
// cppcheck-suppress nullPointer
( void ) std : : feholdexcept ( 0 ) ;
}
void nullPointer_fesetenv ( void )
{
2023-08-05 18:48:43 +02:00
const fenv_t * envp = 0 ;
2015-09-11 16:29:39 +02:00
// cppcheck-suppress nullPointer
( void ) std : : fesetenv ( envp ) ;
// cppcheck-suppress nullPointer
( void ) std : : fesetenv ( 0 ) ;
}
2015-09-11 16:50:59 +02:00
2020-12-05 08:00:31 +01:00
void nullPointer_fesetexceptflag ( int expects )
2015-09-11 16:50:59 +02:00
{
2023-08-05 18:48:43 +02:00
const fexcept_t * flagp = 0 ;
2015-09-11 16:50:59 +02:00
// cppcheck-suppress nullPointer
2020-12-05 08:00:31 +01:00
( void ) std : : fesetexceptflag ( flagp , expects ) ;
2015-09-11 16:50:59 +02:00
// cppcheck-suppress nullPointer
2020-12-05 08:00:31 +01:00
( void ) std : : fesetexceptflag ( 0 , expects ) ;
2015-09-11 16:50:59 +02:00
}
void nullPointer_feupdateenv ( void )
{
2023-08-05 18:48:43 +02:00
const fenv_t * envp = 0 ;
2015-09-11 16:50:59 +02:00
// cppcheck-suppress nullPointer
( void ) std : : feupdateenv ( envp ) ;
// cppcheck-suppress nullPointer
( void ) std : : feupdateenv ( 0 ) ;
}
void nullPointer_atexit ( void )
{
// cppcheck-suppress nullPointer
( void ) std : : atexit ( 0 ) ;
}
void nullPointer_atof ( void )
{
2023-08-05 18:48:43 +02:00
const char * c = 0 ;
2015-09-11 16:50:59 +02:00
// cppcheck-suppress nullPointer
( void ) std : : atof ( c ) ;
// cppcheck-suppress nullPointer
( void ) std : : atof ( 0 ) ;
}
2015-09-23 22:46:36 +02:00
2022-04-21 21:01:38 +02:00
void nullPointer_memcpy ( void * s1 , const void * s2 , size_t n )
2015-09-23 22:46:36 +02:00
{
// cppcheck-suppress nullPointer
2022-04-21 21:01:38 +02:00
( void ) std : : memcpy ( NULL , s2 , n ) ;
// cppcheck-suppress nullPointer
( void ) std : : memcpy ( s1 , NULL , n ) ;
( void ) std : : memcpy ( s1 , s2 , n ) ;
}
void nullPointer_memmove ( void * s1 , void * s2 , size_t n )
{
// cppcheck-suppress nullPointer
( void ) std : : memmove ( NULL , s2 , n ) ;
// cppcheck-suppress nullPointer
( void ) std : : memmove ( s1 , NULL , n ) ;
( void ) std : : memmove ( s1 , s2 , n ) ;
2015-09-23 22:46:36 +02:00
}
2022-04-22 07:25:27 +02:00
void nullPointer_wmemmove ( wchar_t * s1 , const wchar_t * s2 , size_t n )
{
// cppcheck-suppress nullPointer
( void ) std : : wmemmove ( NULL , s2 , n ) ;
// cppcheck-suppress nullPointer
( void ) std : : wmemmove ( s1 , NULL , n ) ;
( void ) std : : wmemmove ( s1 , s2 , n ) ;
}
void nullPointer_wmemset ( wchar_t * s , wchar_t c , size_t n )
{
// cppcheck-suppress nullPointer
( void ) std : : wmemset ( NULL , c , n ) ;
( void ) std : : wmemset ( s , c , n ) ;
}
2016-11-01 12:25:23 +01:00
///////////////////////////////////////////////////////////////////////
// <algorithm>
///////////////////////////////////////////////////////////////////////
# include <algorithm>
# include <list>
2021-08-07 20:51:18 +02:00
# define pred [] (int i) {return i==0;}
2016-11-02 09:50:37 +01:00
2016-11-02 09:57:35 +01:00
void stdalgorithm ( const std : : list < int > & ints1 , const std : : list < int > & ints2 )
2016-11-01 14:08:42 +01:00
{
2016-11-02 09:57:35 +01:00
// <!-- InputIterator std::find(InputIterator first, InputIterator last, T val) -->
2016-11-01 12:25:23 +01:00
// cppcheck-suppress mismatchingContainers
// cppcheck-suppress ignoredReturnValue
std : : find ( ints1 . begin ( ) , ints2 . end ( ) , 123 ) ;
2016-11-01 14:08:42 +01:00
// cppcheck-suppress mismatchingContainers
if ( std : : find ( ints1 . begin ( ) , ints1 . end ( ) , 123 ) = = ints2 . end ( ) ) { }
2016-11-02 09:13:54 +01:00
2019-11-05 14:00:50 +01:00
// #9455
std : : list < int > : : const_iterator uninitItBegin ;
std : : list < int > : : const_iterator uninitItEnd ;
2022-07-09 07:39:04 +02:00
// cppcheck-suppress uninitvar
2019-11-05 14:00:50 +01:00
if ( std : : find ( uninitItBegin , uninitItEnd , 123 ) = = uninitItEnd ) { }
2016-11-02 09:57:35 +01:00
// <!-- InputIterator std::find_if(InputIterator first, InputIterator last, UnaryPredicate val) -->
2016-11-02 09:13:54 +01:00
// cppcheck-suppress mismatchingContainers
// cppcheck-suppress ignoredReturnValue
2016-11-02 09:50:37 +01:00
std : : find_if ( ints1 . begin ( ) , ints2 . end ( ) , pred ) ;
2016-11-02 09:13:54 +01:00
// cppcheck-suppress mismatchingContainers
2016-11-02 09:50:37 +01:00
if ( std : : find_if ( ints1 . begin ( ) , ints1 . end ( ) , pred ) = = ints2 . end ( ) ) { }
2016-11-02 09:13:54 +01:00
2016-11-02 09:57:35 +01:00
// <!-- InputIterator std::find_if_not(InputIterator first, InputIterator last, UnaryPredicate val) -->
2016-11-02 09:13:54 +01:00
// cppcheck-suppress mismatchingContainers
// cppcheck-suppress ignoredReturnValue
2016-11-02 09:50:37 +01:00
std : : find_if_not ( ints1 . begin ( ) , ints2 . end ( ) , pred ) ;
2016-11-02 09:13:54 +01:00
// cppcheck-suppress mismatchingContainers
2016-11-02 09:50:37 +01:00
if ( std : : find_if_not ( ints1 . begin ( ) , ints1 . end ( ) , pred ) = = ints2 . end ( ) ) { }
2016-11-02 09:29:15 +01:00
2016-11-02 09:57:35 +01:00
// <!-- bool std::all_of(InputIterator first, InputIterator last, UnaryPredicate pred) -->
2016-11-02 09:29:15 +01:00
// cppcheck-suppress mismatchingContainers
// cppcheck-suppress ignoredReturnValue
std : : all_of ( ints1 . begin ( ) , ints2 . end ( ) , pred ) ;
2016-11-02 09:57:35 +01:00
// <!-- bool std::any_of(InputIterator first, InputIterator last, UnaryPredicate pred) -->
2016-11-02 09:29:15 +01:00
// cppcheck-suppress mismatchingContainers
// cppcheck-suppress ignoredReturnValue
std : : any_of ( ints1 . begin ( ) , ints2 . end ( ) , pred ) ;
2016-11-02 09:57:35 +01:00
// <!-- bool std::none_of(InputIterator first, InputIterator last, UnaryPredicate pred) -->
2016-11-02 09:29:15 +01:00
// cppcheck-suppress mismatchingContainers
// cppcheck-suppress ignoredReturnValue
std : : none_of ( ints1 . begin ( ) , ints2 . end ( ) , pred ) ;
2016-11-02 09:57:35 +01:00
// <!-- difference_type std::count(InputIterator first, InputIterator last, T val) -->
// cppcheck-suppress mismatchingContainers
// cppcheck-suppress ignoredReturnValue
std : : count ( ints1 . begin ( ) , ints2 . end ( ) , 123 ) ;
// <!-- difference_type std::count_if(InputIterator first, InputIterator last, UnaryPredicate val) -->
// cppcheck-suppress mismatchingContainers
// cppcheck-suppress ignoredReturnValue
std : : count_if ( ints1 . begin ( ) , ints2 . end ( ) , pred ) ;
2016-11-02 10:01:56 +01:00
// <!-- Function std::for_each(InputIterator first, InputIterator last, Function func) -->
// cppcheck-suppress mismatchingContainers
2016-11-04 14:03:48 +01:00
std : : for_each ( ints1 . begin ( ) , ints2 . end ( ) , [ ] ( int i ) { } ) ;
2016-11-02 09:29:15 +01:00
}
2017-03-04 08:56:37 +01:00
2017-03-04 11:13:28 +01:00
void getline ( )
{
2017-03-04 08:56:37 +01:00
// #837
std : : ifstream in ( " test1.txt " ) ;
char cBuf [ 10 ] ;
// cppcheck-suppress bufferAccessOutOfBounds
in . getline ( cBuf , 100 ) ;
// cppcheck-suppress bufferAccessOutOfBounds
in . read ( cBuf , 100 ) ;
// cppcheck-suppress bufferAccessOutOfBounds
in . readsome ( cBuf , 100 ) ;
// cppcheck-suppress bufferAccessOutOfBounds
in . get ( cBuf , 100 ) ;
// cppcheck-suppress bufferAccessOutOfBounds
in . get ( cBuf , 100 , ' a ' ) ;
// cppcheck-suppress bufferAccessOutOfBounds
in . getline ( cBuf , 100 , ' a ' ) ;
in . close ( ) ;
}
2017-03-05 22:23:45 +01:00
2023-06-09 16:03:47 +02:00
// TODO cppcheck-suppress passedByValue
2023-02-08 08:59:13 +01:00
void stream_write ( std : : ofstream & s , std : : vector < char > v ) {
if ( v . empty ( ) ) { }
s . write ( v . data ( ) , v . size ( ) ) ;
}
2017-03-06 16:40:49 +01:00
void stdstring ( )
{
2017-03-05 22:23:45 +01:00
std : : string s ;
// cppcheck-suppress ignoredReturnValue
s . size ( ) ;
2019-02-11 13:40:36 +01:00
// valid
s . assign ( " a " ) ;
2023-08-21 10:43:54 +02:00
# ifdef __cpp_lib_starts_ends_with
// cppcheck-suppress ignoredReturnValue
s . starts_with ( " abc " ) ;
# endif
2017-03-05 22:23:45 +01:00
}
2017-03-06 16:40:49 +01:00
void stdvector ( )
{
2019-03-02 19:38:11 +01:00
int uninit1 , uninit2 , uninit3 ;
2017-03-05 22:23:45 +01:00
std : : vector < int > v ;
// cppcheck-suppress ignoredReturnValue
v . size ( ) ;
2018-04-19 16:41:25 +02:00
// cppcheck-suppress ignoredReturnValue
v . capacity ( ) ;
// cppcheck-suppress uselessCallsEmpty
// cppcheck-suppress ignoredReturnValue
v . empty ( ) ;
// cppcheck-suppress ignoredReturnValue
v . max_size ( ) ;
2018-04-11 17:21:26 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
v . push_back ( uninit1 ) ;
2018-04-19 16:41:25 +02:00
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
v . reserve ( uninit2 ) ;
2018-04-19 16:41:25 +02:00
// cppcheck-suppress invalidFunctionArg
v . reserve ( - 1 ) ;
// no warning is expected for capacity 0 as it simply has no effect
v . reserve ( 0 ) ;
// cppcheck-suppress uninitvar
2019-03-02 19:38:11 +01:00
v . resize ( uninit3 ) ;
2018-04-19 16:41:25 +02:00
// cppcheck-suppress invalidFunctionArg
v . resize ( - 1 ) ;
v . clear ( ) ;
v . shrink_to_fit ( ) ;
2018-04-11 17:21:26 +02:00
// no warning is expected for pop_back()
v . push_back ( 42 ) ;
v . pop_back ( ) ;
v . push_back ( 42 ) ;
// cppcheck-suppress ignoredReturnValue
v . back ( ) ;
2018-04-19 16:41:25 +02:00
// cppcheck-suppress ignoredReturnValue
v . front ( ) ;
2017-03-06 16:59:17 +01:00
}
2019-09-24 12:16:13 +02:00
void stdbind_helper ( int a )
{
printf ( " %d " , a ) ;
}
void stdbind ( )
{
using namespace std : : placeholders ;
// TODO cppcheck-suppress ignoredReturnValue #9369
std : : bind ( stdbind_helper , 1 ) ;
2022-03-28 21:45:49 +02:00
// TODO cppcheck-suppress unreadVariable
2019-09-24 12:16:13 +02:00
auto f1 = std : : bind ( stdbind_helper , _1 ) ;
2022-03-28 21:45:49 +02:00
// TODO cppcheck-suppress unreadVariable
2019-09-24 12:16:13 +02:00
auto f2 = std : : bind ( stdbind_helper , 10 ) ;
}
2022-02-11 21:23:23 +01:00
2023-03-02 21:45:15 +01:00
int stdexchange ( ) {
int i ;
// cppcheck-suppress uninitvar
int j = std : : exchange ( i , 5 ) ;
return j ;
}
2022-02-11 21:23:23 +01:00
class A
{
std : : vector < std : : string > m_str ;
public :
A ( ) { }
// cppcheck-suppress functionConst
void begin_const_iterator ( void )
{
for ( std : : vector < std : : string > : : const_iterator it = m_str . begin ( ) ; it ! = m_str . end ( ) ; + + it ) { ; }
}
// cppcheck-suppress functionConst
void cbegin_const_iterator ( void )
{
for ( std : : vector < std : : string > : : const_iterator it = m_str . cbegin ( ) ; it ! = m_str . cend ( ) ; + + it ) { ; }
}
// cppcheck-suppress functionConst
void crbegin_const_iterator ( void )
{
for ( std : : vector < std : : string > : : const_reverse_iterator it = m_str . crbegin ( ) ; it ! = m_str . crend ( ) ; + + it ) { ; }
}
// cppcheck-suppress functionConst
void rbegin_const_iterator ( void )
{
for ( std : : vector < std : : string > : : const_reverse_iterator it = m_str . rbegin ( ) ; it ! = m_str . rend ( ) ; + + it ) { ; }
}
// cppcheck-suppress functionConst
void cbegin_auto ( void )
{
for ( auto it = m_str . cbegin ( ) ; it ! = m_str . cend ( ) ; + + it ) { ; }
}
void baz_begin_no_const_iterator ( void )
{
for ( std : : vector < std : : string > : : iterator it = m_str . begin ( ) ; it ! = m_str . end ( ) ; + + it ) { ; }
}
void rbegin_no_const_iterator ( void )
{
for ( std : : vector < std : : string > : : reverse_iterator it = m_str . rbegin ( ) ; it ! = m_str . rend ( ) ; + + it ) { ; }
}
} ;
2023-01-16 22:08:31 +01:00
void addressof ( int a )
{
// cppcheck-suppress ignoredReturnValue
std : : addressof ( a ) ;
2023-01-20 15:46:06 +01:00
}
void string_view_unused ( std : : string_view v )
{
// cppcheck-suppress ignoredReturnValue
v . substr ( 1 , 3 ) ;
2023-02-05 18:10:08 +01:00
}
void stdspan ( )
{
# ifndef __cpp_lib_span
# warning "This compiler does not support std::span"
# else
std : : vector < int > vec { 1 , 2 , 3 , 4 } ;
std : : span spn { vec } ;
// cppcheck-suppress unreadVariable
std : : span spn2 = spn ;
2023-06-02 15:24:18 +02:00
//cppcheck-suppress ignoredReturnValue
2023-02-05 18:10:08 +01:00
spn . begin ( ) ;
2023-06-02 15:24:18 +02:00
//cppcheck-suppress ignoredReturnValue
2023-02-05 18:10:08 +01:00
spn . end ( ) ;
2023-06-02 15:24:18 +02:00
//cppcheck-suppress ignoredReturnValue
2023-02-05 18:10:08 +01:00
spn . rbegin ( ) ;
2023-06-02 15:24:18 +02:00
//cppcheck-suppress ignoredReturnValue
2023-02-05 18:10:08 +01:00
spn . front ( ) ;
2023-06-02 15:24:18 +02:00
//cppcheck-suppress ignoredReturnValue
2023-02-05 18:10:08 +01:00
spn . back ( ) ;
//cppcheck-suppress constStatement
spn [ 0 ] ;
2023-06-02 15:24:18 +02:00
//cppcheck-suppress ignoredReturnValue
2023-02-05 18:10:08 +01:00
spn . data ( ) ;
2023-06-02 15:24:18 +02:00
//cppcheck-suppress ignoredReturnValue
2023-02-05 18:10:08 +01:00
spn . size ( ) ;
2023-06-02 15:24:18 +02:00
//cppcheck-suppress ignoredReturnValue
2023-02-05 18:10:08 +01:00
spn . size_bytes ( ) ;
2023-06-02 15:24:18 +02:00
//cppcheck-suppress ignoredReturnValue
2023-02-05 18:10:08 +01:00
spn . empty ( ) ;
//cppcheck-suppress ignoredReturnValue
spn . first ( 2 ) ;
//cppcheck-suppress ignoredReturnValue
spn . last ( 2 ) ;
//cppcheck-suppress ignoredReturnValue
spn . subspan ( 1 , 2 ) ;
spn . subspan < 1 > ( ) ;
static constexpr std : : array < int , 2 > arr { 1 , 2 } ;
constexpr std : : span spn3 { arr } ;
spn3 . first < 1 > ( ) ;
spn3 . last < 1 > ( ) ;
spn3 . subspan < 1 , 1 > ( ) ;
# endif
2023-03-09 17:06:53 +01:00
}
void beginEnd ( )
{
std : : vector < int > v ;
//cppcheck-suppress ignoredReturnValue
std : : begin ( v ) ;
//cppcheck-suppress ignoredReturnValue
std : : rbegin ( v ) ;
//cppcheck-suppress ignoredReturnValue
std : : cbegin ( v ) ;
//cppcheck-suppress ignoredReturnValue
std : : crbegin ( v ) ;
//cppcheck-suppress ignoredReturnValue
std : : end ( v ) ;
//cppcheck-suppress ignoredReturnValue
std : : rend ( v ) ;
//cppcheck-suppress ignoredReturnValue
std : : cend ( v ) ;
//cppcheck-suppress ignoredReturnValue
std : : crend ( v ) ;
2023-08-05 18:48:43 +02:00
// cppcheck-suppress constVariable
2023-03-09 17:06:53 +01:00
int arr [ 4 ] ;
//cppcheck-suppress ignoredReturnValue
std : : begin ( arr ) ;
//cppcheck-suppress ignoredReturnValue
std : : rbegin ( arr ) ;
//cppcheck-suppress ignoredReturnValue
std : : cbegin ( arr ) ;
//cppcheck-suppress ignoredReturnValue
std : : crbegin ( arr ) ;
//cppcheck-suppress ignoredReturnValue
std : : end ( arr ) ;
//cppcheck-suppress ignoredReturnValue
std : : rend ( arr ) ;
//cppcheck-suppress ignoredReturnValue
std : : cend ( arr ) ;
//cppcheck-suppress ignoredReturnValue
std : : crend ( arr ) ;
2023-05-28 19:42:47 +02:00
}
void smartPtr_get ( )
{
std : : unique_ptr < int > p ;
//cppcheck-suppress ignoredReturnValue
p . get ( ) ;
//cppcheck-suppress nullPointer
* p = 1 ;
2023-06-03 14:36:30 +02:00
}
2023-06-10 17:37:32 +02:00
void smartPtr_get2 ( std : : vector < std : : unique_ptr < int > > & v )
2023-06-07 20:45:48 +02:00
{
for ( auto & u : v ) {
int * p = u . get ( ) ;
* p = 0 ;
}
}
2023-06-03 14:36:30 +02:00
void smartPtr_reset ( )
{
std : : unique_ptr < int > p ( new int ( ) ) ;
p . reset ( nullptr ) ;
//cppcheck-suppress nullPointer
* p = 1 ;
}
void smartPtr_release ( )
{
std : : unique_ptr < int > p { new int ( ) } ;
//cppcheck-suppress ignoredReturnValue
p . release ( ) ;
//cppcheck-suppress nullPointer
* p = 1 ;
2023-06-05 20:47:42 +02:00
}
void std_vector_data_arithmetic ( )
{
2023-06-10 17:37:32 +02:00
std : : vector < char > buf ;
buf . resize ( 1 ) ;
memcpy ( buf . data ( ) + 0 , " " , 1 ) ;
2023-06-05 20:47:42 +02:00
}