Skip to content
Snippets Groups Projects
Commit bd95745d authored by Argyrios Kyrtzidis's avatar Argyrios Kyrtzidis
Browse files

[Parser] Handle #pragma pack/align inside C structs.

Fixes PR13580. Patch by Serge Pavlov!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179743 91177308-0d34-0410-b5e6-96231b3b80d8
parent 1a7df995
No related branches found
No related tags found
No related merge requests found
......@@ -3230,6 +3230,16 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
continue;
}
if (Tok.is(tok::annot_pragma_pack)) {
HandlePragmaPack();
continue;
}
if (Tok.is(tok::annot_pragma_align)) {
HandlePragmaAlign();
continue;
}
if (!Tok.is(tok::at)) {
struct CFieldCallback : FieldCallback {
Parser &P;
......
......@@ -20,3 +20,15 @@
#pragma align=reset
#pragma align=mac68k
#pragma align=power
// PR13580
struct S
{
char a[3];
#pragma align=packed
struct T
{
char b;
int c;
} d;
};
......@@ -30,3 +30,17 @@
_Pragma("pack(push)")
/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ _Pragma("pack(push,)")
// PR13580
struct S
{
char a[3];
#pragma pack(1)
struct T
{
char b;
int c;
} d;
#pragma pack()
int e;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment