[PATCH] Implement __declspec(selectany) under -fms-extensions

Rafael EspĂ­ndola rafael.espindola at gmail.com
Fri May 17 12:50:16 PDT 2013


On 17 May 2013 15:44, Reid Kleckner <rnk at google.com> wrote:
> MSVC accepts
>
> static int x7;
> extern __declspec(selectany) int x7;
>
> But it also accepts
>
> static int x7;
> extern int x7;

It should, we also do :-)

In the case with __declspec(selectany), is x7 transformed into a
externally visible symbol or the attribute just ignored?

> That seems like a separate issue.  It doesn't seem that important to me to
> accept this.
>
> Clang errors out with 'attribute declaration must precede definition', which
> doesn't seem useful to have in that test.

It is nice to have a test that there in an error, just to make sure we
don't extend a microsoft extension.

> OK to commit as is?

OK with the test. There is a discussion on weak_odr being the correct
linkage, but changing to _odr (if appropriate), just enables more
optimizations and can be a followup patch.

Cheers,
Rafael



More information about the cfe-commits mailing list