From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 414051F4B4 for ; Wed, 20 Jan 2021 02:56:07 +0000 (UTC) Received: from localhost ([::1]:53620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l23fB-0007C5-UO for normalperson@yhbt.net; Tue, 19 Jan 2021 21:56:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42944) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l23f7-0007Br-4G for bug-gnulib@gnu.org; Tue, 19 Jan 2021 21:56:02 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:56636) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l23f3-0003sO-0A for bug-gnulib@gnu.org; Tue, 19 Jan 2021 21:56:00 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 0A1CF1600DB; Tue, 19 Jan 2021 18:55:53 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id xcqXwOfJr-z3; Tue, 19 Jan 2021 18:55:51 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B9AF6160158; Tue, 19 Jan 2021 18:55:51 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id wqsinhSED6eu; Tue, 19 Jan 2021 18:55:51 -0800 (PST) Received: from [192.168.1.9] (cpe-23-243-218-95.socal.res.rr.com [23.243.218.95]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 818981600DB; Tue, 19 Jan 2021 18:55:51 -0800 (PST) To: Bruno Haible References: <20201230201507.2755086-1-adhemerval.zanella@linaro.org> <909632B5-141E-4567-8E62-3DAF91CB8E33@arm.com> <74ac97a1-2186-1937-4595-ab7409d663d0@linaro.org> <2108975.lN1YhbmyTB@omega> From: Paul Eggert Organization: UCLA Computer Science Department Subject: Re: [PATCH 1/5] posix: Sync regex code with gnulib Message-ID: <05f5e913-f1d1-b2f9-beb7-f226588733c0@cs.ucla.edu> Date: Tue, 19 Jan 2021 18:55:51 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <2108975.lN1YhbmyTB@omega> Content-Type: multipart/mixed; boundary="------------6A5FED4903F58D31BF6496DA" Content-Language: en-US Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@cs.ucla.edu; helo=zimbra.cs.ucla.edu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bug-gnulib@gnu.org, "libc-alpha@sourceware.org" , Vaseeharan Vinayagamoorthy , Adhemerval Zanella Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" This is a multi-part message in MIME format. --------------6A5FED4903F58D31BF6496DA Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable On 1/19/21 7:43 AM, Bruno Haible wrote: > Adhemerval Zanella wrote: >> -# if (__GNUC__ >=3D 7) || (__clang_major__ >=3D 10) >> +# if (__GNUC__ >=3D 7) || (defined __clang_major__ &&__clang_major__ = >=3D 10) > I would write it as: >=20 > +# if (__GNUC__ >=3D 7) || (defined __clang__ && __clang_major__ >=3D 1= 0) This line should be used only if _LIBC is defined, so we can simplify it=20 to just "#if __GNUC__ >=3D 7" and thus not worry about Clang. I see that Gnulib wasn't consistent about this, so I installed the=20 attached patch to Gnulib to fix the issue here and elsewhere. The idea=20 is that the Gnulib regex_internal.h can be copied back to glibc, and=20 that the other uses in Gnulib should be similar. On 1/19/21 6:43 AM, Adhemerval Zanella wrote: > Paul, this seemed to a common pattern scatter on multiple file in gnuli= b. > Wouldn't be better to consolidate it on cdefs.h? We could append something like the following to cdefs.h, and switch to=20 __attribute_fallthrough__ for modules shared between the two systems. Is=20 that something you'd like to pursue? (We should also sync Gnulib cdefs.h=20 back to glibc of course.) #if defined __STDC_VERSION__ && 201710L < __STDC_VERSION__ # define __attribute_fallthrough__ [[__fallthrough__]] #elif __GNUC_PREREQ (7, 0) || __glibc_has_attribute (__fallthrough__) # define __attribute_fallthrough__ __attribute__ ((__fallthrough__)) #else # define __attribute_fallthrough__ ((void) 0) #endif --------------6A5FED4903F58D31BF6496DA Content-Type: text/x-patch; charset=UTF-8; name="0001-fnmatch-regex-fts-FALLTHROUGH-consistency.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-fnmatch-regex-fts-FALLTHROUGH-consistency.patch" =46rom 5c52f00c69f39fe86ec087654893087a83290ee7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 19 Jan 2021 18:35:30 -0800 Subject: [PATCH] fnmatch, regex, fts: FALLTHROUGH consistency MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit Be more consistent about how FALLTHROUGH is defined. For Gnulib, use attribute.h. For glibc, use __GNUC__ >=3D 7. Problem for glibc reported by Vaseeharan Vinayagamoorthy in: https://sourceware.org/pipermail/libc-alpha/2021-January/121778.html * lib/fnmatch.c (FALLTHROUGH) [_LIBC]: * lib/regex_internal.h (FALLTHROUGH) [_LIBC]: Don=E2=80=99t worry about Clang, as it=E2=80=99s not needed and provokes = GCC. * lib/fts.c (FALLTHROUGH) [!_LIBC]: * lib/regex_internal.h (FALLTHROUGH) [!_LIBC]: Rely on attribute.h for FALLTHROUGH * modules/regex: Depend on attribute module. --- ChangeLog | 15 +++++++++++++++ lib/fnmatch.c | 2 +- lib/fts.c | 4 ++-- lib/regex_internal.h | 6 ++++-- modules/regex | 1 + 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 269577caa..290fa1b4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2021-01-19 Paul Eggert + + fnmatch, regex, fts: FALLTHROUGH consistency + Be more consistent about how FALLTHROUGH is defined. + For Gnulib, use attribute.h. For glibc, use __GNUC__ >=3D 7. + Problem for glibc reported by Vaseeharan Vinayagamoorthy in: + https://sourceware.org/pipermail/libc-alpha/2021-January/121778.html + * lib/fnmatch.c (FALLTHROUGH) [_LIBC]: + * lib/regex_internal.h (FALLTHROUGH) [_LIBC]: + Don=E2=80=99t worry about Clang, as it=E2=80=99s not needed and provoke= s GCC. + * lib/fts.c (FALLTHROUGH) [!_LIBC]: + * lib/regex_internal.h (FALLTHROUGH) [!_LIBC]: + Rely on attribute.h for FALLTHROUGH + * modules/regex: Depend on attribute module. + 2021-01-19 KO Myung-Hun =20 spawn-pipe: Fix SIGSEGV on OS/2 kLIBC. diff --git a/lib/fnmatch.c b/lib/fnmatch.c index 5896812c9..b8a71f164 100644 --- a/lib/fnmatch.c +++ b/lib/fnmatch.c @@ -64,7 +64,7 @@ extern int fnmatch (const char *pattern, const char *st= ring, int flags); #endif =20 #ifdef _LIBC -# if (__GNUC__ >=3D 7) || (__clang_major__ >=3D 10) +# if __GNUC__ >=3D 7 # define FALLTHROUGH __attribute__ ((__fallthrough__)) # else # define FALLTHROUGH ((void) 0) diff --git a/lib/fts.c b/lib/fts.c index 8a9b5ed96..e6603f40e 100644 --- a/lib/fts.c +++ b/lib/fts.c @@ -200,8 +200,8 @@ enum Fts_stat while (false) #endif =20 -#ifndef FALLTHROUGH -# if (__GNUC__ >=3D 7) || (__clang_major__ >=3D 10) +#ifdef _LIBC +# if __GNUC__ >=3D 7 # define FALLTHROUGH __attribute__ ((__fallthrough__)) # else # define FALLTHROUGH ((void) 0) diff --git a/lib/regex_internal.h b/lib/regex_internal.h index b4f91d9ec..3fa2bf1aa 100644 --- a/lib/regex_internal.h +++ b/lib/regex_internal.h @@ -830,12 +830,14 @@ re_string_elem_size_at (const re_string_t *pstr, Id= x idx) } #endif /* RE_ENABLE_I18N */ =20 -#ifndef FALLTHROUGH -# if (__GNUC__ >=3D 7) || (__clang_major__ >=3D 10) +#ifdef _LIBC +# if __GNUC__ >=3D 7 # define FALLTHROUGH __attribute__ ((__fallthrough__)) # else # define FALLTHROUGH ((void) 0) # endif +#else +# include "attribute.h" #endif =20 #endif /* _REGEX_INTERNAL_H */ diff --git a/modules/regex b/modules/regex index 20cbe375a..a32c46e18 100644 --- a/modules/regex +++ b/modules/regex @@ -16,6 +16,7 @@ Depends-on: c99 extensions ssize_t +attribute [test $ac_use_included_regex =3D yes] btowc [test $ac_use_included_regex =3D yes] builtin-expect [test $ac_use_included_regex =3D yes] dynarray [test $ac_use_included_regex =3D yes] --=20 2.27.0 --------------6A5FED4903F58D31BF6496DA--