curl/system.h: fix for GCC 3.3.x and older

The guards implicitly and intentionally include clang, which reports
itself as GCC 4.2.1.

Ref: https://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Other-Builtins.html#Other-Builtins
Ref: https://www.haiku-os.org/guides/building/gcc-hybrid (Haiku uses gcc 2.95.3)

Follow-up to 909af1a43b #16761

Reported-by: Schrijvers Luc
Fixes #17951
Closes #17954
This commit is contained in:
Viktor Szakats
2025-07-17 18:13:37 +02:00
parent 1a441c3c0a
commit 2d4e166b65

View File

@@ -336,8 +336,11 @@
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# define CURL_POPCOUNT64(x) __builtin_popcountll(x)
# define CURL_CTZ64(x) __builtin_ctzll(x)
# if (__GNUC__ >= 4) || \
((__GNUC__ == 3) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 4))
# define CURL_POPCOUNT64(x) __builtin_popcountll(x)
# define CURL_CTZ64(x) __builtin_ctzll(x)
# endif
# elif defined(__LP64__) || \
defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \
defined(__e2k__) || \
@@ -348,8 +351,11 @@
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# define CURL_POPCOUNT64(x) __builtin_popcountl(x)
# define CURL_CTZ64(x) __builtin_ctzl(x)
# if (__GNUC__ >= 4) || \
((__GNUC__ == 3) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 4))
# define CURL_POPCOUNT64(x) __builtin_popcountl(x)
# define CURL_CTZ64(x) __builtin_ctzl(x)
# endif
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_PULL_SYS_TYPES_H 1