mirror of
https://github.com/cc65/cc65.git
synced 2024-06-22 17:29:34 +00:00
Added support for _Static_assert in unions.
This commit is contained in:
parent
fef8436eb4
commit
991af3755b
|
@ -888,6 +888,13 @@ static SymEntry* ParseUnionDecl (const char* Name, unsigned* DSFlags)
|
||||||
/* Get the type of the entry */
|
/* Get the type of the entry */
|
||||||
DeclSpec Spec;
|
DeclSpec Spec;
|
||||||
int SignednessSpecified = 0;
|
int SignednessSpecified = 0;
|
||||||
|
|
||||||
|
/* Check for a _Static_assert */
|
||||||
|
if (CurTok.Tok == TOK_STATIC_ASSERT) {
|
||||||
|
ParseStaticAssert ();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
InitDeclSpec (&Spec);
|
InitDeclSpec (&Spec);
|
||||||
ParseTypeSpec (&Spec, -1, T_QUAL_NONE, &SignednessSpecified);
|
ParseTypeSpec (&Spec, -1, T_QUAL_NONE, &SignednessSpecified);
|
||||||
|
|
||||||
|
@ -1030,6 +1037,7 @@ static SymEntry* ParseStructDecl (const char* Name, unsigned* DSFlags)
|
||||||
|
|
||||||
/* Get the type of the entry */
|
/* Get the type of the entry */
|
||||||
DeclSpec Spec;
|
DeclSpec Spec;
|
||||||
|
int SignednessSpecified = 0;
|
||||||
|
|
||||||
/* Check for a _Static_assert */
|
/* Check for a _Static_assert */
|
||||||
if (CurTok.Tok == TOK_STATIC_ASSERT) {
|
if (CurTok.Tok == TOK_STATIC_ASSERT) {
|
||||||
|
@ -1037,7 +1045,6 @@ static SymEntry* ParseStructDecl (const char* Name, unsigned* DSFlags)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SignednessSpecified = 0;
|
|
||||||
InitDeclSpec (&Spec);
|
InitDeclSpec (&Spec);
|
||||||
ParseTypeSpec (&Spec, -1, T_QUAL_NONE, &SignednessSpecified);
|
ParseTypeSpec (&Spec, -1, T_QUAL_NONE, &SignednessSpecified);
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,13 @@ struct S {
|
||||||
int b;
|
int b;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* _Static_assert can also appear in unions. */
|
||||||
|
union U {
|
||||||
|
int a;
|
||||||
|
_Static_assert (1, "1 should still be true.");
|
||||||
|
int b;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
int main (void)
|
int main (void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user