Skip to content

clang generates warnings if use preprocessed files. #29877

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

Closed
llvmbot opened this issue Sep 26, 2016 · 1 comment
Closed

clang generates warnings if use preprocessed files. #29877

llvmbot opened this issue Sep 26, 2016 · 1 comment
Labels
bugzilla Issues migrated from bugzilla clang:frontend Language frontend issues, e.g. anything involving "Sema" wontfix Issue is real, but we can't or won't fix it. Not invalid

Comments

@llvmbot
Copy link
Member

llvmbot commented Sep 26, 2016

Bugzilla Link 30529
Resolution WONTFIX
Resolved on Sep 26, 2016 16:24
Version unspecified
OS Linux
Blocks #24719
Reporter LLVM Bugzilla Contributor
CC @zygoloid

Extended Description

#define T(x) (x==1)

int main(){
int x = 1;
if (T(x)) {
return 0;}
return 1;
}

clang -Wall a.c returns no warning.

clang a.c -E > a.i

clang -Wall a.i

returns

a.c:5:9: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((x==1)) {
~^~~
a.c:5:9: note: remove extraneous parentheses around the comparison to silence this warning
if ((x==1)) {
~ ^ ~
a.c:5:9: note: use '=' to turn this equality comparison into an assignment
if ((x==1)) {
^~
=
1 warning generated.

@zygoloid
Copy link
Mannequin

zygoloid mannequin commented Sep 26, 2016

We do not consider this to be a bug. We have heuristics in our warnings that depend on whether the tokens come from a macro expansion, so it is expected that preprocessed source will sometimes produce different warnings.

If you want to avoid this, use -E -frewrite-includes instead of just -E.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@Quuxplusone Quuxplusone added the wontfix Issue is real, but we can't or won't fix it. Not invalid label Jan 20, 2022
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:frontend Language frontend issues, e.g. anything involving "Sema" wontfix Issue is real, but we can't or won't fix it. Not invalid
Projects
None yet
Development

No branches or pull requests

2 participants