Skip to content

Commit 33beb80

Browse files
committed
Add a simpler empty-function test case
1 parent 075f1ec commit 33beb80

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

bindgen-integration/build.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,16 @@ impl ParseCallbacks for MacroCallback {
9595
}
9696
*self.seen_funcs.lock().unwrap() += 1;
9797
}
98+
"TESTMACRO_FUNCTIONAL_EMPTY_SIMPLE_ARG(x)" => {
99+
if cfg!(feature = "testing_only_libclang_3_8") ||
100+
cfg!(feature = "testing_only_libclang_3_9")
101+
{
102+
assert_eq!(value, &[&[b'#']]);
103+
} else {
104+
assert_eq!(value, &[] as &[&[u8]]);
105+
}
106+
*self.seen_funcs.lock().unwrap() += 1;
107+
}
98108
"TESTMACRO_FUNCTIONAL_TOKENIZED(a,b,c,d,e)" => {
99109
assert_eq!(
100110
value,
@@ -128,7 +138,7 @@ impl Drop for MacroCallback {
128138
);
129139
assert_eq!(
130140
*self.seen_funcs.lock().unwrap(),
131-
4,
141+
5,
132142
"func_macro handle was not called once for all relevant macros"
133143
);
134144
}

bindgen-integration/cpp/Test.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
// different.
1111
#define TESTMACRO_NONFUNCTIONAL (TESTMACRO_INTEGER)
1212
#define TESTMACRO_FUNCTIONAL_EMPTY(TESTMACRO_INTEGER)
13+
#define TESTMACRO_FUNCTIONAL_EMPTY_SIMPLE_ARG(x)
1314
#define TESTMACRO_FUNCTIONAL_NONEMPTY(TESTMACRO_INTEGER)-TESTMACRO_INTEGER
1415
// Unusual spacing in the following macro is intentional, to demonstrate
1516
// reformatting after tokenization.

0 commit comments

Comments
 (0)