Skip to content

Commit

Permalink
Add a simpler empty-function test case
Browse files Browse the repository at this point in the history
  • Loading branch information
kulp committed Jun 6, 2020
1 parent 075f1ec commit 33beb80
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion bindgen-integration/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ impl ParseCallbacks for MacroCallback {
}
*self.seen_funcs.lock().unwrap() += 1;
}
"TESTMACRO_FUNCTIONAL_EMPTY_SIMPLE_ARG(x)" => {
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)" => {
assert_eq!(
value,
Expand Down Expand Up @@ -128,7 +138,7 @@ impl Drop for MacroCallback {
);
assert_eq!(
*self.seen_funcs.lock().unwrap(),
4,
5,
"func_macro handle was not called once for all relevant macros"
);
}
Expand Down
1 change: 1 addition & 0 deletions bindgen-integration/cpp/Test.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// different.
#define TESTMACRO_NONFUNCTIONAL (TESTMACRO_INTEGER)
#define TESTMACRO_FUNCTIONAL_EMPTY(TESTMACRO_INTEGER)
#define TESTMACRO_FUNCTIONAL_EMPTY_SIMPLE_ARG(x)
#define TESTMACRO_FUNCTIONAL_NONEMPTY(TESTMACRO_INTEGER)-TESTMACRO_INTEGER
// Unusual spacing in the following macro is intentional, to demonstrate
// reformatting after tokenization.
Expand Down

0 comments on commit 33beb80

Please sign in to comment.