aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/c-family/known-headers.cc1
-rw-r--r--gcc/testsuite/g++.dg/spellcheck-stdlib.C2
-rw-r--r--gcc/testsuite/gcc.dg/spellcheck-stdlib-2.c8
3 files changed, 11 insertions, 0 deletions
diff --git a/gcc/c-family/known-headers.cc b/gcc/c-family/known-headers.cc
index dbc42ea..871fd71 100644
--- a/gcc/c-family/known-headers.cc
+++ b/gcc/c-family/known-headers.cc
@@ -182,6 +182,7 @@ get_stdlib_header_for_name (const char *name, enum stdlib lib)
{"strchr", {"<string.h>", "<cstring>"} },
{"strcmp", {"<string.h>", "<cstring>"} },
{"strcpy", {"<string.h>", "<cstring>"} },
+ {"strerror", {"<string.h>", "<cstring>"} },
{"strlen", {"<string.h>", "<cstring>"} },
{"strncat", {"<string.h>", "<cstring>"} },
{"strncmp", {"<string.h>", "<cstring>"} },
diff --git a/gcc/testsuite/g++.dg/spellcheck-stdlib.C b/gcc/testsuite/g++.dg/spellcheck-stdlib.C
index fd0f3a9..33718b8 100644
--- a/gcc/testsuite/g++.dg/spellcheck-stdlib.C
+++ b/gcc/testsuite/g++.dg/spellcheck-stdlib.C
@@ -104,6 +104,8 @@ void test_cstring (char *dest, char *src)
// { dg-message "'#include <cstring>'" "" { target *-*-* } .-1 }
strcpy(dest, "test"); // { dg-error "was not declared" }
// { dg-message "'#include <cstring>'" "" { target *-*-* } .-1 }
+ strerror(0); // { dg-error "was not declared" }
+ // { dg-message "'#include <cstring>'" "" { target *-*-* } .-1 }
strlen("test"); // { dg-error "was not declared" }
// { dg-message "'#include <cstring>'" "" { target *-*-* } .-1 }
strncat(dest, "test", 3); // { dg-error "was not declared" }
diff --git a/gcc/testsuite/gcc.dg/spellcheck-stdlib-2.c b/gcc/testsuite/gcc.dg/spellcheck-stdlib-2.c
new file mode 100644
index 0000000..4762e2d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/spellcheck-stdlib-2.c
@@ -0,0 +1,8 @@
+/* { dg-options "-Wimplicit-function-declaration" } */
+
+/* Missing <string.h>. */
+void test_string_h (void)
+{
+ strerror (0); /* { dg-error "implicit declaration of function 'strerror'" } */
+ /* { dg-message "'strerror' is defined in header '<string.h>'" "" { target *-*-* } .-1 } */
+}