lvc / abi-compliance-checker

A tool for checking backward API/ABI compatibility of a C/C++ library
https://lvc.github.io/abi-compliance-checker/
GNU Lesser General Public License v2.1
622 stars 76 forks source link

How to handle __asm__ __volatile__ keywords on Windows #52

Closed zhuda closed 7 years ago

zhuda commented 7 years ago

@lvc Hi, With MingGW on Windows I got following errors when compile one project, do you have any suggestions?

In file included from .../mingw64/x86_64-w64-mingw32/include/crtdefs.h:10:0, from .../mingw64/x86_64-w64-mingw32/include/stdio.h:9, from ...64_vc14_sdk/include/atf_api/sdk/atf_core.h:17, from ...64_vc14_sdk/include/atf_api/sdk/atf_system.h:13, from ...64_vc14_sdk/include/atf_api/sdk/atf_assert_option.h:19, from ...64_vc14_sdk/include/atf_api/sdk/atf.h:23, from C:\Users\zhuda\AppData\Local\Temp\6SjF31KHIV/dump2.h:10: E:/git.autodesk.com/binary-compatible-checker/abi-compliance-checker-dependency/mingw64/x86_64-w64-mingw32/include/_mingw.h:542:2: error: missing terminating " character asm volatile("int {$}3":); ^ In file included from ../mingw64/x86_64-w64-mingw32/include/crtdefs.h:10:0, from ../mingw64/x86_64-w64-mingw32/include/stdio.h:9, from ..64_vc14_sdk/include/atf_api/sdk/atf_core.h:17, from ..64_vc14_sdk/include/atf_api/sdk/atf_system.h:13, from ..64_vc14_sdk/include/atf_api/sdk/atf_assert_option.h:19, from ..64_vc14_sdk/include/atf_api/sdk/atf.h:23, from C:\Users\zhuda\AppData\Local\Temp\6SjF31KHIV/dump2.h:10: E:/mingw64/x86_64-w64-mingw32/include/_mingw.h: In function 'void debugbreak()': E:/mingw64/x86_64-w64-mingw32/include/_mingw.h:542:3: error: '$' was not declared in this scope asm volatile__("int {$}3":); ^ E:/mingw64/x86_64-w64-mingw32/include/_mingw.h:543:1: error: expected ';' before '}' token }

zhuda commented 7 years ago

I tried following defintion on windows version descriptor: #define __asm__ __asm #define __volatile__

but it doesn't work.

zhuda commented 7 years ago

And here is my GCC parameters in case you want take a look: The GCC parameters: gcc -fdump-translation-unit -fkeep-inline-functions -c -fpreprocessed -x c++ -DDECLSPEC_DEPRECATED=" " -DSECURITY_WIN32 -DSHSTDAPI_(x)=x -DSORTPP_PASS -D_AMD64_=300 -D_MSC_EXTENSIONS -D_MSC_VER=1500 -D_M_AMD64=300 -D_M_X64=300 -D_STDCALL_SUPPORTED -D_USE_DECLSPECS_FOR_SAL -D_WIN32 -D__assume=" " -D__builtin_alignof(x)=__alignof__(x) -D__cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D__except(x)= -D__fastcall=__attribute__((__fastcall__)) -D__forceinline=__inline -D__forceinline=inline -D__inline=inline -D__int16=short -D__int32=int -D__int64="long long" -D__int8=char -D__noop=" " -D__nullnullterminated=" " -D__nullptr="nullptr" -D__nullterminated=" " -D__possibly_notnullterminated=" " -D__pragma(x)= -D__ptr32=" " -D__ptr64=" " -D__stdcall=__attribute__((__stdcall__)) -D__thiscall=__attribute__((__thiscall__)) -D__try= -D__unaligned=" " -D__uuidof(x)=IID() -D__w64=" " -D_cdecl=__attribute__((__cdecl__)) -D_fastcall=__attribute__((__fastcall__)) -D_inline=inline -D_stdcall=__attribute__((__stdcall__)) -D_thiscall=__attribute__((__thiscall__)) -fpermissive -w -std=c++11 "C:\Users\zhuda\AppData\Local\Temp\6SjF31KHIV/dump2.i"

zhuda commented 7 years ago

@lvc I got fixed this issue by specify -nostdinc option for gcc and specify the windows version path of header files.