From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) by sourceware.org (Postfix) with ESMTPS id E6F8D383A37A for ; Thu, 21 Jul 2022 19:22:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E6F8D383A37A Received: by mail-oi1-x22c.google.com with SMTP id o133so3220432oig.13 for ; Thu, 21 Jul 2022 12:22:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=XBicvhlJhgKrzgUSbxB8kXA1A0YxNLOJFE7f6Hpg6lE=; b=6My32mzFdmBFhCl3pMKoCZv0XA3M2A/OT3clWKEbFU+3R9DDQYWCOeZNzSutiGN6J2 Mo4K+GHClnc0WwUDJvzp9QbinxM3oJ9Rzt68YB/DPHGRSaEYCX4oI/L1ogCYBuD+S4FH UZdtM7PZCzhOUpOZu2iFrjvj/0ijloiPV/cCj4Hyqra1iHajfIoRYSnHKeO5Wt4KO/LY TaPL9Zz/JazBv1KtGwdC86TuhAG2IJFpzQLBZbHtSNPSSjpfUNnl6mdr8kGAH5tXUJkd ycAS+7lnllzkzkmANCOCMEezrbeTz/3Jv4cU3PLin/IKdRH9qLMrobq7TYYvqooUWc8R yxDQ== X-Gm-Message-State: AJIora+i9hjNfH83RA9uk/mWeUEc7evfa/v91N6qe+WxNgEoYOHDMN/2 uaeoJ2kV9tNCloPCWv0za0erTWRcUujEjg== X-Google-Smtp-Source: AGRyM1v9NCqd4PUcfJFG6UTwlpXfByy6cvlGlGdRX1EY5fcVi4W3B6tZG078fcDxNlaN6oPQYX7dFQ== X-Received: by 2002:a05:6808:8c9:b0:33a:3343:b83a with SMTP id k9-20020a05680808c900b0033a3343b83amr5640641oij.44.1658431365156; Thu, 21 Jul 2022 12:22:45 -0700 (PDT) Received: from ?IPV6:2804:431:c7cb:8ded:90a7:7be2:9a21:5f25? ([2804:431:c7cb:8ded:90a7:7be2:9a21:5f25]) by smtp.gmail.com with ESMTPSA id d205-20020acab4d6000000b0033a05951ccdsm985861oif.12.2022.07.21.12.22.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Jul 2022 12:22:44 -0700 (PDT) Message-ID: Date: Thu, 21 Jul 2022 16:22:42 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.0.2 Subject: Re: [PATCH v4 2/3] stdlib: Implement mbrtoc8(), c8rtomb(), and the char8_t typedef. Content-Language: en-US To: Tom Honermann , Joseph Myers Cc: libc-alpha@sourceware.org References: <20220630125215.6052-1-tom@honermann.net> <20220630125215.6052-3-tom@honermann.net> <6cf42820-86cb-f3ee-e4cf-3310de2e0bd1@honermann.net> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <6cf42820-86cb-f3ee-e4cf-3310de2e0bd1@honermann.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, 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.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jul 2022 19:22:47 -0000 On 20/07/22 13:47, Tom Honermann wrote: > Confirmed that this issue can be easily reproduced outside the testsuite. > > $ cat t.cpp > #include > > $ g++ --version > g++ (GCC) 13.0.0 20220720 (experimental) > ... > > $ g++ -c -I/path/to/glibc-char8_t/include -std=c++17 -Werror=c++20-compat t.cpp > In file included from t.cpp:1: > /home/tom/products/glibc-char8_t/include/uchar.h:38:23: error: identifier ‘char8_t’ is a keyword in C++20 [-Werror=c++20-compat] >    38 | typedef unsigned char char8_t; >       |                       ^~~~~~~ > cc1plus: some warnings being treated as errors > > The char8_t typedef is currently guarded by: > > /* Declare the C2x char8_t typedef in C2x modes, but only if the C++ >   __cpp_char8_t feature test macro is not defined.  */ > #if __GLIBC_USE (ISOC2X) && !defined __cpp_char8_t > /* Define the 8-bit character type.  */ > typedef unsigned char char8_t; > #endif > > __GLIBC_USE (ISOC2X) evaluates to true because gcc unconditionally defines _GNU_SOURCE. I believe otherwise, C++17 mode would only (or should only) imply __GLIBC_USE (ISOC11). > > Regardless, it seems that directives should be added to suppress the diagnostic. I tried prototyping such a fix, but it doesn't seem to work for me. I don't understand why. I have tried as well and I can't get to work either. It would expect to work as we have done bits/stdlib-bsearch.h, could it be a gcc issue? > > $ diff -U3 uchar.h.old uchar.h > --- uchar.h.old 2022-07-20 12:37:55.544301692 -0400 > +++ uchar.h     2022-07-20 12:43:21.124365563 -0400 > @@ -34,8 +34,17 @@ >  /* Declare the C2x char8_t typedef in C2x modes, but only if the C++ >    __cpp_char8_t feature test macro is not defined.  */ >  #if __GLIBC_USE (ISOC2X) && !defined __cpp_char8_t > +/* Suppress the C++20 compatability diagnostic regarding char8_t being a > +   keyword.  */ > +#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__) > +# pragma GCC diagnostic push > +# pragma GCC diagnostic ignored "-Wc++20-compat" > +#endif >  /* Define the 8-bit character type.  */ >  typedef unsigned char char8_t; > +#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__) > +# pragma GCC diagnostic pop > +#endif >  #endif > >  #ifndef __USE_ISOCXX11 > > Tom. > > On 7/19/22 5:08 PM, Joseph Myers wrote: >> This change appears to introduce a failure of >> wcsmbs/check-installed-headers-cxx with GCC mainline, because uchar.h now >> produces: >> >> ../wcsmbs/uchar.h:38:23: error: identifier 'char8_t' is a keyword in C++20 [-Werror=c++20-compat] >>     38 | typedef unsigned char char8_t; >> >> (recall we want our installed headers to avoid warnings *without* relying >> on the default disabling of warnings in system headers). >> >> Unfortunately, GCC for C++ doesn't disable -Wc++20-compat inside >> __extension__ (unlike what the C front end does), so simply adding >> __extension__ to that declaration wouldn't help, but we could use >> diagnostic disabling pragmas (as already done in some installed headers). >>