File tree 3 files changed +21
-5
lines changed
3 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -87,17 +87,19 @@ impl ClangSubItemParser for Var {
87
87
88
88
assert ! ( !id. is_empty( ) , "Empty macro name?" ) ;
89
89
90
- if ctx. parsed_macro ( & id) {
91
- let name = String :: from_utf8 ( id) . unwrap ( ) ;
92
- warn ! ( "Duplicated macro definition: {}" , name) ;
93
- return Err ( ParseError :: Continue ) ;
94
- }
90
+ let previously_defined = ctx. parsed_macro ( & id) ;
95
91
96
92
// NB: It's important to "note" the macro even if the result is
97
93
// not an integer, otherwise we might loose other kind of
98
94
// derived macros.
99
95
ctx. note_parsed_macro ( id. clone ( ) , value. clone ( ) ) ;
100
96
97
+ if previously_defined {
98
+ let name = String :: from_utf8 ( id) . unwrap ( ) ;
99
+ warn ! ( "Duplicated macro definition: {}" , name) ;
100
+ return Err ( ParseError :: Continue ) ;
101
+ }
102
+
101
103
// NOTE: Unwrapping, here and above, is safe, because the
102
104
// identifier of a token comes straight from clang, and we
103
105
// enforce utf8 there, so we should have already panicked at
Original file line number Diff line number Diff line change
1
+ /* automatically generated by rust-bindgen */
2
+
3
+
4
+ #![ allow( non_snake_case) ]
5
+
6
+
7
+ pub const FOO : :: std:: os:: raw:: c_uint = 4 ;
8
+ pub const BAR : :: std:: os:: raw:: c_uint = 5 ;
9
+ pub const BAZ : :: std:: os:: raw:: c_uint = 6 ;
Original file line number Diff line number Diff line change
1
+ #define FOO 4
2
+ #define BAR (1 + FOO)
3
+ #undef FOO
4
+ #define FOO 5
5
+ #define BAZ (1 + FOO)
You can’t perform that action at this time.
0 commit comments