Closed denizzzka closed 4 years ago
Tested on ~master with libclang 1:7.0.1-9+b2 installed on Debian
I can't reproduce that with libclang 9 on my machine after copying the C code as-is into a test. I can't reproduce it on Travis with libclang 7 either.
I can't reproduce that with libclang 9 on my machine after copying the C code as-is into a test.
Maybe it is reproduceable only if CLI is used? My test suite is only two small files:
$ cat bug.h
/* This code copied from libopencm3 project */
#define GPIO_AFR(n, af) ((af) << ((n) * 4))
#define GPIO_AFR_MASK(n) (0xf << ((n) * 4))
$ cat test.dpp
#include "bug.h"
void test() {
enum x = GPIO_AF0;
}
Run:
$ d++ --preprocess-only --keep-pre-cpp-files test.dpp
test.d.tmp:55:30: error: '#' is not followed by a macro parameter
55 | #define GPIO_AFR( n , af ) ( ( af ) << ( ( n ) * 4 ) ) #
| ^
Error: Could not run `cpp test.d.tmp`:
...
Thank you!
Problem found!
libclang
bindings settings uses just libclang
name for linking to clang library, but in Debian we haven't this name (only with version specified like libclang-8.so.1
)
And for unknown reason on my system was installed softlink from /usr/lib/libclang.so
to old external google-android-build-tools-installer
package with buggy libclang
.
Maybe it is reproduceable only if CLI is used?
That's never the case - the test suite and main function are written on purpose in such a way that they can't act differently.
Problem found!
Good!
I'm not sure about correctness of this C header code:
But for some reason it processed into:
(with trailing '#' symbol at
GPIO_AFR
)This causes error: