[PATCH] D18596: [MSVC] PR27132: Proper mangling for __unaligned qualifier

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 31 09:40:07 PDT 2016


aaron.ballman added a comment.

In http://reviews.llvm.org/D18596#388148, @andreybokhanko wrote:

> Aaron, Reid, David, thank you for the review!
>
> I resolved some of your comments. As for
>
> In http://reviews.llvm.org/D18596#386841, @aaron.ballman wrote:
>
> > I'd like to see some Sema tests for sanity checking; like applying __unaligned to a non-pointer type, to a declaration, when -fno-ms-extensions is enabled, etc.
>
>
> Do we want to accept __unaligned for non-pointer types, as MS compiler does? Their doc (https://msdn.microsoft.com/en-us/library/ms177389.aspx) only mentions pointers, but cl.exe also accepts non-pointers with __unaligned, with no visible effect to generated code (including mangling). Clang currently does accept this, so starting to issue an error would be a regression.


Regression is a bit of a question mark, to me depending on the diagnostic. I think warning the user "this has absolutely no effect" is a reasonable diagnostic for that situation -- the user wrote something, possibly expecting it to have an effect, and it turns out that it does absolutely nothing (including in the compiler that implements the language extension). If MSVC were to ever add semantic effect in those cases (diverging from what Clang implements), the diagnostic becomes even more important for Clang users. So I think it's fine to accept __unaligned for non-pointer types, but issue an "attribute ignored" warning diagnostic.


http://reviews.llvm.org/D18596





More information about the cfe-commits mailing list