← Commit list

47f411c6d8

Viktor Szakats
Viktor Szakats
2026-05-16
SUCCESS Duration: 419s

Subject

GHA: enable `-Wunused-macros` in clang-tidy jobs

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

.github/workflows/linux.yml+2 -0
@@ -321,6 +321,7 @@ jobs:
install_steps: skiprun mbedtls-latest-intel rustls wolfssl-opensslextra-intel
install_steps_brew: openssl@4 gsasl
CC: clang-20
+ CFLAGS: -Wunused-macros
LDFLAGS: >-
-Wl,-rpath,/home/runner/wolfssl-opensslextra/lib
-Wl,-rpath,/home/runner/mbedtls/lib
@@ -345,6 +346,7 @@ jobs:
install_steps: skiprun
install_steps_brew: libngtcp2 libnghttp3 c-ares
CC: clang-20
+ CFLAGS: -Wunused-macros
LDFLAGS: >-
-Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/openssl/lib
-Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/libngtcp2/lib
.github/workflows/macos.yml+3 -1
@@ -300,6 +300,7 @@ jobs:
compiler: clang
install: llvm gnutls nettle libressl krb5 mbedtls gsasl rustls-ffi libssh fish
install_steps: skiprun
+ CFLAGS: -Wunused-macros
chkprefill: _chkprefill
generate: >-
-DCURL_USE_OPENSSL=ON -DOPENSSL_ROOT_DIR=/opt/homebrew/opt/libressl -DCURL_DEFAULT_SSL_BACKEND=openssl
@@ -316,6 +317,7 @@ jobs:
compiler: clang
install: llvm libnghttp3 libngtcp2 openldap krb5
install_steps: skipall
+ CFLAGS: -Wunused-macros
generate: >-
-DCURL_USE_OPENSSL=ON -DOPENSSL_ROOT_DIR=/opt/homebrew/opt/openssl -DUSE_NGTCP2=ON
-DLDAP_INCLUDE_DIR=/opt/homebrew/opt/openldap/include
@@ -445,6 +447,7 @@ jobs:
- name: 'configure'
env:
+ CFLAGS: '${{ matrix.build.CFLAGS }}'
MATRIX_CHKPREFILL: '${{ matrix.build.chkprefill }}'
MATRIX_CONFIGURE: '${{ matrix.build.configure }}'
MATRIX_GENERATE: '${{ matrix.build.generate }}'
@@ -479,7 +482,6 @@ jobs:
false
fi
else
- export CFLAGS
if [[ "${MATRIX_COMPILER}" = 'llvm'* ]]; then
options+=" --target=$(uname -m)-apple-darwin"
fi
.github/workflows/windows.yml+3 -1
@@ -782,7 +782,7 @@ jobs:
include:
- { build: 'autotools', compiler: 'gcc' }
- { build: 'cmake' , compiler: 'gcc' }
- - { build: 'cmake' , compiler: 'clang-tidy', install_packages: 'clang-20 clang-tidy-20' }
+ - { build: 'cmake' , compiler: 'clang-tidy', install_packages: 'clang-20 clang-tidy-20', CFLAGS: '-Wunused-macros' }
steps:
- name: 'install packages'
timeout-minutes: 2
@@ -801,6 +801,8 @@ jobs:
run: autoreconf -fi
- name: 'configure'
+ env:
+ CFLAGS: '${{ matrix.CFLAGS }}'
run: |
if [ "${MATRIX_BUILD}" = 'cmake' ]; then
if [ "${MATRIX_COMPILER}" = 'clang-tidy' ]; then
lib/parsedate.c+4 -0
@@ -98,8 +98,12 @@ const char * const Curl_month[] = {
#ifndef CURL_DISABLE_PARSEDATE
+#if SIZEOF_TIME_T < 5
#define PARSEDATE_LATER 1
+#endif
+#if SIZEOF_TIME_T < 5 || defined(HAVE_TIME_T_UNSIGNED)
#define PARSEDATE_SOONER 2
+#endif
static const char * const weekday[] = {
"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"
tests/libtest/first.h+27 -12
@@ -58,19 +58,23 @@ extern int unitfail; /* for unittests */
#include <sys/select.h>
#endif
+#ifndef UNITTESTS
#define test_setopt(A, B, C) \
do { \
result = curl_easy_setopt(A, B, C); \
if(result != CURLE_OK) \
goto test_cleanup; \
} while(0)
+#endif /* !UNITTESTS */
+#if 0
#define test_multi_setopt(A, B, C) \
do { \
result = curl_multi_setopt(A, B, C); \
if(result != CURLE_OK) \
goto test_cleanup; \
} while(0)
+#endif
extern const char *libtest_arg2; /* set by first.c to the argv[2] or NULL */
extern const char *libtest_arg3; /* set by first.c to the argv[3] or NULL */
@@ -104,8 +108,10 @@ void ws_close(CURL *curl); /* just close the connection */
*
* For portability reasons TEST_ERR_* values should be less than 127.
*/
-
+#if !defined(UNITTESTS) || defined(BUILDING_LIBCURL)
#define TEST_ERR_MAJOR_BAD CURLE_OBSOLETE20
+#endif
+#ifndef UNITTESTS
#define TEST_ERR_RUNS_FOREVER CURLE_OBSOLETE24
#define TEST_ERR_EASY_INIT CURLE_OBSOLETE29
#define TEST_ERR_MULTI CURLE_OBSOLETE32
@@ -236,8 +242,10 @@ void ws_close(CURL *curl); /* just close the connection */
} \
} while(0)
+#if 0
#define res_multi_setopt(A, B, C) \
exe_multi_setopt(A, B, C, __FILE__, __LINE__)
+#endif
#define chk_multi_setopt(A, B, C, Y, Z) \
do { \
@@ -290,8 +298,10 @@ void ws_close(CURL *curl); /* just close the connection */
} \
} while(0)
+#if 0
#define res_multi_remove_handle(A, B) \
exe_multi_remove_handle(A, B, __FILE__, __LINE__)
+#endif
#define chk_multi_remove_handle(A, B, Y, Z) \
do { \
@@ -426,8 +436,10 @@ void ws_close(CURL *curl); /* just close the connection */
} \
} while(0)
+#if 0
#define res_multi_poll(A, B, C, D, E) \
exe_multi_poll(A, B, C, D, E, __FILE__, __LINE__)
+#endif
#define chk_multi_poll(A, B, C, D, E, Y, Z) \
do { \
@@ -456,6 +468,7 @@ void ws_close(CURL *curl); /* just close the connection */
#define res_multi_wakeup(A) \
exe_multi_wakeup(A, __FILE__, __LINE__)
+#if 0
#define chk_multi_wakeup(A, Y, Z) \
do { \
exe_multi_wakeup(A, Y, Z); \
@@ -465,6 +478,7 @@ void ws_close(CURL *curl); /* just close the connection */
#define multi_wakeup(A) \
chk_multi_wakeup(A, __FILE__, __LINE__)
+#endif
/* ---------------------------------------------------------------- */
@@ -518,8 +532,10 @@ void ws_close(CURL *curl); /* just close the connection */
#define res_test_timedout() \
exe_test_timedout(TEST_HANG_TIMEOUT, __FILE__, __LINE__)
+#if 0
#define res_test_timedout_custom(T) \
exe_test_timedout(T, __FILE__, __LINE__)
+#endif
#define chk_test_timedout(T, Y, Z) \
do { \
@@ -534,6 +550,15 @@ void ws_close(CURL *curl); /* just close the connection */
#define abort_on_test_timeout_custom(T) \
chk_test_timedout(T, __FILE__, __LINE__)
+#define NUM_HANDLES 4 /* global default */
+
+#define res_global_init(A) \
+ exe_global_init(A, __FILE__, __LINE__)
+
+#endif /* !UNITTESTS */
+
+#if !defined(UNITTESTS) || defined(BUILDING_LIBCURL)
+
/* ---------------------------------------------------------------- */
#define exe_global_init(A, Y, Z) \
@@ -548,9 +573,6 @@ void ws_close(CURL *curl); /* just close the connection */
} \
} while(0)
-#define res_global_init(A) \
- exe_global_init(A, __FILE__, __LINE__)
-
#define chk_global_init(A, Y, Z) \
do { \
exe_global_init(A, Y, Z); \
@@ -564,13 +586,6 @@ void ws_close(CURL *curl); /* just close the connection */
#define global_init(A) \
chk_global_init(A, __FILE__, __LINE__)
-#define NO_SUPPORT_BUILT_IN \
- { \
- (void)URL; \
- curl_mfprintf(stderr, "Missing support\n"); \
- return CURLE_UNSUPPORTED_PROTOCOL; \
- }
-
-#define NUM_HANDLES 4 /* global default */
+#endif /* !UNITTESTS || BUILDING_LIBCURL */
#endif /* HEADER_LIBTEST_FIRST_H */
tests/libtest/lib1912.c+5 -4
@@ -23,16 +23,17 @@
***************************************************************************/
#include "first.h"
-#define print_err(name, exp) \
- curl_mfprintf(stderr, "Type mismatch for CURLOPT_%s (expected %s)\n", \
- name, exp)
-
static CURLcode test_lib1912(const char *URL)
{
/* Only test if GCC/clang type checking is available */
int error = 0;
#ifdef CURLINC_TYPECHECK_GCC_H
const struct curl_easyoption *o;
+
+#define print_err(name, exp) \
+ curl_mfprintf(stderr, "Type mismatch for CURLOPT_%s (expected %s)\n", \
+ name, exp)
+
for(o = curl_easy_option_next(NULL); o; o = curl_easy_option_next(o)) {
/* Test for mismatch OR missing typecheck macros */
if(curlcheck_long_option(o->id) !=
tests/libtest/lib2301.c+3 -1
@@ -97,6 +97,8 @@ static CURLcode test_lib2301(const char *URL)
curl_global_cleanup();
return result;
#else
- NO_SUPPORT_BUILT_IN
+ (void)URL;
+ curl_mfprintf(stderr, "Missing support\n");
+ return CURLE_UNSUPPORTED_PROTOCOL;
#endif
}
tests/libtest/lib2302.c+3 -1
@@ -125,6 +125,8 @@ static CURLcode test_lib2302(const char *URL)
curl_global_cleanup();
return result;
#else
- NO_SUPPORT_BUILT_IN
+ (void)URL;
+ curl_mfprintf(stderr, "Missing support\n");
+ return CURLE_UNSUPPORTED_PROTOCOL;
#endif
}
tests/libtest/lib2304.c+3 -1
@@ -85,6 +85,8 @@ static CURLcode test_lib2304(const char *URL)
curl_global_cleanup();
return result;
#else
- NO_SUPPORT_BUILT_IN
+ (void)URL;
+ curl_mfprintf(stderr, "Missing support\n");
+ return CURLE_UNSUPPORTED_PROTOCOL;
#endif
}
tests/libtest/lib2700.c+3 -1
@@ -249,6 +249,8 @@ test_cleanup:
curl_global_cleanup();
return result;
#else
- NO_SUPPORT_BUILT_IN
+ (void)URL;
+ curl_mfprintf(stderr, "Missing support\n");
+ return CURLE_UNSUPPORTED_PROTOCOL;
#endif
}
tests/libtest/lib518.c+2 -2
@@ -23,6 +23,8 @@
***************************************************************************/
#include "first.h"
+#if defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT)
+
#include "testutil.h"
#define T518_SAFETY_MARGIN 16
@@ -36,8 +38,6 @@
#define DEV_NULL "/dev/null"
#endif
-#if defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT)
-
static int *t518_testfd = NULL;
static struct rlimit t518_num_open;
static char t518_msgbuff[256];
tests/libtest/lib537.c+2 -2
@@ -23,6 +23,8 @@
***************************************************************************/
#include "first.h"
+#if defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT)
+
#include "testutil.h"
#define T537_SAFETY_MARGIN 11
@@ -33,8 +35,6 @@
#define DEV_NULL "/dev/null"
#endif
-#if defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT)
-
static int *t537_testfd = NULL;
static struct rlimit t537_num_open;
static char t537_msgbuff[256];
tests/server/dnsd.c+4 -0
@@ -159,13 +159,17 @@ static int blob_add_qname(struct blob *b, const struct Curl_str *str)
#define QTYPE_AAAA 28
#define QTYPE_HTTPS 0x41
+#if 0
#define HTTPS_RR_CODE_MANDATORY 0x00
+#endif
#define HTTPS_RR_CODE_ALPN 0x01
#define HTTPS_RR_CODE_NO_DEF_ALPN 0x02
+#if 0
#define HTTPS_RR_CODE_PORT 0x03
#define HTTPS_RR_CODE_IPV4 0x04
#define HTTPS_RR_CODE_ECH 0x05
#define HTTPS_RR_CODE_IPV6 0x06
+#endif
static const char *type2string(uint16_t qtype)
{
tests/unit/unit1307.c+2 -0
@@ -43,8 +43,10 @@
#define MAC_DIFFER 0x40
#define MAC_SHIFT 16
+#if 0
#define MAC_MATCH ((CURL_FNMATCH_MATCH << MAC_SHIFT) | MAC_DIFFER)
#define MAC_NOMATCH ((CURL_FNMATCH_NOMATCH << MAC_SHIFT) | MAC_DIFFER)
+#endif
#define MAC_FAIL ((CURL_FNMATCH_FAIL << MAC_SHIFT) | MAC_DIFFER)
static const char *ret2name(int i)
tests/unit/unit1666.c+0 -2
@@ -190,8 +190,6 @@ static CURLcode test_unit1666(const char *arg)
UNITTEST_END_SIMPLE
}
-#undef OID
-
#else
static CURLcode test_unit1666(const char *arg)
tests/unit/unit1667.c+0 -5
@@ -37,9 +37,6 @@ struct test_1667 {
CURLcode result_exp;
};
-/* the size of the object needs to deduct the null terminator */
-#define OID(x) x, sizeof(x) - 1
-
static bool test1667(const struct test_1667 *spec, size_t i,
struct dynbuf *dbuf)
{
@@ -326,8 +323,6 @@ static CURLcode test_unit1667(const char *arg)
UNITTEST_END_SIMPLE
}
-#undef OID
-
#else
static CURLcode test_unit1667(const char *arg)