[cfe-dev] clang doesn't compile simple code

Reid Kleckner rnk at google.com
Mon Apr 21 10:48:02 PDT 2014


Add the -fms-extensions flag to enable support for __cdecl and __stdcall,
as well as other things like __declspec(dllexport).

Alternatively, pass a triple flag that doesn't mention mingw to get this
behavior by default, like --target=i686-pc-win32.


On Mon, Apr 21, 2014 at 3:05 AM, fprijate <prijatelj.francek at gmail.com>wrote:

> Hi
>
> Here is a sample code :
>
> typedef int (_cdecl * func1 )( void );
> typedef int (_stdcall * func2 )( void );
>
> which clang doesn't compile.
> Actually it compiles it on Win with compiler from   Windows snapshot builds
> <http://llvm.org/builds/>
> While on Ubuntu (apt-get ...) or on Windows  pacman from MSYS2
> <http://sourceforge.net/projects/msys2/>   doesn,t compile.
>
> Problem is:
> While gcc preprocesor (mingw on win32 or gcc on linux) translates code to
>
> typedef int (__attribute__((__cdecl__)) * func1 )( void );
> typedef int (__attribute__((__stdcall__)) * func2 )( void );
>
> and then translates it to object file, clang preprocesor lives code as it
> is
> and then throws error.
>
> Solutuion:
> If i explicitly change source code to:
>
> typedef int (__attribute__((__cdecl__)) * func1 )( void );
> typedef int (__attribute__((__stdcall__)) * func2 )( void );
>
> and then compile it with clang , it compiles OK.
>
> regards
> FranĨek
>
>
>
>
>
>
>
>
> --
> View this message in context:
> http://clang-developers.42468.n3.nabble.com/clang-doesn-t-compile-simple-code-tp4038903.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140421/0bf02da9/attachment.html>


More information about the cfe-dev mailing list