[compiler-rt] r202296 - Emulate C99/C++11 __func__ for Visual C++.

Reid Kleckner rnk at google.com
Wed Feb 26 13:40:45 PST 2014


On Wed, Feb 26, 2014 at 1:30 PM, Joerg Sonnenberger <joerg at britannica.bec.de
> wrote:

> On Wed, Feb 26, 2014 at 01:06:48PM -0800, Reid Kleckner wrote:
> > I'd really rather not muck around in the implementors namespace like
> this.
> >  If the compiler is actually clang-cl (which claims to be MSVC) or MSVC
> > 2013 CTP, then __func__ will be available, and who knows what will
> happen.
>
> Can you try the attached patch, which uses a feature test? I am assuming
> that C and C++ compiler support it both, if the former has it.
>

No, SOURCE_C_FLAGS doesn't make it through to the CC command for
sanitizer_common:

[15/16] Building CXX object
projects\compiler-rt\lib\sanitizer_common\CMakeFiles\RTSanitizerCommon.i386.dir\sanitizer_common.cc.obj
FAILED: "C:/Program Files (x86)/CMake 2.8/bin/cmcldeps.exe" CXX
..\projects\compiler-rt\lib\sanitizer_common\sanitizer_common.cc
"projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.i386.dir/sanitizer_common.cc.obj.d"
projects\compiler-rt\lib\sanitizer_common\CMakeFiles\RTSanitizerCommon.i386.dir\sanitizer_common.cc.obj
 "Note: including file: "  "C:/Program Files (x86)/Microsoft Visual Studio
12.0/VC/bin/cl.exe" C:\PROGRA~2\MICROS~4.0\VC\bin\cl.exe   /nologo /TP
/DWIN32 /D_WINDOWS /W3   /MT /O2 /Ob2
-Iprojects\compiler-rt\lib\sanitizer_common
-I..\projects\compiler-rt\lib\sanitizer_common -Iinclude -I..\include
 -UNDEBUG -wd4146 -wd4180 -wd4244 -wd4267 -wd4345 -wd4351 -wd4355 -wd4503
-wd4624 -wd4800 -wd4291 -w14062 -we4238  /MT /Oy- /GS- /O2 /Zi /wd4722 /GR-
 -DSANITIZER_NEEDS_SEGV=0 -D_CRT_NONSTDC_NO_DEPRECATE
-D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE
-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_DEPRECATE
-D_SCL_SECURE_NO_WARNINGS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS
/Foprojects\compiler-rt\lib\sanitizer_common\CMakeFiles\RTSanitizerCommon.i386.dir\sanitizer_common.cc.obj
/Fdprojects\compiler-rt\lib\sanitizer_common\CMakeFiles\RTSanitizerCommon.i386.dir/
/FS -c ..\projects\compiler-rt\lib\sanitizer_common\sanitizer_common.cc
..\projects\compiler-rt\lib\sanitizer_common\sanitizer_common.cc(96) :
error C2065: '__func__' : undeclared identifier

Presumably you'd have to hack add_compiler_rt_static_runtime in
compiler-rt/cmake/Modules/AddCompilerRT.cmake instead.

It's still not clear to me what the problem is with __FUNCTION__, other
than the lack of standardization.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140226/134050fa/attachment.html>


More information about the llvm-commits mailing list