mirror of
https://github.com/curl/curl.git
synced 2026-07-23 15:57:18 +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
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
#include "memdebug.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat"
|
||||
#pragma GCC diagnostic ignored "-Wformat-extra-args"
|
||||
|
|
@ -1559,6 +1559,6 @@ CURLcode test(char *URL)
|
|||
return CURLE_OK;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
***************************************************************************/
|
||||
#include "curlcheck.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat"
|
||||
#endif
|
||||
|
|
@ -186,6 +186,6 @@ fail_unless(rc == 128, "return code should be 128");
|
|||
|
||||
UNITTEST_STOP
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -26,15 +26,6 @@
|
|||
#include "urldata.h"
|
||||
#include "sendf.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat"
|
||||
#pragma GCC diagnostic ignored "-Wformat-zero-length"
|
||||
#if !defined(__clang__) && __GNUC__ >= 7
|
||||
#pragma GCC diagnostic ignored "-Wformat-overflow"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This test hardcodes the knowledge of the buffer size which is internal to
|
||||
* Curl_infof(). If that buffer is changed in size, this tests needs to be
|
||||
|
|
@ -101,6 +92,15 @@ static int verify(const char *info, const char *two)
|
|||
|
||||
UNITTEST_START
|
||||
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat"
|
||||
#pragma GCC diagnostic ignored "-Wformat-zero-length"
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic ignored "-Wformat-overflow"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Injecting a simple short string via a format */
|
||||
msnprintf(input, sizeof(input), "Simple Test");
|
||||
Curl_infof(testdata, "%s", input);
|
||||
|
|
@ -146,8 +146,8 @@ Curl_infof(testdata, "%s", input);
|
|||
fail_unless(strlen(output) == 2051, "Truncation of infof input 3");
|
||||
fail_unless(output[sizeof(output) - 1] == '\0', "Truncation of infof input 3");
|
||||
|
||||
UNITTEST_STOP
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
UNITTEST_STOP
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ struct set {
|
|||
UNITTEST_START
|
||||
#ifdef USE_SSH
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Woverlength-strings"
|
||||
#endif
|
||||
|
|
@ -78,7 +78,7 @@ UNITTEST_START
|
|||
{ NULL, NULL, NULL, NULL, CURLE_OK }
|
||||
};
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic warning "-Woverlength-strings"
|
||||
#endif
|
||||
|
||||
|
|
@ -114,6 +114,10 @@ UNITTEST_START
|
|||
|
||||
free((void *)list[0].cp);
|
||||
}
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
UNITTEST_STOP
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ static CURLcode unit_stop(void)
|
|||
return CURLE_OK;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Woverlength-strings"
|
||||
#endif
|
||||
|
|
@ -78,7 +78,7 @@ static const char *filecontents[] = {
|
|||
"LINE1\x1aTEST"
|
||||
};
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic warning "-Woverlength-strings"
|
||||
#endif
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ UNITTEST_START
|
|||
return (CURLcode)rc;
|
||||
UNITTEST_STOP
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue