Patch to disable warning about redundant redeclaration of builtin

Alexander Kabaev kan@freebsd.org
Fri Jul 23 17:51:00 GMT 2004


I tried to describe the problem in bug c/16684 titled "[3.4/3.5 Regression] GCC should not warn about redundant redeclarations of built-ins". The patch below
suppresses the warning if redundant declaration matches builtin function type
exactly. The patch is against gcc 3.4 branch.

The patch is looking both for approval and for a committer willing to appy it,
if approved.

2004-07-22  Alexander Kabaev <kan@FreeBSD.ORG>                                  
        * c-decl.s (diagnose_mismatched_decls): Do not warn on redundant        
        redeclaration of built-ins.                                             

Index: c-decl.c
===================================================================
RCS file: /usr/download/ncvs/src/contrib/gcc/c-decl.c,v
retrieving revision 1.1.1.18
diff -u -r1.1.1.18 c-decl.c
--- c-decl.c	21 Jun 2004 23:47:45 -0000	1.1.1.18
+++ c-decl.c	22 Jul 2004 01:55:22 -0000
@@ -1253,6 +1255,9 @@
 	 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))
       /* Don't warn about an extern followed by a definition.  */
       && !(DECL_EXTERNAL (olddecl) && !DECL_EXTERNAL (newdecl))
       /* Don't warn about forward parameter decls.  */



More information about the Gcc-patches mailing list