[PATCH] Fix to PR13580 - Problem in preprocessing pragma with block comments

Serge Pavlov sepavloff at gmail.com
Wed Apr 3 11:05:57 PDT 2013


sepavloff added you to the CC list for the revision "Fix to PR13580 - Problem in preprocessing pragma with block comments".

This patch fixes PR13580 - Problem in preprocessing pragma with block comments.

Could someone please review this patch?
Thank you.

http://llvm-reviews.chandlerc.com/D619

Files:
  lib/Parse/ParseDecl.cpp
  test/Parser/pragma-options.c
  test/Parser/pragma-pack.c

Index: lib/Parse/ParseDecl.cpp
===================================================================
--- lib/Parse/ParseDecl.cpp
+++ lib/Parse/ParseDecl.cpp
@@ -3100,6 +3100,16 @@
       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;
Index: test/Parser/pragma-options.c
===================================================================
--- test/Parser/pragma-options.c
+++ test/Parser/pragma-options.c
@@ -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;
+};
Index: test/Parser/pragma-pack.c
===================================================================
--- test/Parser/pragma-pack.c
+++ test/Parser/pragma-pack.c
@@ -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;
+};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D619.2.patch
Type: text/x-patch
Size: 1307 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130403/e651b097/attachment.bin>


More information about the cfe-commits mailing list