Should warnings be issued for unrecognised pragmas ?
Donald Koch
koch@cognex.com
Fri Oct 17 15:06:00 GMT 1997
> > Date: Fri, 17 Oct 1997 14:59:46 -0400
> > From: Donald Koch <koch@cognex.com>
> >
> > > I am currently writting a patch for gcc2 that implements a new command
> > > line option '-wunrecognised-pragmas' which will cause warning messages
> > > to be generated when GCC encounters pragmas which is does not handle.
> > > At the moment this patch also enables these warnings if -Wall is
> > > enabled, expect for the case where the pragmas are in system header
> > > files. Is this the right thing to do ?
> >
> > If you mean by "this", enabling it with -Wall, no.
> >
> > Consider the use of "-Werror -Wall", where the desired effect is to
> > make sure there are no iffy constructs in the code; would failure
> > to compile because there was an unrecognized pragma which is needed
> > for some other compiler/platform be desirable?
>
> No, but failure to compile because the code contained an unrecognised
> pragma which was intended to effect code generation is desirable. Of
> course to achieve the effect you want you can do this:
>
> -Werror -Wall -Wno-unrecognised-pragmas
>
>
> > -Wall check for too many useful things, which is what it should do.
>
> Sorry, I do not understand that sentance.
[...]
> Nick
Sorry, brain slipped out gear mid-sentence. -Wall should check for
the most useful warnings. Adding too many will make it unusable.
The question basically is: is -Wunrecognised-pragmas going to be used
much more often than not when -Wall is used? I don't want to have to
be adding too many -Wno-... flags. (Maybe we should add a -Wsome
or -Wmost flag? ;-) I guess it depends on what is meant by "all".
(According to the documentation, this would be determined by whether
-Wunreconised-pragmas came before or after the description of -Wall.)
I take it that we are targetting some specific pragmas. Which ones?
-d
More information about the Gcc
mailing list