forked from cil-project/cil
-
Notifications
You must be signed in to change notification settings - Fork 21
Add C11 generic support #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 19 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
203f283
Add C11 generic to Cabs and CIL
coslu d9a7510
Fix C11 generic warnings
coslu 0067d37
Remove C11 generic from CIL
sim642 a7cf7e4
Rewrite C11 generic Cabs2cil to resolve generic switch
sim642 ddd59c1
Implement C11 generic Cabsvisit
sim642 76e9c83
Remove now unnecessary stripParenLocal from C11 generic Cabs2cil
sim642 005a453
Move Cabs2cil.stripParenLocal back to its old location
sim642 e58de49
Add comments about C11 generic
sim642 50c02c9
Add failing generic test
michael-schwarz 041c7cf
fix error numbers
michael-schwarz 962dc8a
Add type qualifier attribute compatibility check and strip to combine…
sim642 5f1b78e
Add type qualifier attribute strip to C11 generic combineTypes
sim642 c2f6339
Add type qualifier attribute strip to function argument combineTypes
sim642 7cdf8ad
Fix make test printing annoying raw output
sim642 0b162ca
Fix raw test output in CI
sim642 9a17ba2
Fix raw test output failing successful tests in CI
sim642 9473315
Fix make test failure exit code
sim642 19238f0
Remove useless raw log step in CI
sim642 06a878c
Remove invalid test with conflicting type qualifiers
sim642 b4bd664
Document some type functions in Cabs2cil
sim642 2add3ca
Update comments about C11 generic in Cabs2cil.doExp
sim642 a6ef80d
Remove outdated comments in small1/c11-generic test
sim642 897aba2
Move qualifier attributes functions from Cabs2cil to Cil
sim642 5e9a2f6
Port type qualifier fixes from Cabs2cil.combineTypes to Mergecil.comb…
sim642 e67879d
Expand Mergecil.combineTypes different type qualifiers message
sim642 46c6a0a
Fix combineTypes dropping type qualifiers
sim642 dd8f2f2
Add C11 generic string literal test
sim642 919c0f8
Add C11 generic test where pointer type fails
sim642 66b5e81
Fix parsing of pointer types in C11 generic associations
sim642 f703a1c
Remove const_string_literals from Machdep
sim642 afafead
Remove ref from Cil.stringLiteralType
sim642 e84b98b
Expose Cil.stringLiteralType in signature
sim642 8fc4cc4
Disable broken macOS CI
sim642 0177bfd
Add C11 generic test where expression without parenthesis breaks
sim642 8d5204a
Fix C11 generic Cabsvisit dropping simple GENERIC
sim642 ba391a8
Add C11 generic GCC test 1
sim642 b13180b
Add C11 generic GCC test 2
sim642 2be7157
Add C11 generic GCC test 3
sim642 79a4579
Add main functions to C11 generic GCC tests to prevent failure from GCC
sim642 1983c12
Disable gcc-c11-generic-2-6 test
sim642 39d8442
Add C11 generic Clang tests
sim642 ce4f4f7
Fix pointer qualifier handling in ternary operator typing
sim642 46e4f05
Fix Cil.isNullPtrConstant to only allow void* casts
sim642 7a7e1e4
Refactor integer 0 handling in ternary operator typing
sim642 3dfa002
Add missing void case to ternary operator typing
sim642 6674fd1
Add separate pconst attribute for tracking whether to print const
sim642 544dbfc
Revert "Disable broken macOS CI"
sim642 7606d26
Fix Cprint print_generic_list only printing first association
sim642 e47e4ad
Simplify Cabs2cil.stripConstLocalType
sim642 f70e708
Merge branch 'develop' into c11-generic
sim642 a0a1a94
Add C11 _Generic to CHANGES
sim642 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,27 @@ | ||
| #include "testharness.h" | ||
| #define type1(x) _Generic((x), char: 1, unsigned int:2, default:0) | ||
| #define type2(x) _Generic((x), char: 1, unsigned int:2, const int:3, default:0) | ||
|
|
||
| // This fails to compile but is perfectly legal, since int and const int are not compatible | ||
| #define type3(x) _Generic((x), int:1, const int:2, default:0) | ||
|
|
||
| int main() { | ||
| unsigned char v_uchar; | ||
| char v_char; | ||
| int v_int; | ||
| const int v_intconst; | ||
|
|
||
| if(type1(v_int) != 0) { E(1); } | ||
| if(type1(v_uchar) != 0) { E(2); } | ||
| if(type1(v_char) != 1) { E(3); } | ||
|
|
||
| if(type2(v_int) != 0) { E(4); } // This fails but should succeed | ||
| if(type2(v_intconst) != 0) { E(5); } // This fails but should succeed | ||
| if(type3(v_int) != 1) { E(6); } | ||
| if(type3(v_intconst) != 1) { E(7); } | ||
|
|
||
| if(type3((const int)v_int) != 1) { E(8); } | ||
| if(type3((const int)v_intconst) != 1) { E(9); } | ||
|
|
||
| SUCCESS; | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this TODO resolved now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect not, but I don't know what it's precedence is even supposed to be because it's not even listed here: https://en.cppreference.com/w/c/language/operator_precedence.
Also, I'm not sure the rest are right either. Most of the additions have been copy-pasted all with precedence 16, but that doesn't match at all with the precedence table comment above or the table on cppref.