turning off warning messages in the source code

Gokhan Kisacikoglu kisa@centropolisfx.com
Sat Oct 5 11:11:00 GMT 2002


> After thinking about it I agree that this should be implemented, I
> wonder if it would be easy.  there should be a ((no_warn)) attribute
> for functions.  Errors would still be errors.  There have to be a
> command line switch to forcibly override this too.
> 

Good to hear that there are similar opinions...

> If you're stuck you could pipe the output of gcc to 'egrep -v'.  A bit
> of a kludge but if it was in a Makefile or script you wouldn't
> notice it.

Our quick (?) solution is to put a special comment section in each of
the source files such as;

// PRAGMA: GCC_FLAG

... code ...

and preprocess the source code to extract the proper flags, then compile
the source code with these flags, all of these are setup in our makefile
system, so it is not painfull anymore to turn these on and off from the
source code. Basically we implemented these missing features ourselves
here, yet we can only turn it on or off per source file, rather than
source code sections -it would need the source code to be broken up into
smaller files to selectively compile with specific flags. We are open to
more ingenious solutions.

Anyway, if the functionality ever gets implemented, we will simply
replace these special comments with the real ones...

> If you're trying to block "unused variable `p'" warnings you could
> give the variable the ((unused)) attribute.  That's the only GCC
> solution I can think of.

Our problem is with the c-style casts and some other stuff from a 3rd
party software that we can not alter -or we'd rather not. But I didn't
know about the "unused", I will keep that in mind too...

Thanks,
Gokhan


-- 
Gökhan Kisacikoglu    			     CFX
Sr Technical Director		     	     10950 W Washington Blvd
kisa@centropolisfx.com   310.204.7300 x263   Culver City, CA, 90232
Key: Gö(GIrd)-khan Kis(arCUS)-a-(Art)-cik(loGIC)-og(thOUGH)-lu(fLU)



More information about the Gcc-help mailing list