[LLVMbugs] [Bug 14280] New: warning correct does not handle -Wno options correctly

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Nov 7 09:06:18 PST 2012


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

             Bug #: 14280
           Summary: warning correct does not handle -Wno options correctly
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: chris at bubblescope.net
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9504
  --> http://llvm.org/bugs/attachment.cgi?id=9504
Example patch fixing '-Wno' handling

clang does a bad job of giving recommendations on misformed '-Wno' options.
Basically if an option doesn't start with '-Wno-', it can never match a '-Wno-'
option.

Consider:

$ clang++ -Wbrc
clang: warning: unknown warning option '-Wbrc'; did you mean '-Warc'?
$ clang++ -Wno-brc
clang: warning: unknown warning option '-Wno-brc'; did you mean '-Wno-arc'?
$ clang++ -Wnobrc
clang: warning: unknown warning option '-Wnobrc'; did you mean '-Warc'?
$ clang++ -Wnoarc
clang: warning: unknown warning option '-Wnoarc'; did you mean '-Warc'?

I attach a patch which takes an attempt at fixing this problem. However, I
realised that I'm not really 100% sure about quite a few parts of the clang
coding standard, so I suspect this isn't acceptably finished. In particular I'm
worried I'm breaking the internationalisation. In Warnings.cpp, the two terms
diag::warn_unknown_warning_option_suggest and
diag::warn_unknown_negative_warning_option_suggest look identical to me, so I
was tempted to remove one. But, I assume there is a reason for two of them?

However, this patch does give:

$ clang++ -Wnobrc
clang: warning: unknown warning option '-Wnobrc'; did you mean '-Wno-arc'?
$ clang++ -Won-arc
clang: warning: unknown warning option '-Won-arc'; did you mean '-Wno-arc'?

-- 
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