From patchwork Fri Dec 13 07:13:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 102958 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 29F493858C52 for ; Fri, 13 Dec 2024 07:16:01 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id 40D873858D35 for ; Fri, 13 Dec 2024 07:13:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 40D873858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 40D873858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::32d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734073996; cv=none; b=ZhT8utTQ4L40C6xojeBrToF00PkkRfLBA2IUOPjpfmVft55NopQUMefdkqvfYkbxN9vNrPYmpTP4i6rkV30hQ/DTiqVyETFTU1pt6zFhl3UDaq+edZHzEAkKnlPrEWldL3rYgWgv5npGpoYo0WPKfaZxLnE7q8IolKO6kDl8cBk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734073996; c=relaxed/simple; bh=qhzvAgo/x+pMYhZLJBIHB2YbQOKm5CW7Qrezwz9K8lA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=gxJR4nr08btpbmi3mEp6eXWb3EKqqUjtfLV5aLGxeMtpRDpfLgScX7WgSNfpRANizPoIo699HQpDPIlz+o+iTcpfizRkdLWj7fmY7mpy1Sy8gwl7Ph/8reInpdzxCC9f2Y7DPN/D1hIO95wnmOac5yorC82hcvuNh1YZtMdyjMw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 40D873858D35 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=AHAueua4 Received: by mail-ot1-x32d.google.com with SMTP id 46e09a7af769-71e2aa8d5e3so772909a34.2 for ; Thu, 12 Dec 2024 23:13:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734073995; x=1734678795; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ssjaCgCoOBChx3NYtgt0MAcBdK+4fGjemoVHpRhfsnY=; b=AHAueua47vLakWYmWkZbA8aFciK/aNPClo8oeLxoFL/6aUNsQDiKd71PE7sqUbDqNl 8d4t9AWioYGAL2fy2BRVoMLWCNAw3NZeUNd6KAcnQPnweeleSAI3MdWZhy1CsKpIcHjT cMEG38DvoV6R04ggF2s0DXjwzXA4tTwRlSodkhkzD7sljS79lfKseVjeDqGU2FqyyrD8 s/KMGTylcFVK9FzqJj7n7Fy8qRAxyVMY4/0TcgIGGMHr0aDrArpMev8z0AjZ8UYgEYns EtiU+mvyiRd4hR6zdbvfnmVeJpWr+gsBvFaxAl4S/rm54qcd5Xkmceo5+6rP6mdVVud8 Yxlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734073995; x=1734678795; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ssjaCgCoOBChx3NYtgt0MAcBdK+4fGjemoVHpRhfsnY=; b=Jp9tG8f3ztUGksqJoNyPliPNYFae8M03biYnD5lY0Gbdu1bGpn/OAE9WUZSAjYSsQu 8p/mPRuV3MMkqX8kbzHPhOWhmGcJJZQnWBC3fOxvrSs2x8iQMB3Sk4jLiiCy4doDq6vS C9YTdmZzxnlEg2CtUwmBwQ4sQehB1RlnLmHBhHNMBqdtD7ucpQPoxx3B6QB+K0cHAvLA Q+fyOKd+lBUnEedONU2iueD71A4NMZvEq1P5wfIC1b5PjKyHO68PyyqnOZV2zYpRwDwe Q3lQqIl0UuX7tSaXQ2JLyqb+xUKADkXnaMZZj+lITiWOABMT28wnTx6M+38Yar6utL6O Cetw== X-Gm-Message-State: AOJu0YydyU3t415U+Ck7J0mFVLuK0yD1bD73OK+2wehpWlPRaJDinH0t Alxajrujbx9O4BDBLPcAC0P/0v4fOfg5DiC9tVeGAxhQvFWQ1zG92TcR/HwwC7x5tXT3 X-Gm-Gg: ASbGncuFywsziFvdhuC++eKctTIPySU+ZMYOddtvQbmQhyODtz43KvfzEgZWSxpT4rJ sRUjGovK6O2/tMiom0t9tELrbB8JqqsD3c93o9kiLL96Ve4U9YPl46/Y2PaOkyckg+e24b5A1sb 6F8tOMzmZbCj2pz+J6okv2uvnwVufuvpt4D0mc7iEvGO9jnPTx5+rKoSguCz1U8+mdRwTUZkI20 /Wa28pzErAEVQWHZANURTjZJZD0BwYwTAsD4N8l7IMYRuDNhtz106FC0dCiOlvuVxfZJ+ScMCJP exhm97xSCSVzSzqu X-Google-Smtp-Source: AGHT+IGryzwAkK9QXj0XLh6bbwnVvNQ3ZN9e9RdGE5vL67yiI7hsSSdX/VicNypFkh8DezsQoEGsDA== X-Received: by 2002:a05:6830:f97:b0:710:f375:a6c9 with SMTP id 46e09a7af769-71e3b85a69bmr654605a34.7.1734073995189; Thu, 12 Dec 2024 23:13:15 -0800 (PST) Received: from gnu-tgl-3.localdomain ([172.58.27.218]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-71e29ba9968sm794092a34.61.2024.12.12.23.13.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2024 23:13:14 -0800 (PST) Received: from gnu-tgl-3.. (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id D9F5FC0270; Fri, 13 Dec 2024 15:13:10 +0800 (CST) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: sam@gentoo.org Subject: [PATCH 02/10] regex.h: Avoid #elif __STDC_VERSION__ Date: Fri, 13 Dec 2024 15:13:02 +0800 Message-ID: <20241213071310.2054769-3-hjl.tools@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241213071310.2054769-1-hjl.tools@gmail.com> References: <20241213071310.2054769-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3019.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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 GCC 4.9 doesn't define __STDC_VERSION__ and issues an error: In file included from ../include/regex.h:2:0, from ../posix/re_comp.h:23, from ../include/re_comp.h:1, from /tmp/cih_test_7IKTRI.c:10: ../posix/regex.h:650:19: error: "__STDC_VERSION__" is not defined [-Werror=undef] # elif 199901L <= __STDC_VERSION__ || defined restrict ^ Use "#else" instead. Signed-off-by: H.J. Lu Reviewed-by: Sam James --- posix/regex.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/posix/regex.h b/posix/regex.h index ccf40cebc0..004dc62405 100644 --- a/posix/regex.h +++ b/posix/regex.h @@ -647,10 +647,12 @@ extern int re_exec (const char *); || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ || __clang_major__ >= 3 # define _Restrict_ __restrict -# elif 199901L <= __STDC_VERSION__ || defined restrict -# define _Restrict_ restrict # else -# define _Restrict_ +# if 199901L <= __STDC_VERSION__ || defined restrict +# define _Restrict_ restrict +# else +# define _Restrict_ +# endif # endif #endif /* For the ISO C99 syntax @@ -661,13 +663,15 @@ extern int re_exec (const char *); #ifndef _Restrict_arr_ # ifdef __restrict_arr # define _Restrict_arr_ __restrict_arr -# elif ((199901L <= __STDC_VERSION__ \ +# else +# if ((199901L <= __STDC_VERSION__ \ || 3 < __GNUC__ + (1 <= __GNUC_MINOR__) \ || __clang_major__ >= 3) \ && !defined __cplusplus) -# define _Restrict_arr_ _Restrict_ -# else -# define _Restrict_arr_ +# define _Restrict_arr_ _Restrict_ +# else +# define _Restrict_arr_ +# endif # endif #endif