This is the mail archive of the gcc-bugs@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]

[Bug other/61106] New: [4.8/4.9/4.10 Regression] impliedness of -Wunused-parameter depends on -W option ordering


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

            Bug ID: 61106
           Summary: [4.8/4.9/4.10 Regression] impliedness of
                    -Wunused-parameter depends on -W option ordering
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: doko at gcc dot gnu.org

[forwarded from http://bugs.debian.org/747345]

Whether various combinations of options imply -Wunused-parameter in
the presence of -Wno-unused depends on where on the command line
-Wno-unused appears:

sid$ cat tt.c
void foo(int x) { }
sid$ gcc-4.8 -g -O2 -Wall -Wno-unused -W  -c tt.c
sid$ gcc-4.8 -g -O2 -Wall -W -Wno-unused  -c tt.c
tt.c: In function 'foo':
tt.c:1:14: warning: unused parameter 'x' [-Wunused-parameter]
 void foo(int x) { }
              ^
sid$

This is confusing, to say the least.  It doesn't appear to be
discussed in the documentation, and differs from 4.7.2:

wheezy$ gcc-4.7 -g -O2 -Wall -Wno-unused -W  -c tt.c
wheezy$ gcc-4.7 -g -O2 -Wall -W -Wno-unused  -c tt.c
wheezy$

I think this new behaviour is counterintuitive and I prefer the old
behaviour.  But if the new behaviour is considered desirable, the
exact semantics should be explained.  I did some quick experiments,
but I haven't been able to come up with a coherent explanation.

Consider, for example, this, which is all what I would have expected
but appears not to be consistent with the sid transcript above:

sid$ gcc-4.8 -g -O2 -Wunused -W  -c tt.c
tt.c: In function 'foo':
tt.c:1:14: warning: unused parameter 'x' [-Wunused-parameter]
 void foo(int x) { }
              ^
sid$ gcc-4.8 -g -O2 -W -Wunused  -c tt.c
tt.c: In function 'foo':
tt.c:1:14: warning: unused parameter 'x' [-Wunused-parameter]
 void foo(int x) { }
              ^
sid$ gcc-4.8 -g -O2 -W  -c tt.c
sid$ gcc-4.8 -g -O2 -W -Wunused -Wno-unused  -c tt.c
sid$ gcc-4.8 -g -O2 -Wunused -W -Wno-unused  -c tt.c
sid$


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