diff --git a/bindgen-integration/build.rs b/bindgen-integration/build.rs index d74c81bddc..342b2cff45 100644 --- a/bindgen-integration/build.rs +++ b/bindgen-integration/build.rs @@ -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)" => {