[PATCH] D33852: Enable __declspec(selectany) on linux

Martell Malone via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 3 16:59:47 PDT 2017


martell added a comment.

> ! In https://reviews.llvm.org/D33852#772290, @davide wrote:
>  This assumption is not quite right. Also GCC, when targeting Linux, provides a `-fms-extensions` flag.
>  There's a bunch of software out there that unfortunately has to target ELF and build with `-fms-extensions` on, e.g. PS4.

Seems like bad practice but on a second look that is does appear that PS4 and CUDA both use `-fms-extensions` and rely on it for some things. argh
CUDA does have a note to move off this in future.
Thanks for clarifying davide

This patch does LGTM minus the nit above.
Adding `selectany` spelling to `-fdeclspec` as well as `-fms-extensions` should cover all use cases.
The MachO issue would have been present before `rL300562` so I don't think that should have to be fixed here.
It could be covered in a follow up differential as this fixes a regression on my part.



================
Comment at: test/Sema/attr-selectany.c:3
 // RUN: %clang_cc1 -triple x86_64-mingw32 -verify %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -verify -fms-extensions %s
 
----------------
Based on the current changes you can change `-fms-extensions` to `-fdeclspec`
The `-fms-extensions` coverage is covered in `attr-selectany.cpp` below


https://reviews.llvm.org/D33852





More information about the cfe-commits mailing list