Added gets_s() to std.cfg (C11), added <use-retval/> to min/max().
This commit is contained in:
parent
6c43cb2e28
commit
8f641aaa76
20
cfg/std.cfg
20
cfg/std.cfg
|
@ -1442,8 +1442,22 @@
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
<not-null/>
|
<not-null/>
|
||||||
</arg>
|
</arg>
|
||||||
<warn severity="warning">Obsolete function 'gets' called. It is recommended to use 'fgets' instead.
|
<warn severity="warning">Obsolete function 'gets' called. It is recommended to use 'fgets' or 'gets_s' instead.
|
||||||
The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun if the input data exceeds the size of the buffer. It is recommended to use the function 'fgets' instead.</warn>
|
The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun if the input data exceeds the size of the buffer. It is recommended to use the functions 'fgets' or 'gets_s' instead.</warn>
|
||||||
|
</function>
|
||||||
|
<!-- char *gets_s(char *buffer, rsize_t size); -->
|
||||||
|
<function name="gets_s,std::gets_s">
|
||||||
|
<noreturn>false</noreturn>
|
||||||
|
<leak-ignore/>
|
||||||
|
<arg nr="1">
|
||||||
|
<not-null/>
|
||||||
|
<minsize type="argvalue" arg="2"/>
|
||||||
|
</arg>
|
||||||
|
<arg nr="2">
|
||||||
|
<not-uninit/>
|
||||||
|
<not-bool/>
|
||||||
|
<valid>0:</valid>
|
||||||
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- struct tm * gmtime(const time_t *tp); -->
|
<!-- struct tm * gmtime(const time_t *tp); -->
|
||||||
<function name="gmtime,std::gmtime">
|
<function name="gmtime,std::gmtime">
|
||||||
|
@ -3842,6 +3856,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
|
||||||
</function>
|
</function>
|
||||||
<!-- template <class T> const T& min(const T& a, const T& b); -->
|
<!-- template <class T> const T& min(const T& a, const T& b); -->
|
||||||
<function name="min,std::min">
|
<function name="min,std::min">
|
||||||
|
<use-retval/>
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
|
@ -3853,6 +3868,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
|
||||||
</function>
|
</function>
|
||||||
<!-- template <class T> const T& max(const T& a, const T& b); -->
|
<!-- template <class T> const T& max(const T& a, const T& b); -->
|
||||||
<function name="max,std::max">
|
<function name="max,std::max">
|
||||||
|
<use-retval/>
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
|
|
|
@ -216,13 +216,13 @@ private:
|
||||||
"{\n"
|
"{\n"
|
||||||
" char *x = gets(a);\n"
|
" char *x = gets(a);\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:3]: (warning) Obsolete function 'gets' called. It is recommended to use 'fgets' instead.\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:3]: (warning) Obsolete function 'gets' called. It is recommended to use 'fgets' or 'gets_s' instead.\n", errout.str());
|
||||||
|
|
||||||
check("void f()\n"
|
check("void f()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" foo(x, gets(a));\n"
|
" foo(x, gets(a));\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:3]: (warning) Obsolete function 'gets' called. It is recommended to use 'fgets' instead.\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:3]: (warning) Obsolete function 'gets' called. It is recommended to use 'fgets' or 'gets_s' instead.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void prohibitedFunctions_alloca() {
|
void prohibitedFunctions_alloca() {
|
||||||
|
@ -276,8 +276,8 @@ private:
|
||||||
" char *x = std::gets(str);\n"
|
" char *x = std::gets(str);\n"
|
||||||
" char *y = gets(str);\n"
|
" char *y = gets(str);\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:3]: (warning) Obsolete function 'gets' called. It is recommended to use 'fgets' instead.\n"
|
ASSERT_EQUALS("[test.cpp:3]: (warning) Obsolete function 'gets' called. It is recommended to use 'fgets' or 'gets_s' instead.\n"
|
||||||
"[test.cpp:4]: (warning) Obsolete function 'gets' called. It is recommended to use 'fgets' instead.\n", errout.str());
|
"[test.cpp:4]: (warning) Obsolete function 'gets' called. It is recommended to use 'fgets' or 'gets_s' instead.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// multiple use
|
// multiple use
|
||||||
|
@ -287,7 +287,7 @@ private:
|
||||||
" char *x = std::gets(str);\n"
|
" char *x = std::gets(str);\n"
|
||||||
" usleep( 1000 );\n"
|
" usleep( 1000 );\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:3]: (warning) Obsolete function 'gets' called. It is recommended to use 'fgets' instead.\n"
|
ASSERT_EQUALS("[test.cpp:3]: (warning) Obsolete function 'gets' called. It is recommended to use 'fgets' or 'gets_s' instead.\n"
|
||||||
"[test.cpp:4]: (style) Obsolescent function 'usleep' called. It is recommended to use 'nanosleep' or 'setitimer' instead.\n", errout.str());
|
"[test.cpp:4]: (style) Obsolescent function 'usleep' called. It is recommended to use 'nanosleep' or 'setitimer' instead.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ private:
|
||||||
" char s [ 10 ] ;\n"
|
" char s [ 10 ] ;\n"
|
||||||
" gets ( s ) ;\n"
|
" gets ( s ) ;\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:5]: (warning) Obsolete function 'gets' called. It is recommended to use 'fgets' instead.\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:5]: (warning) Obsolete function 'gets' called. It is recommended to use 'fgets' or 'gets_s' instead.\n", errout.str());
|
||||||
|
|
||||||
check("int getcontext(ucontext_t *ucp);\n"
|
check("int getcontext(ucontext_t *ucp);\n"
|
||||||
"int f (ucontext_t *ucp)\n"
|
"int f (ucontext_t *ucp)\n"
|
||||||
|
|
Loading…
Reference in New Issue