Skip to content

Commit

Permalink
Explicitly check for LLVM 3.8 and 3.9 anomalies
Browse files Browse the repository at this point in the history
  • Loading branch information
kulp committed Jun 6, 2020
1 parent c360261 commit 075f1ec
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion bindgen-integration/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,16 @@ impl ParseCallbacks for MacroCallback {
*self.seen_funcs.lock().unwrap() += 1;
}
"TESTMACRO_FUNCTIONAL_EMPTY(TESTMACRO_INTEGER)" => {
assert_eq!(value, &[] as &[&[u8]]);
// Early versions of libclang behave strangely for a function
// macro that expands to nothing, giving a `#` token as the
// expansion.
if cfg!(feature = "testing_only_libclang_3_8") ||
cfg!(feature = "testing_only_libclang_3_9")
{
assert_eq!(value, &[&[b'#']]);
} else {
assert_eq!(value, &[] as &[&[u8]]);
}
*self.seen_funcs.lock().unwrap() += 1;
}
"TESTMACRO_FUNCTIONAL_TOKENIZED(a,b,c,d,e)" => {
Expand Down

0 comments on commit 075f1ec

Please sign in to comment.