This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] RFC: Enabling -W[no-]error=... for cpplib warnings


On Mon, Oct 26, 2009 at 5:01 PM, Simon Baldwin <simonb@google.com> wrote:
> At present in gcc, warnings emitted by cpplib can't be controlled in
> the same way as those emitted by the C/C++ compiler proper.? For
> example, -Werror=attributes will work, because attributes warnings are
> issued by the main compiler, but -Werror=multichar won't because it's
> handled in cpplib:
>
> ?$ cat /tmp/x.c
> ?int foo __attribute__((invalid));
> ?const char bar = 'bar';
> ?$ gcc -fdiagnostics-show-option -Werror=attributes -Werror=multichar
> -Wno-overflow -o /dev/null -c /tmp/x.c
> ?/tmp/x.c:1: error: ‘invalid’ attribute directive ignored [-Wattributes]
> ?/tmp/x.c:2:18: warning: multi-character character constant
>
> I'm working on a patch to address this for cpplib warnings that can be
> attributed directly to gcc command line -W options, so that now:
>
> ?$ gcc/xgcc -Bgcc -fdiagnostics-show-option -Werror=attributes
> -Werror=multichar -Wno-overflow -o /dev/null -c /tmp/x.c
> ?/tmp/x.c:1:1: error: ‘invalid’ attribute directive ignored [-Wattributes]
> ?/tmp/x.c:2:18: error: multi-character character constant [-Wmultichar]
>
> The patch also adds a -Wno-warning-directive to control #warning, so
> that warning directives can participate in -Werror= (so that
> combinations like "-Werror -Wno-error=warning-directive" will work as
> expected).

#warning is a mechanism people use to display warning at the CPP level.
The patch does not warn about that mechanism itself, right?

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]