From 8f641aaa7641ad3a82e92fb8178bf1fae9e3b996 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Fri, 18 Dec 2015 18:09:07 +0100 Subject: [PATCH] Added gets_s() to std.cfg (C11), added to min/max(). --- cfg/std.cfg | 20 ++++++++++++++++++-- test/testfunctions.cpp | 12 ++++++------ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/cfg/std.cfg b/cfg/std.cfg index 93ad619e5..2e27b40d9 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -1442,8 +1442,22 @@ - Obsolete function 'gets' called. It is recommended to use 'fgets' 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. + 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 functions 'fgets' or 'gets_s' instead. + + + + false + + + + + + + + + 0: + @@ -3842,6 +3856,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun + false @@ -3853,6 +3868,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun + false diff --git a/test/testfunctions.cpp b/test/testfunctions.cpp index c2e49bc37..67659d6cb 100644 --- a/test/testfunctions.cpp +++ b/test/testfunctions.cpp @@ -216,13 +216,13 @@ private: "{\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" "{\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() { @@ -276,8 +276,8 @@ private: " char *x = std::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" - "[test.cpp:4]: (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" + "[test.cpp:4]: (warning) Obsolete function 'gets' called. It is recommended to use 'fgets' or 'gets_s' instead.\n", errout.str()); } // multiple use @@ -287,7 +287,7 @@ private: " char *x = std::gets(str);\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()); } @@ -298,7 +298,7 @@ private: " char s [ 10 ] ;\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" "int f (ucontext_t *ucp)\n"