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=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_BLOCKED, 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 8AFAD1F4B4 for ; Tue, 19 Jan 2021 14:43:19 +0000 (UTC) Received: from localhost ([::1]:55440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1sE2-00026I-B7 for normalperson@yhbt.net; Tue, 19 Jan 2021 09:43:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1sDz-00023B-0f for bug-gnulib@gnu.org; Tue, 19 Jan 2021 09:43:15 -0500 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]:45524) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1sDu-00050w-VV for bug-gnulib@gnu.org; Tue, 19 Jan 2021 09:43:14 -0500 Received: by mail-qk1-x72c.google.com with SMTP id b64so21991684qkc.12 for ; Tue, 19 Jan 2021 06:43:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:autocrypt:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ma/AlDs+avRrsT+0y0Swzr7GHZ1+hytPjOzNA9U1QrA=; b=XJz8tPxPwZAiAbGMC5xLnvGroP0yBMHfmMUxOKEfo4a4jIPlMbrW+LyQC/XOPNT9x6 KaR29zn0w+3uxpKv5aG3ofrobJIZIAJpnoz7RYX6d/YblXi10yp0wyokb8SyBihccEQR hoYJl3rHjxg1n50T+MPUu8/30TsvzkK8eI0ohI38ZN5QYGbzNdiziUmvJNeoBPtDfjSM COqMGwMbp6XXfxlEQ6MBJ4YrajhMzHhBmfFV2cqypvHqlgIn3sUD5/EJ5vhrWcinyBB+ B6agppqN+pJC2HC1N9eA1VQluotvp3p29sOgWQJ9rOF7qbcYr9UFZrT9eIMpMfrkvbRh vEYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=ma/AlDs+avRrsT+0y0Swzr7GHZ1+hytPjOzNA9U1QrA=; b=lUwd0OmhTqR+Yqwk0CJjQw9090zih0Gu+NezNLGK0ODkfOLkJIzKqoxGFyvxmco5lR VtNfG7IuePtwQfXKKHItT+02DUU3QnpWwNDyCH8u/+C2/rHaH8Ys5uhrUwlRBaz1LdKn xsxZNse9iKDIRdBoXSEeeOFe+/ztoZ00N4cUQlKiEvEEnvz6g9vDgoD7OShJCrewZaOw qZ3HnnW+2x2TbI3XBFEbSRCZMd3FVIRHmBCpvctu0UXDIdNCyK7yCQOkR3U9rx3UH+X8 m4dCm8SVV2wvOe+SFs9owJizmRAXYqZxT97aaYd4CtOZ3/ExF+0DQ8E3zQ43sd2GR4CZ QZYw== X-Gm-Message-State: AOAM532w/CTgLYTY92+Dr/kC+nyPNUH4a4BR8Lu7C7kbclkr2lfD/f13 q6FC9xCUKRvSuAOu2i8aXMmULK9CMwtu+Q== X-Google-Smtp-Source: ABdhPJzSHh8Ts8eEadoVYefzz3Rwd+CTpXocIDs/d4T0Ge6hZ4cLpKJKeDbspUd9g1qtlFYpIU52Cg== X-Received: by 2002:ae9:d847:: with SMTP id u68mr4550529qkf.409.1611067389468; Tue, 19 Jan 2021 06:43:09 -0800 (PST) Received: from [192.168.1.4] ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id f24sm12800133qkk.89.2021.01.19.06.43.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Jan 2021 06:43:09 -0800 (PST) Subject: Re: [PATCH 1/5] posix: Sync regex code with gnulib To: Vaseeharan Vinayagamoorthy , "libc-alpha@sourceware.org" , Paul Eggert References: <20201230201507.2755086-1-adhemerval.zanella@linaro.org> <909632B5-141E-4567-8E62-3DAF91CB8E33@arm.com> From: Adhemerval Zanella Autocrypt: addr=adhemerval.zanella@linaro.org; prefer-encrypt=mutual; keydata= mQINBFcVGkoBEADiQU2x/cBBmAVf5C2d1xgz6zCnlCefbqaflUBw4hB/bEME40QsrVzWZ5Nq 8kxkEczZzAOKkkvv4pRVLlLn/zDtFXhlcvQRJ3yFMGqzBjofucOrmdYkOGo0uCaoJKPT186L NWp53SACXguFJpnw4ODI64ziInzXQs/rUJqrFoVIlrPDmNv/LUv1OVPKz20ETjgfpg8MNwG6 iMizMefCl+RbtXbIEZ3TE/IaDT/jcOirjv96lBKrc/pAL0h/O71Kwbbp43fimW80GhjiaN2y WGByepnkAVP7FyNarhdDpJhoDmUk9yfwNuIuESaCQtfd3vgKKuo6grcKZ8bHy7IXX1XJj2X/ BgRVhVgMHAnDPFIkXtP+SiarkUaLjGzCz7XkUn4XAGDskBNfbizFqYUQCaL2FdbW3DeZqNIa nSzKAZK7Dm9+0VVSRZXP89w71Y7JUV56xL/PlOE+YKKFdEw+gQjQi0e+DZILAtFjJLoCrkEX w4LluMhYX/X8XP6/C3xW0yOZhvHYyn72sV4yJ1uyc/qz3OY32CR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/1vbKtjeXLCcRKk3Ulw0bY1OoDxWQr86T2fZGJ/HIZuVVBf3+ gaYJF92GXFynHnea14nFFuFgOni0Mi1zDxYH/8yGGBXvo14KWd8JOW0NJPaCDFJkdS5hu0VY 7vJwKcyHJGxsCLU+Et0mryX8qZwqibJIzu7kUJQdQDljbRPDFd/xmGUFCQiQAncSilYOcxNU EMVCXPAQTteqkvA+gNqSaK1NM9tY0eQ4iJpo+aoX8HAcn4sZzt2pfUB9vQMTBJ2d4+m/qO6+ cFTAceXmIoFsN8+gFN3i8Is3u12u8xGudcBPvpoy4OoG Message-ID: <74ac97a1-2186-1937-4595-ab7409d663d0@linaro.org> Date: Tue, 19 Jan 2021 11:43:06 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <909632B5-141E-4567-8E62-3DAF91CB8E33@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::72c; envelope-from=adhemerval.zanella@linaro.org; helo=mail-qk1-x72c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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" Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" On 19/01/2021 11:16, Vaseeharan Vinayagamoorthy wrote: > After this commit [1], I am seeing -Werror=undef when bootstapping glibc on aarch64-none-linux-gnu : > > In file included from regex.c:70:0: > regex_internal.h:852:26: error: "__clang_major__" is not defined [-Werror=undef] > # if (__GNUC__ >= 7) || (__clang_major__ >= 10) > ^~~~~~~~~~~~~~~ > > The build/host/target setup is: > Build: aarch64-none-linux-gnu (Ubuntu 14.04) > Host: aarch64-none-linux-gnu > Target: aarch64-none-linux-gnu > > [1] > commit c2a150d089fa096cb5f9e342da80fb30dc0d1953 > Author: Adhemerval Zanella > AuthorDate: Tue Dec 29 17:32:25 2020 -0300 > Commit: Adhemerval Zanella > CommitDate: Mon Jan 4 08:38:52 2021 -0300 > > posix: Sync regex code with gnulib > > It sync with gnulib commit 43ee1a6bf. The main change is 9682f18e9. > (which does not have a meaniful description). > > Checked on x86_64-linux-gnu. Does the following help: -- diff --git a/posix/regex_internal.h b/posix/regex_internal.h index e31ac92674..944de219c3 100644 --- a/posix/regex_internal.h +++ b/posix/regex_internal.h @@ -849,7 +849,7 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx) #endif /* RE_ENABLE_I18N */ #ifndef FALLTHROUGH -# if (__GNUC__ >= 7) || (__clang_major__ >= 10) +# if (__GNUC__ >= 7) || (defined __clang_major__ &&__clang_major__ >= 10) # define FALLTHROUGH __attribute__ ((__fallthrough__)) # else # define FALLTHROUGH ((void) 0) -- Paul, this seemed to a common pattern scatter on multiple file in gnulib. Wouldn't be better to consolidate it on cdefs.h? > On 30/12/2020, 20:15, "Libc-alpha on behalf of Adhemerval Zanella via Libc-alpha" wrote: > > It sync with gnulib commit 43ee1a6bf. The main change is 9682f18e9. > (which does not have a meaniful description). > > Checked on x86_64-linux-gnu. > --- > posix/regcomp.c | 2 +- > posix/regex.h | 17 ++++++++++++----- > posix/regex_internal.c | 19 ++++++++++--------- > posix/regex_internal.h | 16 ++++++++++++---- > 4 files changed, 35 insertions(+), 19 deletions(-) > > diff --git a/posix/regcomp.c b/posix/regcomp.c > index 93bb0a0538..692928b0db 100644 > --- a/posix/regcomp.c > +++ b/posix/regcomp.c > @@ -558,7 +558,7 @@ weak_alias (__regerror, regerror) > static const bitset_t utf8_sb_map = > { > /* Set the first 128 bits. */ > -# if defined __GNUC__ && !defined __STRICT_ANSI__ > +# if (defined __GNUC__ || __clang_major__ >= 4) && !defined __STRICT_ANSI__ > [0 ... 0x80 / BITSET_WORD_BITS - 1] = BITSET_WORD_MAX > # else > # if 4 * BITSET_WORD_BITS < ASCII_CHARS > diff --git a/posix/regex.h b/posix/regex.h > index 5fe41c8685..7418e6c76f 100644 > --- a/posix/regex.h > +++ b/posix/regex.h > @@ -612,7 +612,9 @@ extern int re_exec (const char *); > 'configure' might #define 'restrict' to those words, so pick a > different name. */ > #ifndef _Restrict_ > -# if defined __restrict || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) > +# if defined __restrict \ > + || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ > + || __clang_major__ >= 3 > # define _Restrict_ __restrict > # elif 199901L <= __STDC_VERSION__ || defined restrict > # define _Restrict_ restrict > @@ -620,13 +622,18 @@ extern int re_exec (const char *); > # define _Restrict_ > # endif > #endif > -/* For [restrict], use glibc's __restrict_arr if available. > - Otherwise, GCC 3.1 (not in C++ mode) and C99 support [restrict]. */ > +/* For the ISO C99 syntax > + array_name[restrict] > + use glibc's __restrict_arr if available. > + Otherwise, GCC 3.1 and clang support this syntax (but not in C++ mode). > + Other ISO C99 compilers support it as well. */ > #ifndef _Restrict_arr_ > # ifdef __restrict_arr > # define _Restrict_arr_ __restrict_arr > -# elif ((199901L <= __STDC_VERSION__ || 3 < __GNUC__ + (1 <= __GNUC_MINOR__)) \ > - && !defined __GNUG__) > +# elif ((199901L <= __STDC_VERSION__ \ > + || 3 < __GNUC__ + (1 <= __GNUC_MINOR__) \ > + || __clang_major__ >= 3) \ > + && !defined __cplusplus) > # define _Restrict_arr_ _Restrict_ > # else > # define _Restrict_arr_ > diff --git a/posix/regex_internal.c b/posix/regex_internal.c > index e1b6b4d5af..ed0a13461b 100644 > --- a/posix/regex_internal.c > +++ b/posix/regex_internal.c > @@ -300,18 +300,20 @@ build_wcs_upper_buffer (re_string_t *pstr) > while (byte_idx < end_idx) > { > wchar_t wc; > + unsigned char ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]; > > - if (isascii (pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]) > - && mbsinit (&pstr->cur_state)) > + if (isascii (ch) && mbsinit (&pstr->cur_state)) > { > - /* In case of a singlebyte character. */ > - pstr->mbs[byte_idx] > - = toupper (pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]); > /* The next step uses the assumption that wchar_t is encoded > ASCII-safe: all ASCII values can be converted like this. */ > - pstr->wcs[byte_idx] = (wchar_t) pstr->mbs[byte_idx]; > - ++byte_idx; > - continue; > + wchar_t wcu = __towupper (ch); > + if (isascii (wcu)) > + { > + pstr->mbs[byte_idx] = wcu; > + pstr->wcs[byte_idx] = wcu; > + byte_idx++; > + continue; > + } > } > > remain_len = end_idx - byte_idx; > @@ -348,7 +350,6 @@ build_wcs_upper_buffer (re_string_t *pstr) > { > /* It is an invalid character, an incomplete character > at the end of the string, or '\0'. Just use the byte. */ > - int ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]; > pstr->mbs[byte_idx] = ch; > /* And also cast it to wide char. */ > pstr->wcs[byte_idx++] = (wchar_t) ch; > diff --git a/posix/regex_internal.h b/posix/regex_internal.h > index 8c42586c42..4a3cf779bf 100644 > --- a/posix/regex_internal.h > +++ b/posix/regex_internal.h > @@ -77,6 +77,14 @@ > # define isblank(ch) ((ch) == ' ' || (ch) == '\t') > #endif > > +/* regex code assumes isascii has its usual numeric meaning, > + even if the portable character set uses EBCDIC encoding, > + and even if wint_t is wider than int. */ > +#ifndef _LIBC > +# undef isascii > +# define isascii(c) (((c) & ~0x7f) == 0) > +#endif > + > #ifdef _LIBC > # ifndef _RE_DEFINE_LOCALE_FUNCTIONS > # define _RE_DEFINE_LOCALE_FUNCTIONS 1 > @@ -335,7 +343,7 @@ typedef struct > Idx idx; /* for BACK_REF */ > re_context_type ctx_type; /* for ANCHOR */ > } opr; > -#if __GNUC__ >= 2 && !defined __STRICT_ANSI__ > +#if (__GNUC__ >= 2 || defined __clang__) && !defined __STRICT_ANSI__ > re_token_type_t type : 8; > #else > re_token_type_t type; > @@ -841,10 +849,10 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx) > #endif /* RE_ENABLE_I18N */ > > #ifndef FALLTHROUGH > -# if __GNUC__ < 7 > -# define FALLTHROUGH ((void) 0) > -# else > +# if (__GNUC__ >= 7) || (__clang_major__ >= 10) > # define FALLTHROUGH __attribute__ ((__fallthrough__)) > +# else > +# define FALLTHROUGH ((void) 0) > # endif > #endif > > -- > 2.25.1 > >