Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-w does not suppress warnings promoted to errors with -Werror=… #37579

Closed
llvmbot opened this issue Jul 19, 2018 · 1 comment
Closed

-w does not suppress warnings promoted to errors with -Werror=… #37579

llvmbot opened this issue Jul 19, 2018 · 1 comment
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 19, 2018

Bugzilla Link 38231
Resolution FIXED
Resolved on Jan 29, 2019 11:35
Version trunk
OS All
Reporter LLVM Bugzilla Contributor
CC @jyknight

Extended Description

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

@jyknight
Copy link
Member

Fixed with
3f8b916

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category
Projects
None yet
Development

No branches or pull requests

2 participants