summaryrefslogtreecommitdiff
path: root/BUILD.gn
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2019-08-06 15:24:48 -0700
committerReid Kleckner <rnk@google.com>2019-08-06 15:24:48 -0700
commite62fca4a4a7f10e4f1e0506f2cfdb6c1c4b7cf3a (patch)
tree37ebb47eda8fb373f0a2000afcc2d9a3fb6b8bde /BUILD.gn
parentda0dcccc44f11809d1241fcd52b4c0e25146d2a2 (diff)
downloadnasm-e62fca4a4a7f10e4f1e0506f2cfdb6c1c4b7cf3a.tar.gz
Fix extern_inline for MSVC and clang-cl
Prior to this change, no inline function bodies would be provided for MSVC. This change fixes that, so nasm will be slightly faster. With clang-cl, however, there would be LNK4006 warnings if the compiler chooses not to inline the ilog2 functions. The easiest way to observe this is with `nmake /f Mkfiles/msvc.mak CC=clang-cl DEBUG=1`. This disables inlining, and I see this at the end of the link: ilog2.obj : warning LNK4006: ilog2_32 already defined in outmacho.obj; second definition ignored ilog2.obj : warning LNK4006: ilog2_64 already defined in eval.obj; second definition ignored ilog2.obj : warning LNK4006: alignlog2_32 already defined in outmacho.obj; second definition ignored When additional instrumentation (-fprofile-instr-generate) is enabled, the warning can become an error, as we discovered in https://crbug.com/989745. MSVC and compilers pretending to be MSVC (clang-cl) implement inline in C with C++ semantics. In C++, inline functions are emitted by the compiler whenever they are needed and the linker discards duplicate inline function definitions. This change adds a new HAVE_MSVC_INLINE macro and adjusts the ifdefs to handle this mode. I chose to keep ilog2.c as part of the build, and to have it emit duplicate definitions of all the inline functions. An alternative solution would be to exclude it from the build, but I felt it was best to solve this in source code instead of the build system. R=dalecurtis@chromium.org, davidben@chromium.org Chromium-specific: I reran find_patches.py with some modifications to make it work on Windows. Change-Id: I21011ed4f619f920c53f7cfc3afaa32dc2c0ff4e
Diffstat (limited to 'BUILD.gn')
0 files changed, 0 insertions, 0 deletions