From patchwork Sun Nov 9 21:52:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alejandro Colomar X-Patchwork-Id: 123836 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 98CCD3858C52 for ; Sun, 9 Nov 2025 21:56:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 98CCD3858C52 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=ABtkiwxu X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by sourceware.org (Postfix) with ESMTPS id D7B3F3858C56 for ; Sun, 9 Nov 2025 21:52:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D7B3F3858C56 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 D7B3F3858C56 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=172.234.252.31 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1762725173; cv=none; b=FFIKedhSlqfRmJWysKDxFEvXsgDl4XJnEhcrqTy3EhkG0JGXOGeq8mzBZxdDxEN2NfkziPwPbpTgIUyzmkQz9itHRSxEJurhAuEKzbCPA7JZU+HxOk5x1RTC31tGADWhQeKduDeIDvgya2X0LFosRJQXCzfyiJ5tjGTt/EEg/5I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1762725173; c=relaxed/simple; bh=BsPawCB6R+oafKIXUsYoSEfg0LTDPFP9fEKQCumg5CQ=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=SXPPKn7uIjbdw58S6AlED3G6ykbaugYM4Y2LT7rn+t+K+iVF8C8YoOxzrzx8ihk+F9HOKptLaeng2GxjQeSL9Ot3MOe9SKTlM2yzlxfC3FDpXOpaxZCSjF0XLeIIcHxo1n1+2rXhIfCSDF94TaoNwKO2Ij1QEeTSyfQuO9iYRv0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D7B3F3858C56 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id F3587444FC for ; Sun, 9 Nov 2025 21:52:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32E90C4CEFB; Sun, 9 Nov 2025 21:52:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762725171; bh=BsPawCB6R+oafKIXUsYoSEfg0LTDPFP9fEKQCumg5CQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ABtkiwxuqGS6Dd+YYa/55kSqImEfa1NFeswellg6WjbGBTPbeJU3jSBg6XPDNeqqh lynYgUOxAS1mJNJFjxXCNELcUU3VOcAsOtC33LwWeJQxMSJdaG/DJjTeQGj1bOnWuC HTiIl46yMm16p4ZxnhzvOoMpSb4XZ5e5qyr9CdeiJ1FPS7+UdezxSwTjCMLa4RYweg qh2QQeb0SiYBny3V20LaXdtSsJ6zYowPenyPfL21ppI7u6FhN/RnHAOItbM2L00NsQ HMByVEzYsXa8vCLHKdR6ivwcAg+e8AQx/KfSTUr6naO3lYcZ+gzoA13Sz4QOk55cZF 1UvMcU7ZZO5oA== Date: Sun, 9 Nov 2025 22:52:49 +0100 From: Alejandro Colomar To: libc-alpha@sourceware.org Cc: Alejandro Colomar Subject: [PATCH v1 02/35] Assume __GNUC__ >= 2 Message-ID: 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.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, 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 --- ctype/ctype.h | 4 +- include/limits.h | 80 ---------------------------- intl/dcigettext.c | 5 -- libio/oldstdfiles.c | 4 -- misc/sys/cdefs.h | 10 ---- posix/regex_internal.h | 2 +- stdlib/longlong.h | 9 +--- sysdeps/generic/machine-gmon.h | 6 +-- sysdeps/mach/hurd/x86/sys/io.h | 4 -- sysdeps/unix/sysv/linux/x86/sys/io.h | 4 -- time/strptime_l.c | 6 --- 11 files changed, 6 insertions(+), 128 deletions(-) diff --git a/ctype/ctype.h b/ctype/ctype.h index 3864c90617..0da70c8d96 100644 --- a/ctype/ctype.h +++ b/ctype/ctype.h @@ -216,7 +216,7 @@ __NTH (toupper (int __c)) } # endif -# if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus +# if defined __OPTIMIZE__ && !defined __cplusplus # define tolower(c) __tobody (c, tolower, *__ctype_tolower_loc (), (c)) # define toupper(c) __tobody (c, toupper, *__ctype_toupper_loc (), (c)) # endif /* Optimizing gcc */ @@ -271,7 +271,7 @@ extern int tolower_l (int __c, locale_t __l) __THROW; extern int __toupper_l (int __c, locale_t __l) __THROW; extern int toupper_l (int __c, locale_t __l) __THROW; -# if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus +# if defined __OPTIMIZE__ && !defined __cplusplus # define __tolower_l(c, locale) \ __tobody (c, __tolower_l, (locale)->__ctype_tolower, (c, locale)) # define __toupper_l(c, locale) \ diff --git a/include/limits.h b/include/limits.h index 905849b736..6d69c86f08 100644 --- a/include/limits.h +++ b/include/limits.h @@ -32,86 +32,6 @@ #define MB_LEN_MAX 16 -/* If we are not using GNU CC we have to define all the symbols ourself. - Otherwise use gcc's definitions (see below). */ -#if __GNUC__ < 2 - -/* We only protect from multiple inclusion here, because all the other - #include's protect themselves, and in GCC 2 we may #include_next through - multiple copies of this file before we get to GCC's. */ -# ifndef _LIMITS_H -# define _LIMITS_H 1 - -#include - -/* We don't have #include_next. - Define ANSI for standard 32-bit words. */ - -/* These assume 8-bit `char's, 16-bit `short int's, - and 32-bit `int's and `long int's. */ - -/* Number of bits in a `char'. */ -# define CHAR_BIT 8 - -/* Minimum and maximum values a `signed char' can hold. */ -# define SCHAR_MIN (-128) -# define SCHAR_MAX 127 - -/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */ -# define UCHAR_MAX 255 - -/* Minimum and maximum values a `char' can hold. */ -# ifdef __CHAR_UNSIGNED__ -# define CHAR_MIN 0 -# define CHAR_MAX UCHAR_MAX -# else -# define CHAR_MIN SCHAR_MIN -# define CHAR_MAX SCHAR_MAX -# endif - -/* Minimum and maximum values a `signed short int' can hold. */ -# define SHRT_MIN (-32768) -# define SHRT_MAX 32767 - -/* Maximum value an `unsigned short int' can hold. (Minimum is 0.) */ -# define USHRT_MAX 65535 - -/* Minimum and maximum values a `signed int' can hold. */ -# define INT_MIN (-INT_MAX - 1) -# define INT_MAX 2147483647 - -/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */ -# define UINT_MAX 4294967295U - -/* Minimum and maximum values a `signed long int' can hold. */ -# if __WORDSIZE == 64 -# define LONG_MAX 9223372036854775807L -# else -# define LONG_MAX 2147483647L -# endif -# define LONG_MIN (-LONG_MAX - 1L) - -/* Maximum value an `unsigned long int' can hold. (Minimum is 0.) */ -# if __WORDSIZE == 64 -# define ULONG_MAX 18446744073709551615UL -# else -# define ULONG_MAX 4294967295UL -# endif - -# ifdef __USE_ISOC99 - -/* Minimum and maximum values a `signed long long int' can hold. */ -# define LLONG_MAX 9223372036854775807LL -# define LLONG_MIN (-LLONG_MAX - 1LL) - -/* Maximum value an `unsigned long long int' can hold. (Minimum is 0.) */ -# define ULLONG_MAX 18446744073709551615ULL - -# endif /* ISO C99 */ - -# endif /* limits.h */ -#endif /* GCC 2. */ - #endif /* !_LIBC_LIMITS_H_ */ /* Get the compiler's limits.h, which defines almost all the ISO constants. diff --git a/intl/dcigettext.c b/intl/dcigettext.c index cb33a589a1..fe5c19bf37 100644 --- a/intl/dcigettext.c +++ b/intl/dcigettext.c @@ -95,12 +95,7 @@ extern int errno; #endif /* Alignment of types. */ -#if __GNUC__ >= 2 # define alignof(TYPE) __alignof__ (TYPE) -#else -# define alignof(TYPE) \ - ((int) &((struct { char dummy1; TYPE dummy2; } *) 0)->dummy2) -#endif /* Some compilers, like SunOS4 cc, don't have offsetof in . */ #ifndef offsetof diff --git a/libio/oldstdfiles.c b/libio/oldstdfiles.c index 250bf9e616..af793413ba 100644 --- a/libio/oldstdfiles.c +++ b/libio/oldstdfiles.c @@ -52,8 +52,6 @@ compat_symbol (libc, _IO_stdin_, _IO_stdin_, GLIBC_2_0); compat_symbol (libc, _IO_stdout_, _IO_stdout_, GLIBC_2_0); compat_symbol (libc, _IO_stderr_, _IO_stderr_, GLIBC_2_0); -#if __GNUC__ >= 2 - #include extern const int _IO_stdin_used; @@ -96,5 +94,3 @@ _IO_check_libio (void) } #endif - -#endif diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h index a4ae665d8a..71e2ec92d5 100644 --- a/misc/sys/cdefs.h +++ b/misc/sys/cdefs.h @@ -383,8 +383,6 @@ Example: int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */ -#if (__GNUC__ >= 2) || (__clang_major__ >= 4) - # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) # ifdef __cplusplus # define __REDIRECT_NTH(name, proto, alias) \ @@ -408,14 +406,6 @@ #define __REDIRECT_FORTIFY_NTH __REDIRECT_NTH #endif -/* -#elif __SOME_OTHER_COMPILER__ - -# define __REDIRECT(name, proto, alias) name proto; \ - _Pragma("let " #name " = " #alias) -*/ -#endif - /* At some point during the gcc 2.96 development the `malloc' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ diff --git a/posix/regex_internal.h b/posix/regex_internal.h index 722da1b7d2..34c7c32764 100644 --- a/posix/regex_internal.h +++ b/posix/regex_internal.h @@ -347,7 +347,7 @@ typedef struct Idx idx; /* for BACK_REF */ re_context_type ctx_type; /* for ANCHOR */ } opr; -#if (__GNUC__ >= 2 || defined __clang__) && !defined __STRICT_ANSI__ +#if !defined __STRICT_ANSI__ re_token_type_t type : 8; #else re_token_type_t type; diff --git a/stdlib/longlong.h b/stdlib/longlong.h index 49a78c9596..0be2159111 100644 --- a/stdlib/longlong.h +++ b/stdlib/longlong.h @@ -112,15 +112,10 @@ extern const UQItype __clz_tab[256] attribute_hidden; #if !defined (NO_ASM) -/* We sometimes need to clobber "cc" with gcc2, but that would not be - understood by gcc1. Use cpp to avoid major code duplication. */ -#if __GNUC__ < 2 -#define __CLOBBER_CC -#define __AND_CLOBBER_CC -#else /* __GNUC__ >= 2 */ +/* We sometimes need to clobber "cc". + Use cpp to avoid major code duplication. */ #define __CLOBBER_CC : "cc" #define __AND_CLOBBER_CC , "cc" -#endif /* __GNUC__ < 2 */ #if defined (__aarch64__) diff --git a/sysdeps/generic/machine-gmon.h b/sysdeps/generic/machine-gmon.h index 20babbbaf5..e4a6528f47 100644 --- a/sysdeps/generic/machine-gmon.h +++ b/sysdeps/generic/machine-gmon.h @@ -16,7 +16,7 @@ License along with the GNU C Library; if not, see . */ -/* GCC version 2 gives us a perfect magical function to get +/* GCC gives us a perfect magical function to get just the information we need: void *__builtin_return_address (unsigned int N) returns the return address of the frame N frames up. */ @@ -25,10 +25,6 @@ for N != 0 on all machines. In this case, you may have to write your own version of _mcount(). */ -#if __GNUC__ < 2 - #error "This file uses __builtin_return_address, a GCC 2 extension." -#endif - #include /* The canonical name for the function is `_mcount' in both C and asm, but some old asm code might assume it's `mcount'. */ diff --git a/sysdeps/mach/hurd/x86/sys/io.h b/sysdeps/mach/hurd/x86/sys/io.h index 24e0ecf7df..1dd5b324b5 100644 --- a/sysdeps/mach/hurd/x86/sys/io.h +++ b/sysdeps/mach/hurd/x86/sys/io.h @@ -34,8 +34,6 @@ extern int ioperm (unsigned long int __from, unsigned long int __num, privileges. */ extern int iopl (int __level) __THROW; -#if __GNUC__ >= 2 - static __inline unsigned char inb (unsigned short int port) { @@ -171,7 +169,5 @@ outsl (unsigned short int port, const void *addr, unsigned long int count) "=c" (count):"d" (port), "0" (addr), "1" (count)); } -#endif /* GNU C */ - __END_DECLS #endif /* _SYS_IO_H */ diff --git a/sysdeps/unix/sysv/linux/x86/sys/io.h b/sysdeps/unix/sysv/linux/x86/sys/io.h index af65e556b2..b9eda87faf 100644 --- a/sysdeps/unix/sysv/linux/x86/sys/io.h +++ b/sysdeps/unix/sysv/linux/x86/sys/io.h @@ -37,8 +37,6 @@ extern int ioperm (unsigned long int __from, unsigned long int __num, privileges. */ extern int iopl (int __level) __THROW; -#if __GNUC__ >= 2 - static __inline unsigned char inb (unsigned short int __port) { @@ -177,7 +175,5 @@ outsl (unsigned short int __port, const void *__addr, :"d" (__port), "0" (__addr), "1" (__count)); } -#endif /* GNU C */ - __END_DECLS #endif /* _SYS_IO_H */ diff --git a/time/strptime_l.c b/time/strptime_l.c index 988ee0b655..ab5d4447bd 100644 --- a/time/strptime_l.c +++ b/time/strptime_l.c @@ -56,17 +56,11 @@ localtime_r (const time_t *t, struct tm *tp) #define match_char(ch1, ch2) if (ch1 != ch2) return NULL -#if __GNUC__ >= 2 # define match_string(cs1, s2) \ ({ size_t len = strlen (cs1); \ int result = __strncasecmp_l ((cs1), (s2), len, locale) == 0; \ if (result) (s2) += len; \ result; }) -#else -/* Oh come on. Get a reasonable compiler. */ -# define match_string(cs1, s2) \ - (strncasecmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1)) -#endif /* We intentionally do not use isdigit() for testing because this will lead to problems with the wide character version. */ #define get_number(from, to, n) \