From owner-freebsd-arch@FreeBSD.ORG Sat Aug 27 23:51:45 2005 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5702616A41F; Sat, 27 Aug 2005 23:51:45 +0000 (GMT) (envelope-from rodrigc@crodrigues.org) Received: from sccrmhc13.comcast.net (sccrmhc13.comcast.net [204.127.202.64]) by mx1.FreeBSD.org (Postfix) with ESMTP id CEBEA43D45; Sat, 27 Aug 2005 23:51:44 +0000 (GMT) (envelope-from rodrigc@crodrigues.org) Received: from c-66-30-115-133.hsd1.ma.comcast.net ([66.30.115.133]) by comcast.net (sccrmhc13) with ESMTP id <20050827235141013005e73oe>; Sat, 27 Aug 2005 23:51:41 +0000 Received: from c-66-30-115-133.hsd1.ma.comcast.net (localhost.127.in-addr.arpa [127.0.0.1]) by c-66-30-115-133.hsd1.ma.comcast.net (8.13.4/8.13.1) with ESMTP id j7RNpfwm003153; Sat, 27 Aug 2005 19:51:41 -0400 (EDT) (envelope-from rodrigc@c-66-30-115-133.hsd1.ma.comcast.net) Received: (from rodrigc@localhost) by c-66-30-115-133.hsd1.ma.comcast.net (8.13.4/8.13.1/Submit) id j7RNpeeY003152; Sat, 27 Aug 2005 19:51:40 -0400 (EDT) (envelope-from rodrigc) Date: Sat, 27 Aug 2005 19:51:40 -0400 From: Craig Rodrigues To: obrien@freebsd.org, freebsd-arch@freebsd.org Message-ID: <20050827235140.GA3063@crodrigues.org> References: <20050810005323.GA42721@crodrigues.org> <20050810032308.GA80916@dragon.NUXI.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050810032308.GA80916@dragon.NUXI.org> User-Agent: Mutt/1.5.9i Cc: Subject: Re: [RFC] -Wredundant-decls: keep it or remove it? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Aug 2005 23:51:45 -0000 On Tue, Aug 09, 2005 at 08:23:08PM -0700, David O'Brien wrote: > On Tue, Aug 09, 2005 at 08:53:23PM -0400, Craig Rodrigues wrote: > > It is illegal in ISO C to declare a struct as extern (implying external > > linkage) , and then declare it as static (implying internal linkage). > .. > > OPTION 2: > > Forward declare routedomain as static, but remove -Wredundant-decls > > from kernel makefiles: > > static struct domain routedomain; > > .... > > static struct domain routedomain = { ..... } > > > > For OPTION 2, it is necessary to remove -Wredundant-decls > > because you will get a new compiler warning: > > > > warning: redundant redeclaration of 'routedomain' > > warnig: previous declaration was here ... > > This is a GCC bug that I am working to get fixed. Hi, Did you try something like this patch to GCC? Index: c-decl.c =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/c-decl.c,v retrieving revision 1.630.6.16 diff -u -u -r1.630.6.16 c-decl.c --- c-decl.c 16 Aug 2005 20:34:19 -0000 1.630.6.16 +++ c-decl.c 27 Aug 2005 23:43:06 -0000 @@ -1559,7 +1559,10 @@ && !(DECL_EXTERNAL (olddecl) && !DECL_EXTERNAL (newdecl)) /* Don't warn about forward parameter decls. */ && !(TREE_CODE (newdecl) == PARM_DECL - && TREE_ASM_WRITTEN (olddecl) && !TREE_ASM_WRITTEN (newdecl))) + && TREE_ASM_WRITTEN (olddecl) && !TREE_ASM_WRITTEN (newdecl)) + /* Don't warn about forward static variable decls. */ + && !(TREE_CODE (newdecl) == VAR_DECL + && !TREE_PUBLIC (olddecl) && !TREE_PUBLIC (newdecl))) { warning ("%Jredundant redeclaration of %qD", newdecl, newdecl); warned = true; -- Craig Rodrigues rodrigc@crodrigues.org