RFC: flag to toggle support for __declspec

Aaron Ballman aaron at aaronballman.com
Wed Jul 15 16:25:22 PDT 2015


In previous versions of Clang, __declspec attribute support was
enabled by default for all targets. This was rectified in r238238 so
that you had to turn on Microsoft or Borland mode to enable support
for __declspec, as we determined we did not want it to be a core
language extension of Clang. However, there are some users that would
like the ability to use __declspec without turning on all rest of the
Microsoft language extensions. For instance, CUDA uses
__declspec(property) in some of its implementation headers, and SCE
would like to enable it for Playstation code as well.

To that end, I am wondering there is any push-back with the idea of
adding a flag to enable support for only __declspec. Then other flag
or targets can enable this automatically as-needed, but it also allows
the user to disable the functionality if they would prefer a more
conforming mode for their compilations.

Options for bikeshedding the name of the flag: -fattr-declspec,
-fdeclspec-attr, -fdeclspec, -f__declspec

~Aaron



More information about the cfe-commits mailing list