From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12870 invoked by alias); 25 Apr 2012 18:52:33 -0000 Received: (qmail 12861 invoked by uid 22791); 25 Apr 2012 18:52:32 -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 18:52:18 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1SN7K3-0003MB-JY from Maciej_Rozycki@mentor.com ; Wed, 25 Apr 2012 11:52:15 -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 11:52:15 -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 19:52:12 +0100 Date: Wed, 25 Apr 2012 18:52:00 -0000 From: "Maciej W. Rozycki" To: Sterling Augustine CC: Andreas Schwab , 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="ISO-8859-1" Content-Transfer-Encoding: 8BIT 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/msg00217.txt.bz2 On Wed, 25 Apr 2012, Sterling Augustine wrote: > >>  Then you don't actually need a definition, because the call will be > >> optimised away > > > > You still need to support unoptimized builds. > > GCC eliminates the unreachable block of an "if (0)" even without > optimization. Many other compilers don't. It is an ongoing source of > complications for getting compilers other than GCC to build the linux > kernel which uses this approach extensively. That sounds silly, I didn't know that. In this case a "static inline" dummy function would have to be provided indeed that makes the solution a bit less elegant then I would like it to be. Still probably better than a maze of #ifdefs scattered throughout code, but YMMV. Maciej