[llvm-bugs] [Bug 38231] New: -w does not suppress warnings promoted to errors with -Werror=…

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 19 12:29:49 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38231

            Bug ID: 38231
           Summary: -w does not suppress warnings promoted to errors with
                    -Werror=…
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bbaren at google.com
                CC: llvm-bugs at lists.llvm.org

When run with -w, GCC disables all warnings, including those which have been
explicitly promoted to errors with -Werror=warningname. Clang’s -w disables all
warnings *except* those which have been so promoted. For example:

    $ cat <<EOF >c.c
    > void f() {
    >   int x;
    >   if (x = 1) {}
    > }
    > EOF
    $ gcc -Werror=parentheses -w -c -o /dev/null c.c
    $ clang -Werror=parentheses -w -c -o /dev/null c.c
    c.c:3:9: error: using the result of an assignment as a condition without
parentheses [-Werror,-Wparentheses]
      if (x = 1) {}
          ~~^~~
    c.c:3:9: note: place parentheses around the assignment to silence this
warning
      if (x = 1) {}
            ^
          (    )
    c.c:3:9: note: use '==' to turn this assignment into an equality comparison
      if (x = 1) {}
            ^
            ==
    1 error generated.

This is already a FIXME in DiagnosticIDs.cpp
(https://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/DiagnosticIDs.cpp?revision=331834&view=markup#l460).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180719/7b11c22f/attachment.html>


More information about the llvm-bugs mailing list