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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 16 06:45:26 PDT 2016


aaron.ballman added a comment.

In http://reviews.llvm.org/D17709#374561, @rnk wrote:

> Unless there is a compelling example of Microsoft or a popular third-party header relying on this behavior, I don't think we should implement it.


Agreed.


================
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) ||
----------------
olga.a.chupina wrote:
> 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.
I'm not keen on inferring undocumented behaviors from MSVC keywords; we should only accept if there's some reason to do so (we don't want to hijack MSVC's keyword and give it different behavior than MSVC).


http://reviews.llvm.org/D17709





More information about the cfe-commits mailing list