c4core
c4core copied to clipboard
Incorrect detection clang-cl
https://github.com/biojppm/c4core/blob/master/src/c4/compiler.hpp#L27
It breaks compilation using clang-cl.exe because it defines both _MSC_VER and __clang__ and cannot find alloca.h in rapidyaml. Also it breaks clangd when using msvc toolchain, eg. in qt creator.
Thanks for reporting. I'll need to add a repro to the CI before fixing it. Fixing is easy, the CI less so.
Thanks for reporting. I'll need to add a repro to the CI before fixing it. Fixing is easy, the CI less so.
Hello just wanted to ask if this will be fixed in the near future?
Thanks for reporting. I'll need to add a repro to the CI before fixing it. Fixing is easy, the CI less so.
Hello just wanted to ask if this will be fixed in the near future?
i used this
Submodule ext/c4core contains modified content
diff --git a/ext/c4core/src/c4/compiler.hpp b/ext/c4core/src/c4/compiler.hpp
index 5833913..d01be74 100644
--- a/ext/c4core/src/c4/compiler.hpp
+++ b/ext/c4core/src/c4/compiler.hpp
@@ -24,7 +24,7 @@
/** @see http://sourceforge.net/p/predef/wiki/Compilers/ for a list of compiler identifier macros */
/** @see https://msdn.microsoft.com/en-us/library/b0084kay.aspx for VS2013 predefined macros */
-#if defined(_MSC_VER) && !defined(__clang__)
+#if defined(_MSC_VER)
# define C4_MSVC
# define C4_MSVC_VERSION_2022 17
# define C4_MSVC_VERSION_2019 16
i used this
That worked around it for now thank you.
I can't reproduce. Here's what I tried:
+ cmake -S . -B build -G 'Visual Studio 17 2022' -T ClangCL -A x64 -DCMAKE_INSTALL_PREFIX=/d/a/c4core/c4core/install -DCMAKE_BUILD_TYPE=Debug -DC4_CXX_STANDARD=11 -DCXX_STANDARD=11 -DC4CORE_DEV=ON -DC4CORE_BUILD_BENCHMARKS=OFF -DC4CORE_SANITIZE=OFF -DC4CORE_LINT=OFF -DC4CORE_VALGRIND=OFF
-- The CXX compiler identification is Clang 19.1.5 with MSVC-like command-line
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/x64/bin/clang-cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
# ...
After the config, the compilation also succeeds.
What is the command you are using to trigger this behavior?
I believe compiling rapidyaml (as it includes the relevant header) triggers the error
Please provide the full procedure with all relevant commands.
Performed in the Developer PowerShell for VS
cd to a directory of choice
git clone https://github.com/biojppm/rapidyaml.git --branch v0.9.0 --recurse-submodules
cd rapidyaml
cmake . -B build -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_BUILD_TYPE=Release -G Ninja
cmake --build build