preprocessor/7029: preprocessor should ignore #warning with -M

Neil Booth
Mon Jul 1 14:08:00 GMT 2002

> IMHO, warnings generated by #warning may be omitted when not
> actually compiling code, for example when using -M to
> generate dependency lists. They seem inappropriate for this
> task.
> >How-To-Repeat:
> program> echo "#warning Warn about something" >
> program> gcc -M 
> warning: #warning Warn about something
> x.o:

Warnings are sent to stderr and the dpendency information isn't; so if
you don't want the warnings you are free to pipe stderr to /dev/null.
If you still wanted to retain errors but not warnings you can use -w,
or check the compiler return code.

So I disagree that there is any reason to change the existing behaviour,
and want to close this PR.  Do you agree, Zack?


More information about the Gcc-bugs mailing list