bitdefender / bddisasm

bddisasm is a fast, lightweight, x86/x64 instruction decoder. The project also features a fast, basic, x86/x64 instruction emulator, designed specifically to detect shellcode-like behavior.
Apache License 2.0
888 stars 115 forks source link

bdshemu compiling failing on clang-cl #88

Closed angelfor3v3r closed 7 months ago

angelfor3v3r commented 7 months ago

I'm trying to compile the library on clang-cl and I noticed the flag /WX is used here: https://github.com/bitdefender/bddisasm/blob/37a8c94bc78a5c97cf2f8bb678cdc70781f06fdd/CMakeLists.txt#L42

This causes clang-cl to warn about inc/bdshemu_x86.h(64,1): error: use of 'static_assert' without inclusion of <assert.h> is a Microsoft extension [-Werror,-Wmicrosoft-static-assert] because of these pieces of code: https://github.com/bitdefender/bddisasm/blob/37a8c94bc78a5c97cf2f8bb678cdc70781f06fdd/inc/bdshemu_x86.h#L64 https://github.com/bitdefender/bddisasm/blob/37a8c94bc78a5c97cf2f8bb678cdc70781f06fdd/inc/bddisasm_types.h#L110-L112

This causes compiling to fail for me.

Here is my clang-cl information:

clang version 17.0.3
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin

I am using v2.1.3.

I don't have plans to use bdshemu but I don't see an option to compile without it, so I don't really have a choice I think? Any help is appreciated 😃

vlutas commented 7 months ago

Hello,

Removed the assert, as it's not needed anymore (suspecting the number of GPRs will not be increased again any time soon). While bdshemu cannot be built without bddisasm, bddisasm can be built without bdshemu - just make sure you only include bddisasm specific headers, and you only link with the bddisasm library.

I will also create a new release, v2.1.4, to include this change.

Thanks for reporting this!