OSDN Git Service

2004-07-24 Alexander Kabaev <kan@freebsd.org>
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 25 Jul 2004 03:58:50 +0000 (03:58 +0000)
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 25 Jul 2004 03:58:50 +0000 (03:58 +0000)
    Zack Weinberg  <zack@codesourcery.com

PR 16684
* c-decl.c (diagnose_mismatched_decls): Don't issue a
redundant-declaration warning the first time a builtin is
declared explicitly.
testsuite:
* gcc.dg/Wredundant-decls-1.c: New test case.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85140 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/Wredundant-decls-1.c [new file with mode: 0644]

index 9e9d6e7..05d3615 100644 (file)
@@ -1,3 +1,11 @@
+2004-07-24  Alexander Kabaev  <kan@freebsd.org>
+           Zack Weinberg  <zack@codesourcery.com
+
+       PR 16684
+       * c-decl.c (diagnose_mismatched_decls): Don't issue a
+       redundant-declaration warning the first time a builtin is
+       declared explicitly.
+
 2004-07-25  Bernardo Innocenti  <bernie@develer.com>
 
        * tree.h (staticp): Change return type to bool.
index 65fd24d..41e7df0 100644 (file)
@@ -1444,6 +1444,11 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
         definition.  */
       && !(TREE_CODE (newdecl) == FUNCTION_DECL
           && DECL_INITIAL (newdecl) && !DECL_INITIAL (olddecl))
+      /* Don't warn about redundant redeclarations of builtins. */
+      && !(TREE_CODE (newdecl) == FUNCTION_DECL
+          && !DECL_BUILT_IN (newdecl)
+          && DECL_BUILT_IN (olddecl)
+          && !C_DECL_DECLARED_BUILTIN (olddecl))
       /* Don't warn about an extern followed by a definition.  */
       && !(DECL_EXTERNAL (olddecl) && !DECL_EXTERNAL (newdecl))
       /* Don't warn about forward parameter decls.  */
index bc7d6f6..8c95159 100644 (file)
@@ -1,3 +1,8 @@
+2004-07-24  Zack Weinberg  <zack@codesourcery.com>
+
+       PR 16684
+       * gcc.dg/Wredundant-decls-1.c: New test case.
+
 2004-07-24  Jakub Jelinek  <jakub@redhat.com>
 
        * README.compat: Add RUN_ALL_COMPAT_TESTS documentation.
@@ -58,7 +63,7 @@
 
 2004-07-22  David Billinghurst (David.Billinghurst@riotinto.com)
 
-       * gfortran.dg/g77/970625-2.f Copy from g77.f-torture/execute. 
+       * gfortran.dg/g77/970625-2.f Copy from g77.f-torture/execute.
        Add dg-run directive.  Declare variables as required.
        * gfortran.dg/g77/README: Update
 
 2004-07-21  David Billinghurst (David.Billinghurst@riotinto.com)
 
        Copy cases from g77.f-torture/execute and add dg-run
-       directive.  Other changes as noted.    
+       directive.  Other changes as noted.
        * gfortran.dg/g77/13037.f
        * gfortran.dg/g77/1832.f
        * gfortran.dg/g77/19981119-0.f
        g++.dg/parse/casting-operator2.C, g++.dg/parse/dtor3.C,
        g++.dg/parse/typename6.C, g++.dg/template/dependent-expr4.C,
        g++.dg/template/nontype3.C: Remove trailing CR from tests.
-       
+
 2004-07-18  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/16623
 
        PR c++/16518
        * g++.dg/parse/mutable1.C: New test.
-       
+
 2004-07-13  Diego Novillo  <dnovillo@redhat.com>
 
        PR tree-optimization/16443
 2004-07-13  David Billinghurst <David.Billinghurst@riotinto.com>
 
        * gfortran.dg/g77/README: New file
-       * gfortran.dg/g77/19981216-0.f:  Copy from 
+       * gfortran.dg/g77/19981216-0.f:  Copy from
        g77.f-torture/noncompile.  Add "dg-do compile" and
        dg-error as required.
        * gfortran.dg/g77/19990218-1.f: Likewise
        * gfortran.dg/g77/970125-0.f: Add dg-excess-errors.
        * gfortran.dg/g77/980519-2.f: Declare hd_S,hd_Z,hd_T
        * gfortran.dg/g77/990115-1.f: Declare RANK as INTEGER
-       * gfortran.dg/g77/alpha1.f: Separate declaration and DATA 
-       statement to conform to standard.  Append alpha1.x for reference. 
+       * gfortran.dg/g77/alpha1.f: Separate declaration and DATA
+       statement to conform to standard.  Append alpha1.x for reference.
        * gfortran.dg/g77/xformat.f: Add dg-warning
 
 2004-07-13  David Billinghurst <David.Billinghurst@riotinto.com>
+
        * gfortran.dg/g77/cpp.F: Copy from g77.f-torture/compile.
        Add {dg-do compile} directive.
        * gfortran.dg/g77/cpp2.F: Likewise
        * g++.old-deja/g++.ns/new1.C: Remove (ill-formed).
 
 2004-07-12  David Billinghurst <David.Billinghurst@riotinto.com>
+
        * gfortran.dg/g77/12002.f: Copy from g77.f-torture/compile.
        Add {dg-do compile} directive.
        * gfortran.dg/g77/13060.f: Likewise
 
        PR fortran/17574
        * gfortran.dg/pr15754.f90: New test.
-       
+
 2004-07-11  Joseph S. Myers  <jsm@polyomino.org.uk>
 
        PR tree-optimization/16437
        * gcc.c-torture/execute/bitfld-4.c: New test.
 
 2004-07-10  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
-       
+
        * gfortran.fortran-torture/execute/common_2.f90: Add check for
        access to common var from module.
 
        * gfortran.dg/g77/pr9258.f: Likewise.  Add dg-warning lines.
 
 2004-07-10  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
-       
+
        * gfortran.fortran-torture/execute/module_init_1.f90: Fix test.
 
 2004-07-10 Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
        * gcc.c-torture/compile/20040709-1.c: New.
 
 2004-07-09  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
-       
+
        PR fortran/14077
        * gfortran.fortran-torture/execute/module_init_1.f90: New test.
 
diff --git a/gcc/testsuite/gcc.dg/Wredundant-decls-1.c b/gcc/testsuite/gcc.dg/Wredundant-decls-1.c
new file mode 100644 (file)
index 0000000..c38c7b5
--- /dev/null
@@ -0,0 +1,7 @@
+/* PR 16684: no redundant declaration warnings should issue the first
+   time a built-in function is declared.
+   { dg-do compile }
+   { dg-options "-Wredundant-decls" } */
+
+void *malloc (__SIZE_TYPE__);  /* { dg-bogus "redundant" } */
+void *malloc (__SIZE_TYPE__);  /* { dg-warning "redundant" } */