Skip to content

Commit 075f1ec

Browse files
committed
Explicitly check for LLVM 3.8 and 3.9 anomalies
1 parent c360261 commit 075f1ec

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

bindgen-integration/build.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,16 @@ impl ParseCallbacks for MacroCallback {
8383
*self.seen_funcs.lock().unwrap() += 1;
8484
}
8585
"TESTMACRO_FUNCTIONAL_EMPTY(TESTMACRO_INTEGER)" => {
86-
assert_eq!(value, &[] as &[&[u8]]);
86+
// Early versions of libclang behave strangely for a function
87+
// macro that expands to nothing, giving a `#` token as the
88+
// expansion.
89+
if cfg!(feature = "testing_only_libclang_3_8") ||
90+
cfg!(feature = "testing_only_libclang_3_9")
91+
{
92+
assert_eq!(value, &[&[b'#']]);
93+
} else {
94+
assert_eq!(value, &[] as &[&[u8]]);
95+
}
8796
*self.seen_funcs.lock().unwrap() += 1;
8897
}
8998
"TESTMACRO_FUNCTIONAL_TOKENIZED(a,b,c,d,e)" => {

0 commit comments

Comments
 (0)