delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/17/05:16:49

Xref: news2.mv.net comp.os.msdos.djgpp:7426
From: Sengan Short <Sengan DOT Short AT durham DOT ac DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: __attribute__ probs
Date: 3 Aug 1996 19:09:47 GMT
Organization: University of Durham, Durham, UK.
Lines: 29
Message-ID: <4u085r$4np@mercury.dur.ac.uk>
References: <6DuayK2cWSB AT xyz DOT prima DOT ruhr DOT de>
NNTP-Posting-Host: whitby.dur.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

: I want to get rid off the 'unused variable XXX' warning messages,  
: especially in the following case:

: void Test(int a)
: {
: };

: int a is unused, of course, therefor I get a warning message. To overcome  
: this warning message I tried to use the __attribute__((unused)) in the  
: following way:

: #define UNUSED __attribute__((unused))

: void Test(int a UNUSED)
: {
: };

Try using the UNUSED in the prototype but NOT the definition:

void Test(int a UNUSED);

void Test(int a)
{
};

This works for other attributes, which have the nice property of crashing
gcc if you put them in the defintion.

Sengan

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019