[PATCH] D17709: [MSVC Compat] Support for '__unaligned' attribute in function declaration

Olga Chupina via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 16 01:43:11 PDT 2016


olga.a.chupina added inline comments.

================
Comment at: lib/Parse/ParseDecl.cpp:4811
@@ -4810,2 +4810,3 @@
     case tok::kw___unaligned:
-      if (AttrReqs & AR_DeclspecAttributesParsed) {
+      // Allow __unaligned in function definition after a parameter list
+      if ((AttrReqs & AR_DeclspecAttributesParsed) ||
----------------
aaron.ballman wrote:
> MSDN suggests that __unaligned is only valid on a pointer declaration. Is there something this is expected to support, or does MSVC just happen to silently accept the keyword in this position?
It rather silently accepts the keyword in this position.

================
Comment at: lib/Parse/ParseDecl.cpp:4813
@@ -4812,1 +4812,3 @@
+      if ((AttrReqs & AR_DeclspecAttributesParsed) ||
+          (Tok.getKind() == tok::kw___unaligned)) {
         ParseMicrosoftTypeAttributes(DS.getAttributes());
----------------
rnk wrote:
> This will allow __unaligned in a variety of other locations where we shouldn't accept it.
Could you please help me with narrowing it down to the case I'm interested in?


http://reviews.llvm.org/D17709





More information about the cfe-commits mailing list