-
Notifications
You must be signed in to change notification settings - Fork 273
C23 keywords #8623
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
C23 keywords #8623
Conversation
cbba9f8
to
b949d48
Compare
Asking here so as not to delay #8621 any further:
|
Also, while working on this piece of code we might fix #8308? |
Yes, some tokens come with an IREP and some don't -- and it's prone to error to keep that in sync. I am minded to give an IREP to all identifier-like tokens to remove that ambiguity.
For clarity, could be renamed to |
67cd3f5
to
1de6619
Compare
Yes, but not what I was after: |
|
54026f1
to
7c8b661
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #8623 +/- ##
===========================================
- Coverage 80.38% 80.37% -0.02%
===========================================
Files 1686 1686
Lines 206764 206872 +108
Branches 75 73 -2
===========================================
+ Hits 166207 166268 +61
- Misses 40557 40604 +47 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ddec5f3
to
a556e81
Compare
// C23 introduces the "static_assert" keyword. | ||
|
||
struct S | ||
{ | ||
// Visual Studio does not support static_assert in compound bodies. | ||
#ifndef _MSC_VER | ||
static_assert(1, "in struct"); | ||
#endif | ||
int x; | ||
} asd; | ||
|
||
static_assert(1, "global scope"); | ||
|
||
int main() | ||
{ | ||
static_assert(1, "in function"); | ||
} |
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.
Shouldn't this go in the ansi-c
regression test folder instead of cbmc
?
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.
Yes, that was my first attempt. But we run various compilers over that folder, and they don't do C23.
typedef int INTTYPE; | ||
|
||
int func1(); | ||
|
||
// C23 typeof | ||
typeof(int) v1; | ||
typeof(INTTYPE) v2; | ||
typeof(v2) v3; | ||
typeof(1 + 1) v4; | ||
typeof(1 + 1 + func1()) v5; | ||
const typeof(int) v6; | ||
typeof(int) const v7; | ||
static typeof(int) const v8; | ||
static typeof(int) const *v9; | ||
static volatile typeof(int) const *v10; | ||
|
||
void func2(typeof(int) *some_arg) | ||
{ | ||
} | ||
|
||
int main() | ||
{ | ||
} |
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.
Should probably go in ansi-c
?
return integer2string(binary2integer(binary, false)); | ||
} | ||
else | ||
return convert_norep(src, precedence); |
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 think previously this would handle __CPROVER_bitvector
in some way?
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.
Those map to signedbv
/unsignedv
.
45c3fe6
to
5a39bdd
Compare
669e233
to
0c3d48c
Compare
6ee8f9d
to
d070209
Compare
This adds scanner, parser and typechecker support for the new C23 keywords.
exprt assertion = | ||
typecast_exprt::conditional_cast(code.op0(), bool_typet()); | ||
simplify(assertion, ns); | ||
INVARIANT_WITH_DIAGNOSTICS( | ||
!assertion.is_false(), | ||
"static assertion " + id2string(get_string_constant(code.op1())), | ||
"static assertion is false", |
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.
Hmm, shouldn't we keep the message when there is one?
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.
This should never be executed, and is presumably dead code.
This adds scanner, parser and typechecker support for the new C23 keywords.