Closed advancedwebdeveloper closed 1 year ago
compat.zip
I am attaching my files.
I rad from declspec error when compiling clang's
The problem comes from a conflict between the C11 standard and Windows-specific extensions to C/C++. Windows extends storage-classes using the declspec syntax, which predates C11. It provides a storage-class for functions which don't return with __declspec(noreturn).
Unfortunately this conflicts with the keyword macro noreturn from C11. Microsoft likely doesn't see this as a problem, since they don't claim any support for C11. If you try to use Windows SDK headers with the macro defined, your compiler will complain about using a keyword in the declspec through the somewhat cryptic error message listed in the original question (noreturn expands into _Noreturn, the actual keyword added in C11).
The answer is pretty simple though: as long as your code isn't trying to mix __declspec(noreturn) and noreturn, which would be redundant, just include the
header after the other system headers. The preprocessor won't expand noreturn inside the Windows SDK headers, and everything will be copacetic.
That didn't work for me.
Also passing Clang's args -fms-extensions -fdeclspec didn't change the situation - and errors are the same.
Ivan
@ericniebler , please share your knowledge around Clang's compatibility flags
@advancedwebdeveloper can you close this ? I think this is compiler issue rather than LibreSSL one, though.
Can you try setting both CMAKE_C_COMPILER
and CMAKE_CXX_COMPILER
to clang-cl
on Windows?
add restrict=restrict
to add_compile_definitions (or pass in commandline)
I'm going to close this, since discussion seems to have settled on it being a compiler configuration issue. Right now, we are testing on MSVC 2019, 2022, and mingw-w64 (gcc) in 32-bit and 64-bit configs using CMake and automake.
I tried to build using Clang 11, on Windows - so using Ninja's generator (to avoid MSVC and other non-LLVM stuff). So did like this: libressl-2.8.3\build>cmake -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ..
The first odd things was this warning. I am not dealing with GCC, in my case:
The rest looks OK:
Looks like you do not have any C++ code, around:
My environment:
libressl-2.8.3\build>cmake --version
libressl-2.8.3\build>clang --version
libressl-2.8.3\build>ninja --version
Triggerring Ninja:
libressl-2.8.3\build>ninja -j 1 And here are my errors:
In file included from ../crypto/md5/md5_dgst.c:59 : In file included from ../crypto/../include/compat/stdio.h:11 : In file included from C:\Program Files\Windows Kits\10\include\10.0.18362.0\ucrt../ucrt/stdlib.h:13 : C:/Program Files/Windows Kits/10/include/10.0.18362.0/ucrt/corecrt_malloc.h:54:24:
error: __declspec attributes must be an identifier or string literal
ror: __declspec attributes must be an identifier or string literal