summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-23 18:13:55 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-23 18:13:55 +0000
commit32a8d34eaf995c1d3e706bd6719b6a9e140c39e4 (patch)
treecfd782672a48cf6a1c62786f30ac6d027af6b1d6 /gcc/testsuite
parent83ae44d67cc1681902a02585e10c5b5d1a06634a (diff)
downloadppe42-gcc-32a8d34eaf995c1d3e706bd6719b6a9e140c39e4.tar.gz
ppe42-gcc-32a8d34eaf995c1d3e706bd6719b6a9e140c39e4.zip
PR 18314
* c-decl.c (diagnose_mismatched_decls): Also discard a built-in if we encounter an old-style definition with the same name. testsuite: * gcc.dg/builtins-30.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@76441 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/builtins-30.c27
2 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 20b71833ae3..848ca88e605 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-23 Zack Weinberg <zack@codesourcery.com>
+
+ PR 18314
+ * gcc.dg/builtins-30.c: New testcase.
+
2004-01-23 Andreas Tobler <a.tobler@schweiz.ch>
* g++.dg/compat/compat.exp: Add LD_LIBRARY_PATH_32/64 for Solaris.
diff --git a/gcc/testsuite/gcc.dg/builtins-30.c b/gcc/testsuite/gcc.dg/builtins-30.c
new file mode 100644
index 00000000000..a2d7433b4c7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtins-30.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-Wall -Wshadow" } */
+
+extern double strtod (const char *, char **);
+#define UNUSED __attribute__ ((unused))
+
+/* A built-in function may be overridden by an old-style definition
+ specifying too few arguments... */
+double nan ()
+{
+ return strtod ("nan", 0); /* { dg-warning "shadowing built-in" } */
+}
+
+/* the right number, but the wrong type, arguments... */
+float nanf (foo)
+ int foo UNUSED;
+{
+ return strtod ("nan", 0); /* { dg-warning "shadowing built-in" } */
+}
+
+/* or too many arguments. */
+long double nanl (foo, bar)
+ const char *foo UNUSED;
+ int bar UNUSED;
+{
+ return strtod ("nan", 0); /* { dg-warning "shadowing built-in" } */
+}
OpenPOWER on IntegriCloud