[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: simple gcc question



On Sun, Apr 29, 2001, Mike G wrote:
> 
> Hi!
> 
> 	How do I disablw warnings in gcc, for a piece of code?
> I compile with -Wall
> 
> but there are 3 lines I'd like to skip
> something like
> #warn off
> line 1
> line 2
> line 3
> #warn on
> 
> I've been searching info and google, and found nothing,
> pointers to documentation will gladly be dereferenced :)
> 
> thanks

Mike,

I don't think you can do what you hope to do.  The syntax you're
suggesting seems to imply preprocessor directives, but these are
completed before the code ever gets to the compiler, so I would think
that in order to turn off warnings for a section of your code there
would have to be defined ansi c syntax for disabling it in that
portion.  I'd think that there is not that syntax.  My guess is you'll
have to either live with the warnings, fix what it's warning you
about, turn off -Wall so it doesn't warn you anywhere, or turn on a
smaller subset of warnings (see all the -W flags in the manpage) that
maybe refines what you want.  My guess is you might have to live with
it.  Of course, maybe I'm just wrong or don't understand your
question.

Hope this helps.  Take care,

Daniel


-- 
Daniel A. Freedman
Laboratory for Atomic and Solid State Physics
Department of Physics
Cornell University



Reply to: