-
Notifications
You must be signed in to change notification settings - Fork 713
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to single precompiled header in macro fallback
It appears that Clang only supports a single precompiled header at a time. Because the macro fallback depends on the ability to provide multiple precompiled headers at once, this commit changes the code to include all provided headers into a single header to precompile and then pass to the TranslationUnit. This should resolve the issue where the macro fallback would not function as intended when multiple headers were provided as input. This commit also resolves an issue where clang args passed to the builder were not forwarded to the precompilation translation unit, resulting in headers not in standard system directories not being found.
- Loading branch information
Showing
8 changed files
with
174 additions
and
49 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
bindgen-tests/tests/expectations/tests/libclang-9/macro_fallback_non_system_dir.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
bindgen-tests/tests/expectations/tests/test_macro_fallback_non_system_dir.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
// bindgen-flags: --clang-macro-fallback | ||
|
||
#ifndef ISSUE_753_H | ||
#define ISSUE_753_H | ||
|
||
#define UINT32_C(c) c ## U | ||
|
||
#define CONST UINT32_C(5) | ||
#define OTHER_CONST UINT32_C(6) | ||
#define LARGE_CONST UINT32_C(6 << 8) | ||
|
||
#endif |
10 changes: 10 additions & 0 deletions
10
bindgen-tests/tests/macro_fallback_test_headers/another_header.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef ANOTHER_HEADER_H | ||
#define ANOTHER_HEADER_H | ||
|
||
#include <issue-753.h> | ||
|
||
#define SHOULD_NOT_GENERATE UINT64_C(~0) | ||
#define MY_CONST UINT32_C(69) | ||
#define NEGATIVE ~0 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef ONE_HEADER_H | ||
#define ONE_HEADER_H | ||
|
||
#include <issue-753.h> | ||
|
||
#define THE_CONST UINT32_C(28) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters