-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the C lowering for
RecordLift
to be compatible with C++. (#902)
* Fix the C lowering for `RecordLift` to be compatible with C++. C++ prohibits non-constant struct literal initializers from being implicitly converted to narrower types, so insert explicit casts. This allows the generated code to be compiled as both C and C++. Specifically, this fixes the following error in C++: ``` test.c:40:5: error: non-constant-expression cannot be narrowed from type 'int32_t' (aka 'int') to 'enum_t' (aka 'unsigned char') in initializer list [-Wc++11-narrowing] ``` While debugging this, I also tidied up some redundant parens in `load_ext`. * Add `-Wc++compat` to the test compiler flags. * Fix more C++ compilation errors and compile the tests in C++ mode too. Compile the C tests in C++ too, and fix several compilation errors that this uncovered. * Minor whitespace tidying.
- Loading branch information
1 parent
53e07c7
commit f4851bb
Showing
7 changed files
with
150 additions
and
106 deletions.
There are no files selected for viewing
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
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
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