[LLVMbugs] [Bug 8607] New: "argument unused during compilation" warning unclear

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Nov 15 06:48:47 PST 2010


           Summary: "argument unused during compilation" warning unclear
           Product: clang
           Version: 2.8
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: llvmbugs at cs.uiuc.edu

Our build system sometimes compiles files with "clang -O2 -O0 -c". When it does
so, clang produces this warning:

clang: warning: argument unused during compilation: '-O2'

There are a few things which could be improved here.
 * The warning is inaccurate, in a sense: the argument isn't unused so much as
 * This is the sort of warning I'd expect to get if I combine -E with -O2, but
clang doesn't seem to warn for that.
 * We haven't specified -fno-diagnostics-show-option, so I'd expect for this
message to tell me how to turn this warning off.
 * This warning is not produced if the linker is being invoked (and indeed -O2
-O0 is passed to the linker in this case).
 * It's not always obvious what the command-line was.

I'd prefer something like this:

<command-line>:1:6: warning: argument '-O2' overridden by '-O0'
clang -O2 -c test.cpp -o test -O0 -g
      ^~~                     ~~~

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