CLOCK_REALTIME is POSIX defined and never available with MSVC, even without /permissive-.
The difference is that the template is never instantiated and the compiler ignores the undefined identifier.
Details
Details
- Reviewers
Meinersbur - Group Reviewers
Restricted Project - Commits
- rG360411957b6f: [flang][MSVC] Fix building with `/permissive-` flag
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
This is the error message:
[6795/8382] Building CXX object tools\flang\runtime\CMakeFiles\obj.FortranRuntime.dir\time-intrinsic.cpp.obj FAILED: tools/flang/runtime/CMakeFiles/obj.FortranRuntime.dir/time-intrinsic.cpp.obj sccache C:\BuildTools\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe /nologo /TP -DBUILD_EXAMPLES -DFLANG_LITTLE_ENDIAN=1 -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools\flang\runtime -IC:\ws\w3\llvm-project\premerge-checks\flang\runtime -IC:\ws\w3\llvm-project\premerge-checks\flang\include -Itools\flang\include -Iinclude -IC:\ws\w3\llvm-project\premerge-checks\llvm\include -IC:\ws\w3\llvm-project\premerge-checks\llvm\..\mlir\include -Itools\mlir\include -Itools\clang\include -IC:\ws\w3\llvm-project\premerge-checks\llvm\..\clang\include /DWIN32 /D_WINDOWS /Zc:inline /Zc:__cplusplus /Zc:strictStrings /Oi /Zc:rvalueCast /bigobj /permissive- /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd4324 -w14062 -we4238 /Gw /MD /O2 /Ob2 -UNDEBUG -std:c++17 /EHs-c- /GR- /showIncludes /Fotools\flang\runtime\CMakeFiles\obj.FortranRuntime.dir\time-intrinsic.cpp.obj /Fdtools\flang\runtime\CMakeFiles\obj.FortranRuntime.dir\ /FS -c C:\ws\w3\llvm-project\premerge-checks\flang\runtime\time-intrinsic.cpp C:\ws\w3\llvm-project\premerge-checks\flang\runtime\time-intrinsic.cpp(77): error C2065: 'CLOCK_REALTIME': undeclared identifier C:\ws\w3\llvm-project\premerge-checks\flang\runtime\time-intrinsic.cpp(77): error C3861: 'CLOCK_REALTIME': identifier not found C:\ws\w3\llvm-project\premerge-checks\flang\runtime\time-intrinsic.cpp(146): error C2065: 'CLOCK_REALTIME': undeclared identifier C:\ws\w3\llvm-project\premerge-checks\flang\runtime\time-intrinsic.cpp(146): error C3861: 'CLOCK_REALTIME': identifier not found
Comment Actions
Please add a summary where you mention that CLOCK_REALTIME is POSIX defined and never available with msvc, even without /permissive-. The difference is that the template is never instantiated and the compiler ignores the undefined identifier. Also add a comment that without CLOCKID defined (e.g. Windows), it will fallback to the other implementation.
Interestingly, the same problem was solved differently for GetDateAndTime without the template stuff.
Comment Actions
done, I have copied your phrases.
Also add a comment that without CLOCKID defined (e.g. Windows), it will fallback to the other implementation.
It is already mentioned in the source file (line-65 and line-95)