[PATCH] Parse Microsoft __declspec appearing after class body

Alp Toker alp at nuanti.com
Sun Nov 24 11:13:34 PST 2013


On 24/11/2013 18:35, Saleem Abdulrasool wrote:
> On Sun, Nov 24, 2013 at 5:08 AM, Alp Toker <alp at nuanti.com 
> <mailto:alp at nuanti.com>> wrote:
>
>     Hi David,
>
>     The attached patch fixes __declspec parsing after the class
>     specification.
>
>
> Can you apply any specification on the declaration?  e.g.:
>
> struct s { } __declspec(dllexport); ?
>
> I thought that was only valid at the beginning.

Hi Saleem,

__declspec is syntactically valid in many of the same places as GNU 
attributes, so clang's modelling as part of the attribute system instead 
of the way you suggest turned out to be a brilliant choice. They're 
silently ignored by MSVC in some cases like your example which doesn't 
declare anything after the specifier, whereas we provide a handy warning.

That said, we don't handle __declspec appearing at the very start of the 
declaration correctly yet. I think David Majnemer is looking into that 
separately.

Alp.


>     Verified against MSVC.
>
>     Alp.
>
>     -- 
>     http://www.nuanti.com
>     the browser experts
>
>
>     _______________________________________________
>     cfe-commits mailing list
>     cfe-commits at cs.uiuc.edu <mailto:cfe-commits at cs.uiuc.edu>
>     http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
>
>
> -- 
> Saleem Abdulrasool
> compnerd (at) compnerd (dot) org

-- 
http://www.nuanti.com
the browser experts




More information about the cfe-commits mailing list