mirror of
https://github.com/curl/curl.git
synced 2026-07-24 02:17:17 +03:00
build: fix clang-cl builds, add CI job
- appveyor: add build-only job for clang-cl. - cmake: `-pedantic-errors` enables `-Werror,-Wlanguage-extension-token` automatically, which makes `__int64` detection fail. Explictly disable this compiler warning for clang-cl to make the feature detection work and to accept `__int64` in the source code. - cmake: disable `-Wlanguage-extension-token` warning for clang-cl to fix these when encountering `__int64`: ``` lib/formdata.c(797,29): error : extension used [-Werror,-Wlanguage-extension-token] lib/warnless.c(117,33): error : extension used [-Werror,-Wlanguage-extension-token] lib/warnless.c(60,28): message : expanded from macro 'CURL_MASK_SCOFFT' lib/warnless.c(59,38): message : expanded from macro 'CURL_MASK_UCOFFT' include\curl/system.h(352,40): message : expanded from macro 'CURL_TYPEOF_CURL_OFF_T' ``` - make `__GNUC__` warning suppressions apply to `__clang__` too. Necessary for clang-cl, which defines the latter, but not the former. (Regular clang defines both.) - examples: fix clang-cl compiler warning in `http2-upload.c`. ``` docs\examples\http2-upload.c(56,5): error : no previous prototype for function 'my_gettimeofday' [-Werror,-Wmissing-prototypes] docs\examples\http2-upload.c(56,1): message : declare 'static' if the function is not intended to be used outside of this translation unit ``` - unit2604: add missing `#pragma GCC diagnostic pop`. Follow-up toe53523fef0#14859 - unit1652: limit compiler warning suppression to GCC. They do not affect clang builds. Follow-up to71cf0d1fca#14772 Closes #15449
This commit is contained in:
parent
9acecc923d
commit
fb711b5098
13 changed files with 55 additions and 33 deletions
|
|
@ -31,6 +31,9 @@ if(CURL_WERROR AND
|
|||
NOT CMAKE_VERSION VERSION_LESS 3.23.0) OR # to avoid check_symbol_exists() conflicting with GCC -pedantic-errors
|
||||
CMAKE_C_COMPILER_ID MATCHES "Clang"))
|
||||
list(APPEND _picky "-pedantic-errors")
|
||||
if(MSVC) # clang-cl
|
||||
list(APPEND _picky "-Wno-language-extension-token") # Override default error to make __int64 size detection pass
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(APPLE AND
|
||||
|
|
@ -130,9 +133,13 @@ if(PICKY_COMPILER)
|
|||
${_picky_common_old}
|
||||
-Wshift-sign-overflow # clang 2.9
|
||||
-Wshorten-64-to-32 # clang 1.0
|
||||
-Wlanguage-extension-token # clang 3.0
|
||||
-Wformat=2 # clang 3.0 gcc 4.8
|
||||
)
|
||||
if(NOT MSVC)
|
||||
list(APPEND _picky_enable
|
||||
-Wlanguage-extension-token # clang 3.0 # Avoid for clang-cl to allow __int64
|
||||
)
|
||||
endif()
|
||||
# Enable based on compiler version
|
||||
if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.6) OR
|
||||
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.3))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue