From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5448 invoked by alias); 13 Jul 2004 07:50:41 -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 5336 invoked from network); 13 Jul 2004 07:50:40 -0000 Received: from unknown (HELO develer.com) (151.38.19.110) by sourceware.org with SMTP; 13 Jul 2004 07:50:40 -0000 Received: (qmail 15841 invoked from network); 13 Jul 2004 07:50:36 -0000 Received: from beetle.trilan (HELO ?10.3.2.254?) (?dgbKlcuh0DgahHENXSJqoPiEjWrGvZcT?@10.3.2.254) by ns.trilan with SMTP; 13 Jul 2004 07:50:36 -0000 Message-ID: <40F3944C.1000502@develer.com> Date: Tue, 13 Jul 2004 07:50: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: Andrew Pinski CC: 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> In-Reply-To: <200407120419.i6C4Jq318362@tin.geop.uc.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2004-07/txt/msg00142.txt.bz2 Andrew Pinski wrote: >>this patch adds the ARG_UNUSED() macro to be used in place of >>ATTRIBUTE_UNUSED. The syntax looks like this: >> >> void foo (ARG_UNUSED (int, x)) >> { >> } >> >>The C++ frontend can't parse attribute((unused)) when it >>appears after the variable name. The cleanest work-around >>is using the standard C++ syntax to specify unused >>parameters, which can also be used when bootstrapping from >>other C++ compilers. >> >>This patch is a prerequisite for the upcoming C++ bootstrap >>patches that I've been preparing. > > > Huh? Yes it can from 3.4.0 and above. Nevertheless, bootstrap from earlier versions of GCC would fail (I was using Apple's version of GCC 3.3). ansidecl.h enables ATTRIBUTE_UNUSED for any GCC > 2.7. We could make the check stricter, like this: #if !defined(__cplusplus) || GCC_VERSION >= 3004 #define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) #endif But I'd much prefer the ARG_UNUSED solution, which can be made to work with and C or C++ compiler, using whatever funny syntax the compiler requires. This macro is in libiberty, which is about portability across different OSes and compilers. I also like the ARG_UNUSED syntax because it's somewhat shorter to type. (btw, Doxygen can parse it if you define ARG_UNUSED(T,N) to "T N"). -- // Bernardo Innocenti - Develer S.r.l., R&D dept. \X/ http://www.develer.com/