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: unassignedclangb...@nondot.org
          Reporter: bba...@google.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to