[llvm-bugs] [Bug 42427] New: clanc-cl with -Xclang -isystem forgets meaning of `or`, `and`, etc.
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jun 27 10:37:41 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42427
Bug ID: 42427
Summary: clanc-cl with -Xclang -isystem forgets meaning of
`or`, `and`, etc.
Product: clang
Version: 8.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: artur.ryt at r2software.pl
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
Suppose you have two files, `main.cpp`
#include <lib.h>
int main(){}
and external library `external/include/foo.h`:
#pragma once
bool foo(int x) {
int y; // generate some warning to check whenever -isystem works
return x or x;
}
You can compile it with `clang-cl /Iexternal\include /W4 test.cpp` and it will
issue an warning about `y`.
external\include\lib.h(3,9): warning: unused variable 'y' [-Wunused-variable]
You can try to suppress it by adding `-Xclang -isystemexternal\include`, but it
will lead to strange error:
> clang-cl /Iexternal\include /W4 test.cpp -Xclang -isystemexternal\include
In file included from test.cpp:1:
external\include\lib.h(4,13): error: expected ';' after return statement
return x or x;
^
1 error generated.
It turns out that alternative tokens are breaking compilation (only) for
headers which are under `-isystem` flagged directories.
`or` in main.cpp always compiles.
I've also tested `and` and `bitand` out of
https://en.cppreference.com/w/cpp/language/operator_alternative, same result.
You can work it around with preprocessor "-Dor=||":
> clang-cl /Iexternal\include /W4 test.cpp -Xclang -isystemexternal\include "-Dor=||"
PS. I hope I've tagged this issue correctly to frontend category.
--
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/20190627/eb4a8273/attachment-0001.html>
More information about the llvm-bugs
mailing list