Some MS extensions can't be disabled?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Some MS extensions can't be disabled?

Andrius Morkūnas
Hi,

I've ran into a weird problem:
error: declaration does not declare anything
typedef int __ptr64;
^~~~~~~~~~~

After some looking at the source code I found that __ptr64 is one of the
Microsoft extensions' keywords, but it isn't disabled (and can't be?) on
FreeBSD.

In include/clang/Basic/TokenKinds.def:

// Microsoft Extension.
KEYWORD(__declspec                  , KEYALL)
KEYWORD(__cdecl                     , KEYALL)
KEYWORD(__stdcall                   , KEYALL)
KEYWORD(__fastcall                  , KEYALL)
KEYWORD(__ptr64                     , KEYALL)
KEYWORD(__w64                       , KEYALL)
KEYWORD(__forceinline               , KEYALL)
<...>
// Microsoft extensions which should be disabled in strict conformance mode
ALIAS("_asm"         , asm        , KEYMS)
ALIAS("_cdecl"       , __cdecl    , KEYMS)
ALIAS("_fastcall"    , __fastcall , KEYMS)
ALIAS("_stdcall"     , __stdcall  , KEYMS)

Is there some reason why *all* of MS extensions aren't disabled by default?

--
Andrius
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Some MS extensions can't be disabled?

Douglas Gregor

On Mar 1, 2010, at 2:32 AM, Andrius Morkūnas wrote:

> Hi,
>
> I've ran into a weird problem:
> error: declaration does not declare anything
> typedef int __ptr64;
> ^~~~~~~~~~~
>
> After some looking at the source code I found that __ptr64 is one of the
> Microsoft extensions' keywords, but it isn't disabled (and can't be?) on
> FreeBSD.
>
> In include/clang/Basic/TokenKinds.def:
>
> // Microsoft Extension.
> KEYWORD(__declspec                  , KEYALL)
> KEYWORD(__cdecl                     , KEYALL)
> KEYWORD(__stdcall                   , KEYALL)
> KEYWORD(__fastcall                  , KEYALL)
> KEYWORD(__ptr64                     , KEYALL)
> KEYWORD(__w64                       , KEYALL)
> KEYWORD(__forceinline               , KEYALL)
> <...>
> // Microsoft extensions which should be disabled in strict conformance mode
> ALIAS("_asm"         , asm        , KEYMS)
> ALIAS("_cdecl"       , __cdecl    , KEYMS)
> ALIAS("_fastcall"    , __fastcall , KEYMS)
> ALIAS("_stdcall"     , __stdcall  , KEYMS)
>
> Is there some reason why *all* of MS extensions aren't disabled by default?

I think we might actually see __stdcall/__cdecl/__fastcall out there in code that isn't meant to require -fms-extensions. So, I've switched __ptr64 and __w64 over to -fms-extensions only:

        http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20100301/028176.html

        - Doug


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev