From patchwork Sun Nov 9 21:53:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alejandro Colomar X-Patchwork-Id: 123857 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C15B53858408 for ; Sun, 9 Nov 2025 22:12:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C15B53858408 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=SKiBTuvK X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by sourceware.org (Postfix) with ESMTPS id 0C4B83858C39 for ; Sun, 9 Nov 2025 21:53:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0C4B83858C39 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0C4B83858C39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=172.105.4.254 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1762725210; cv=none; b=ApLh5TtpXelaXsJ+yyH+KqBCkU8LzLtWpqVMQgHgk2U8TEjaLgJhYX+EtrrThJ6C42Hm6QCp3ZL2p9G+7e0U1jNI9useTceWH2W6XnTyls62jxl8Oa0os9XIxRAF3g/reCe81ZfNz6Xg4NknR4/LE4z/yyE8qIpfIGEyMDBNy+Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1762725210; c=relaxed/simple; bh=XgBFAjVt8/xr2r0ObZ7IQ+N/8rnGiqmV2bskuRCMfoI=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=YBXX1+HxtgerJRRBb8G+jPYbmlC6MhEa0A+suXLh20j+Rdp4D4YUAo+SfPD73/nltjxGk7iFi7VwbBU9JTDe4SYN75F1vrK/SOOGlLK8eZ8l9ayJDBaFsTITyMniYt0dhBC0OANJ7nTOh2+lvrM7wuSgKd9IC15AthblJUUsxVY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0C4B83858C39 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id A8DD360007 for ; Sun, 9 Nov 2025 21:53:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6FFFC4CEF8; Sun, 9 Nov 2025 21:53:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762725209; bh=XgBFAjVt8/xr2r0ObZ7IQ+N/8rnGiqmV2bskuRCMfoI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SKiBTuvKqvEvGNlPMbYwSVlEy3egd8SAJl/+dvDCR3Ovg9ciPcgl2o/4Vyu0QuqgE DWtU6kBMXTezpgZqs86r7ut8ZyUXgBN9OYeH66eRahfPOwfPy322obXbNbiagiroxa INKOMSwe2LTHpuyWKXJvBa4HpEZXEeKWYZYenpaGhZAyUFbPqSv2mA/cCFy9Obb/OF RykjddYGyhph9hBeb3Lhx+I38DzmeYyYUw+tNE2soX3IBGXT3QM2BW+aIvGyhNXdt6 c9qFXOOGfy6AFNZs/V4SB0ZwZIsSxGYa5yufQP/2/OxkWXEJJdTq2JhFd6BfLCxldh jMRnyQimZ91gg== Date: Sun, 9 Nov 2025 22:53:26 +0100 From: Alejandro Colomar To: libc-alpha@sourceware.org Cc: Alejandro Colomar Subject: [PATCH v1 16/35] Assume that Clang is at least Clang 4 Message-ID: <9e2b5dc7c888e96f8e6bb9c9d87ebfaa07b9b131.1762725057.git.alx@kernel.org> X-Mailer: git-send-email 2.51.0 References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org Signed-off-by: Alejandro Colomar --- math/math.h | 12 ++++++------ misc/sys/cdefs.h | 15 +++++---------- string/bits/string_fortified.h | 2 +- string/string.h | 2 +- sysdeps/x86/bits/floatn.h | 4 ++-- 5 files changed, 15 insertions(+), 20 deletions(-) diff --git a/math/math.h b/math/math.h index 8113e6784c..6e6b82fab1 100644 --- a/math/math.h +++ b/math/math.h @@ -898,7 +898,7 @@ enum /* Return number of classification appropriate for X. */ # if ((__GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__) \ - || __glibc_clang_prereq (2,8)) \ + || defined(__clang__)) \ && (!defined __OPTIMIZE_SIZE__ || defined __cplusplus) /* The check for __cplusplus allows the use of the builtin, even when optimization for size is on. This is provided for @@ -913,7 +913,7 @@ enum # endif /* Return nonzero value if sign of X is negative. */ -# if __GNUC_PREREQ (6,0) || __glibc_clang_prereq (3,3) +# if __GNUC_PREREQ (6,0) || defined(__clang__) # define signbit(x) __builtin_signbit (x) # elif defined __cplusplus /* In C++ mode, __MATH_TG cannot be used, because it relies on @@ -930,7 +930,7 @@ enum /* Return nonzero value if X is not +-Inf or NaN. */ # if (__GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__) \ - || __glibc_clang_prereq (2,8) + || defined(__clang__) # define isfinite(x) __builtin_isfinite (x) # else # define isfinite(x) __MATH_TG ((x), __finite, (x)) @@ -938,7 +938,7 @@ enum /* Return nonzero value if X is neither zero, subnormal, Inf, nor NaN. */ # if (__GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__) \ - || __glibc_clang_prereq (2,8) + || defined(__clang__) # define isnormal(x) __builtin_isnormal (x) # else # define isnormal(x) (fpclassify (x) == FP_NORMAL) @@ -947,7 +947,7 @@ enum /* Return nonzero value if X is a NaN. We could use `fpclassify' but we already have this functions `__isnan' and it is faster. */ # if (__GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__) \ - || __glibc_clang_prereq (2,8) + || defined(__clang__) # define isnan(x) __builtin_isnan (x) # else # define isnan(x) __MATH_TG ((x), __isnan, (x)) @@ -966,7 +966,7 @@ enum (__builtin_types_compatible_p (__typeof (x), _Float128) \ ? __isinff128 (x) : __builtin_isinf_sign (x)) # elif (__GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__) \ - || __glibc_clang_prereq (3,7) + || defined(__clang__) # define isinf(x) __builtin_isinf_sign (x) # else # define isinf(x) __MATH_TG ((x), __isinf, (x)) diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h index 12b424e85c..d28af8b30a 100644 --- a/misc/sys/cdefs.h +++ b/misc/sys/cdefs.h @@ -39,9 +39,7 @@ #if defined __has_attribute && __has_attribute (...) even though they do not need to evaluate the right-hand side of the &&. Similarly for __has_builtin, etc. */ -#if (defined __has_attribute \ - && (!defined __clang_minor__ \ - || 3 < __clang_major__ + (5 <= __clang_minor__))) +#if (defined __has_attribute) # define __glibc_has_attribute(attr) __has_attribute (attr) #else # define __glibc_has_attribute(attr) 0 @@ -126,9 +124,7 @@ #endif -/* The overloadable attribute was added on clang 2.6. */ -#if defined __clang_major__ \ - && (__clang_major__ + (__clang_minor__ >= 6) > 2) +#if defined __clang__ # define __attribute_overloadable__ __attribute__((__overloadable__)) #else # define __attribute_overloadable__ @@ -530,8 +526,7 @@ #if (!defined _Noreturn \ && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ - && !(__GNUC_PREREQ (4,7) \ - || (3 < __clang_major__ + (5 <= __clang_minor__)))) + && !(__GNUC_PREREQ (4,7) || defined(__clang__))) # define _Noreturn __attribute__ ((__noreturn__)) #endif @@ -556,7 +551,7 @@ #if (!defined _Static_assert && !defined __cplusplus \ && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ - && (!(__GNUC_PREREQ (4, 6) || __clang_major__ >= 4) \ + && (!(__GNUC_PREREQ (4, 6) || defined(__clang__)) \ || defined __STRICT_ANSI__)) # define _Static_assert(expr, diagnostic) \ extern int (*__Static_assert_function (void)) \ @@ -642,7 +637,7 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf Note: MESSAGE must be a _single_ string; concatenation of string literals is not supported. */ -#if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5) +#if __GNUC_PREREQ (4,8) || defined(__clang__) # define __glibc_macro_warning1(message) _Pragma (#message) # define __glibc_macro_warning(message) \ __glibc_macro_warning1 (GCC warning message) diff --git a/string/bits/string_fortified.h b/string/bits/string_fortified.h index 9916e17aa0..c7f7cb0e35 100644 --- a/string/bits/string_fortified.h +++ b/string/bits/string_fortified.h @@ -114,7 +114,7 @@ __NTH (strncpy (__fortify_clang_overload_arg (char *, __restrict, __dest), } #ifdef __USE_XOPEN2K8 -# if __GNUC_PREREQ (4, 7) || __glibc_clang_prereq (2, 6) +# if __GNUC_PREREQ (4, 7) || defined(__clang__) __fortify_function __attribute_overloadable__ char * __NTH (stpncpy (__fortify_clang_overload_arg (char *, ,__dest), const char *__src, size_t __n)) diff --git a/string/string.h b/string/string.h index 54faf8ed8e..03987fa352 100644 --- a/string/string.h +++ b/string/string.h @@ -34,7 +34,7 @@ __BEGIN_DECLS /* Tell the caller that we provide correct C++ prototypes. */ #if defined __cplusplus && (__GNUC_PREREQ (4, 4) \ - || __glibc_clang_prereq (3, 5)) + || defined(__clang__)) # define __CORRECT_ISO_CPP_STRING_H_PROTO #endif diff --git a/sysdeps/x86/bits/floatn.h b/sysdeps/x86/bits/floatn.h index 4674165bd7..3407874096 100644 --- a/sysdeps/x86/bits/floatn.h +++ b/sysdeps/x86/bits/floatn.h @@ -31,7 +31,7 @@ #if (defined __x86_64__ \ ? __GNUC_PREREQ (4, 3) \ : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4))) \ - || (__glibc_clang_prereq (3, 9) \ + || (defined(__clang__) \ && (!defined __INTEL_LLVM_COMPILER \ || !defined SYCL_LANGUAGE_VERSION)) # define __HAVE_FLOAT128 1 @@ -93,7 +93,7 @@ typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__))); /* The type _Float128 exists only since GCC 7.0. */ # if !__GNUC_PREREQ (7, 0) \ || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) \ - || __glibc_clang_prereq (3, 9) + || defined(__clang__) typedef __float128 _Float128; # endif