From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11447 invoked by alias); 25 Apr 2012 17:22:37 -0000 Received: (qmail 11428 invoked by uid 22791); 25 Apr 2012 17:22:35 -0000 X-SWARE-Spam-Status: No, hits=-4.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 25 Apr 2012 17:22:22 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1SN5v3-0004qh-C3 from Maciej_Rozycki@mentor.com ; Wed, 25 Apr 2012 10:22:21 -0700 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 25 Apr 2012 10:22:20 -0700 Received: from [172.30.0.84] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.1.289.1; Wed, 25 Apr 2012 18:22:18 +0100 Date: Wed, 25 Apr 2012 17:22:00 -0000 From: "Maciej W. Rozycki" To: Andreas Schwab CC: Tom Tromey , Sergio Durigan Junior , Jan Kratochvil , Subject: Re: Switch -Wunused-variable on? In-Reply-To: Message-ID: References: <20120422082240.GA21311@host2.jankratochvil.net> <87sjfufrlr.fsf@fleche.redhat.com> User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2012-04/txt/msg00214.txt.bz2 On Wed, 25 Apr 2012, Andreas Schwab wrote: > >> It also requires an unconditional declaration and definition of > >> target_frobnicate_harder. > > > > Yes, but do you see at as advantage or disadvantage? > > It makes your example non-working as written due to the missing > declaration. The declaration should be moved outside the conditional, I've overlooked that, sorry. If target_frobnicate_harder is external then the prototype will be in a header anyway. And such an unconditional declaration is actually good for conditional pieces that are rarely enabled -- people making bulk changes will still receive the usual diagnostics about this function's argument type compatibility, etc. even if this piece of code is actually not used for the configuration they chose, as long as this source file is compiled at all. Then you don't actually need a definition, because the call will be optimised away (together with the whole enclosing "if (0)" block) by the compiler. There's nothing wrong with having a declaration and no definition for an entity that's never eventually used. Maciej