[LLVMbugs] [Bug 13077] -Wno-unused-parameter has no effect when used with -W

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 27 11:25:28 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13077

Chad Rosier <chad.rosier at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME

--- Comment #3 from Chad Rosier <chad.rosier at gmail.com> 2012-06-27 13:25:28 CDT ---
Checking ToT I see the following behavior:


$ more ~/t.c
extern int *c;

int foo(int *a, int *b, int *d) {
  *c = *a;
  *a = *b;
  *b = *c;
  return 0;
}

$ clang ~/t.c -c
$ clang -W ~/t.c -c
/Users/mcrosier/t.c:3:30: warning: unused parameter 'd' [-Wunused-parameter]
int foo(int *a, int *b, int *d) {
                             ^
1 warning generated.
$ clang -W -Wno-unused-parameter ~/t.c -c
$ clang -Wno-unused-parameter -W ~/t.c -c
/Users/mcrosier/t.c:3:30: warning: unused parameter 'd' [-Wunused-parameter]
int foo(int *a, int *b, int *d) {
                             ^
1 warning generated.

The precedence of the warning options is based on the last warning option
overriding earlier warning options.  Thus, -W -Wno-unused-parameter gives no
warning, while -Wno-unused-parameter -W does.  I believe this is the expected
behavior.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list