-
Notifications
You must be signed in to change notification settings - Fork 416
Open
Description
When building shaderc with clang with default CMake options, a warning is generation and SHADERC_ENABLE_WERROR_COMPILE=ON makes it an error.
Problem is in Shaderc/libshaderc_util/src/compiler.cc.
Some notes:
- MSVC itself doesn't generate any warning.
- clang-cl (MSVC frontend of clang) does generate a warning but doesn't convert it to an error, which probably is a bug in CMakeList
Clang:
[build] [205/263] Building CXX object Count/vendor/Shaderc/libshaderc_util/CMakeFiles/shaderc_util.dir/src/compiler.cc.obj
[build] FAILED: [code=1] Count/vendor/Shaderc/libshaderc_util/CMakeFiles/shaderc_util.dir/src/compiler.cc.obj
[build] C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -DENABLE_HLSL -IE:/DEV/C++/Projects/Count-Engine-02/Count/vendor/Shaderc/libshaderc_util/include -IE:/DEV/C++/Projects/Count-Engine-02/Count/vendor/glslang -IE:/DEV/C++/Projects/Count-Engine-02/Count/vendor/glslang/glslang/.. -IE:/DEV/C++/Projects/Count-Engine-02/build/Windows-Clang-Debug/include -IE:/DEV/C++/Projects/Count-Engine-02/Count/vendor/glslang/glslang/../External -IE:/DEV/C++/Projects/Count-Engine-02/Count/vendor/SPIRV-Tools/include -IE:/DEV/C++/Projects/Count-Engine-02/Count/vendor/SPIRV-Headers/include -IE:/DEV/C++/Projects/Count-Engine-02/Count/vendor/glslang/SPIRV/.. -IE:/DEV/C++/Projects/Count-Engine-02/Count/vendor/glslang/SPIRV/../External -Wimplicit-fallthrough -O0 -std=c++17 -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd -g -Xclang -gcodeview -Wextra-semi -Wall -Werror -fvisibility=hidden -MD -MT Count/vendor/Shaderc/libshaderc_util/CMakeFiles/shaderc_util.dir/src/compiler.cc.obj -MF Count\vendor\Shaderc\libshaderc_util\CMakeFiles\shaderc_util.dir\src\compiler.cc.obj.d -o Count/vendor/Shaderc/libshaderc_util/CMakeFiles/shaderc_util.dir/src/compiler.cc.obj -c E:/DEV/C++/Projects/Count-Engine-02/Count/vendor/Shaderc/libshaderc_util/src/compiler.cc
[build] E:/DEV/C++/Projects/Count-Engine-02/Count/vendor/Shaderc/libshaderc_util/src/compiler.cc:732:8: error: 'strncpy' is deprecated: This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Werror,-Wdeprecated-declarations]
[build] 732 | std::strncpy(reinterpret_cast<char*>(result_vec.data()), str.c_str(),
[build] | ^
[build] C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt\string.h:334:1: note: 'strncpy' has been explicitly marked deprecated here
[build] 334 | __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_EX(
[build] | ^
[build] C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt\corecrt.h:1935:17: note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_EX'
[build] 1935 | _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_SalAttributeDst _DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2);
[build] | ^
[build] C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\vcruntime.h:368:55: note: expanded from macro '_CRT_INSECURE_DEPRECATE'
[build] 368 | #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT( \
[build] | ^
[build] C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\vcruntime.h:358:47: note: expanded from macro '_CRT_DEPRECATE_TEXT'
[build] 358 | #define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
[build] | ^
[build] 1 error generated.
Clang-CL:
[build] [209/263] Building CXX object Count\vendor\Shaderc\libshaderc_util\CMakeFiles\shaderc_util.dir\src\compiler.cc.obj
[build] E:\DEV\C++\Projects\Count-Engine-02\Count\vendor\Shaderc\libshaderc_util\src\compiler.cc(732,8): warning: 'strncpy' is deprecated: This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
[build] 732 | std::strncpy(reinterpret_cast<char*>(result_vec.data()), str.c_str(),
[build] | ^
[build] C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt\string.h(334,1): note: 'strncpy' has been explicitly marked deprecated here
[build] 334 | __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_EX(
[build] | ^
[build] C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt\corecrt.h(1935,17): note: expanded from macro '__DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_EX'
[build] 1935 | _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_SalAttributeDst _DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2);
[build] | ^
[build] C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\vcruntime.h(368,55): note: expanded from macro '_CRT_INSECURE_DEPRECATE'
[build] 368 | #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT( \
[build] | ^
[build] C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\vcruntime.h(358,47): note: expanded from macro '_CRT_DEPRECATE_TEXT'
[build] 358 | #define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
[build] | ^
[build] 1 warning generated.
MSVC:
[build] [200/263] Building CXX object Count\vendor\Shaderc\libshaderc_util\CMakeFiles\shaderc_util.dir\src\version_profile.cc.obj
[build] [201/263] Building CXX object Count\vendor\Shaderc\libshaderc_util\CMakeFiles\shaderc_util.dir\src\compiler.cc.obj
[build] [202/263] Building CXX object Count\vendor\SPIRV-Tools\source\opt\CMakeFiles\SPIRV-Tools-opt.dir\unify_const_pass.cpp.obj
Changing SHADERC_ENABLE_WERROR_COMPILE from default (ON) to OFF allows it to compile. (the warning is still generated)
Possible solutions are adding _CRT_SECURE_NO_WARNINGS to compiler definition or fixing this warning.
Software version
clang version 20.1.8
Target: x86_64-pc-windows-msvc
gcc version 15.1.0 (x86_64-win32-seh-rev0, Built by MinGW-Builds project)
MSVC v17.14.13
cmake version 4.1.0
Metadata
Metadata
Assignees
Labels
No labels