Consider this code snippet:
cat x.c
struct test {
        void *tst;
};
struct yy {
        void **z;
};
int foo(struct test *x)
{
        struct yy y[] ={
                {       (void**) &x->tst }
        };
        return 0;
}

$ gcc x.c -c -pedantic
x.c: In function ‘foo’:
x.c:10: warning: initializer element is not computable at load time
x.c:10: warning: initializer element is not computable at load time

I now use -Werror:

$ gcc -Werror x.c -c -pedantic
cc1: warnings being treated as errors
x.c: In function ‘foo’:
x.c:10: error: initializer element is not computable at load time
x.c:10: error: initializer element is not computable at load time

This is fine, but now I want -Werror (perhaps because I use -Wall or some other
-W flags), but I don't want warnings from -pedantic to be errors (but I still
want to see them!):
$ gcc -Wall x.c -c -pedantic -Werror -Wno-error=pedantic
cc1: error: -Werror=pedantic: No option -Wpedantic

This doesn't work, and I see no other way to downgrade -pedantic to warning
after I used -Werror.


-- 
           Summary: please provide a way to treat -pedantic as warning when
                    using -Werror
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: edwintorok at gmail dot com
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37187

Reply via email to