From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18394 invoked by alias); 13 Jul 2004 22:45:10 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 18248 invoked from network); 13 Jul 2004 22:45:09 -0000 Received: from unknown (HELO develer.com) (151.38.19.110) by sourceware.org with SMTP; 13 Jul 2004 22:45:09 -0000 Received: (qmail 5247 invoked from network); 13 Jul 2004 22:44:59 -0000 Received: from beetle.trilan (HELO ?10.3.2.254?) (?lFdM9Bvb4hLS502UDSzYbCuKxlaJcj2U?@10.3.2.254) by trinity.trilan with SMTP; 13 Jul 2004 22:44:59 -0000 Message-ID: <40F465EA.3090703@develer.com> Date: Tue, 13 Jul 2004 22:45:00 -0000 From: Bernardo Innocenti Organization: Develer S.r.l. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040625 MIME-Version: 1.0 To: Bernd Schmidt CC: Richard Henderson , Andrew Pinski , GCC Patches , gdb-patches@sources.redhat.com, binutils@sources.redhat.com, Ian Lance Taylor , DJ Delorie Subject: Re: [libiberty] Add ARG_UNUSED as a C++-friendly replacement for ATTRIBUTE_UNUSED References: <200407120419.i6C4Jq318362@tin.geop.uc.edu> <40F3944C.1000502@develer.com> <20040713081153.GA3089@redhat.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2004-07/txt/msg00157.txt.bz2 Bernd Schmidt wrote: > On Tue, 13 Jul 2004, Richard Henderson wrote: >>On Tue, Jul 13, 2004 at 09:50:36AM +0200, Bernardo Innocenti wrote: >> >>#ifdef __cplusplus >># define ARG_UNUSED(N) >>#elif somegccversion >># define ARG_UNUSED(N) N ATTRIBUTE_UNUSED >>#else >># define ARG_UNUSED(N) N >>#endif > > That fails in cases where the argument is unused only on some targets > and needed by others. For those (few) cases, I've handled it by moving ATTRIBUTE_UNUSED before the typename, which seems to work G++ 3.3 too. > What's wrong with just disabling ATTRIBUTE_UNUSED for compilers that > can't handle it? - You get lots of annoying warnings in stage1 and when building a cross compiler; - If we switch to C++, ARG_UNUSED would allow using the standard C++ syntax for unused arguments; - libiberty.h is used in other projects and it's about portability across different compilers and platforms. The ATTRIBUTE_UNUSED macro cannot be made to work usefully with all compilers, therefore it must be replaced with something more portable; - "int ARG_UNUSED(foo)" is shorter, more readable and sexier than "int foo ATTRIBUTE_UNUSED". -- // Bernardo Innocenti - Develer S.r.l., R&D dept. \X/ http://www.develer.com/