From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 68917 invoked by alias); 7 Jan 2020 00:28:15 -0000 Mailing-List: contact libstdc++-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libstdc++-owner@gcc.gnu.org Received: (qmail 68864 invoked by uid 89); 7 Jan 2020 00:28:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_SHORT,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 spammy= X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-1.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (205.139.110.61) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 07 Jan 2020 00:28:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578356891; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BbEHcSphG2rIXdt8q9td9CjBVh5m78B7OMm/lakRHXk=; b=YqriHhVcz0oMaTuH0hbpv10F89omPvM9W/MPZXd5vjqyaC9m94Ff5Ul1AsH62Uf/wEJ7LK UPwFEIjbcf04SCIp10KAHAHk3EzECIkyk/uqAeG9M9v9D/agj68wj+6tg9GdNQ45opXlVa aYgY+fNx6UGrrAP+Fs8fS/4IzLJrqgc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-216-MnbJcadlPGi3NG2QsHqTCA-1; Mon, 06 Jan 2020 19:28:07 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EA991477; Tue, 7 Jan 2020 00:28:05 +0000 (UTC) Received: from localhost (unknown [10.33.36.78]) by smtp.corp.redhat.com (Postfix) with ESMTP id 664705C1B2; Tue, 7 Jan 2020 00:28:05 +0000 (UTC) Date: Tue, 07 Jan 2020 00:28:00 -0000 From: Jonathan Wakely To: Kamil Rytarowski Cc: Gerald Pfeifer , Matthew Bauer , libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org, Maya Rashish Subject: Re: [PATCH] libstdcxx: Update ctype_base.h from NetBSD upstream Message-ID: <20200107002804.GN490107@redhat.com> References: <20200106153415.GK490107@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-IsSubscribed: yes X-SW-Source: 2020-01/txt/msg00024.txt.bz2 On 07/01/20 00:18 +0100, Kamil Rytarowski wrote: >On 06.01.2020 16:34, Jonathan Wakely wrote: >> On 22/12/19 09:36 +1000, Gerald Pfeifer wrote: >>> Hi Matthew, >>> >>> On Mon, 4 Feb 2019, Matthew Bauer wrote: >>>> The ctype_base.h file in libstdc++-v3 is out of date for NetBSD. They >>>> have changed their ctype.h definition. It was updated in their intree >>>> libstdc++-v3 but not in the GCC one. My understanding is this is a >>>> straightforward rewrite. I've attached my own patch, but the file can >>>> be obtained directly here: >>>> >>>> http://cvsweb.netbsd.org/bsdweb.cgi/src/external/gpl3/gcc/dist/libstdc= %2b%2b-v3/config/os/bsd/netbsd/ctype_base.h >>>> >>>> >>>> With the attached patch, libstdc++-v3 can succesfully be built with >>>> NetBSD headers (along with --disable-libcilkrts). >>> >>> I noticed this has not been applied yet, nor seen a follow-up?, and also >>> noticed it went to the gcc-patches list, but not libstdc++@gcc.gnu.org. >>> >>> Let me re-address this to libstdc++@gcc.gnu.org in the hope the >>> maintainers there will have a look. >>> >>> Gerald >> >>> diff --git a/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h >>> b/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h >>> index ff3ec893974..21eccf9fde1 100644 >>> --- a/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h >>> +++ b/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h >>> @@ -38,40 +38,46 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >>> =A0 /// @brief=A0 Base class for ctype. >>> =A0 struct ctype_base >>> =A0 { >>> -=A0=A0=A0 // Non-standard typedefs. >>> -=A0=A0=A0 typedef const unsigned char*=A0=A0=A0 __to_type; >>> >>> =A0=A0=A0 // NB: Offsets into ctype::_M_table force a particular = size >>> =A0=A0=A0 // on the mask type. Because of this, we don't use an enum. >>> -=A0=A0=A0 typedef unsigned char=A0=A0=A0=A0=A0=A0=A0=A0=A0 mask; >>> >>> #ifndef _CTYPE_U >>> -=A0=A0=A0 static const mask upper=A0=A0=A0=A0=A0=A0=A0 =3D _U; >>> -=A0=A0=A0 static const mask lower=A0=A0=A0=A0 =3D _L; >>> -=A0=A0=A0 static const mask alpha=A0=A0=A0=A0 =3D _U | _L; >>> -=A0=A0=A0 static const mask digit=A0=A0=A0=A0 =3D _N; >>> -=A0=A0=A0 static const mask xdigit=A0=A0=A0=A0 =3D _N | _X; >>> -=A0=A0=A0 static const mask space=A0=A0=A0=A0 =3D _S; >>> -=A0=A0=A0 static const mask print=A0=A0=A0=A0 =3D _P | _U | _L | _N | = _B; >>> -=A0=A0=A0 static const mask graph=A0=A0=A0=A0 =3D _P | _U | _L | _N; >>> -=A0=A0=A0 static const mask cntrl=A0=A0=A0=A0 =3D _C; >>> -=A0=A0=A0 static const mask punct=A0=A0=A0=A0 =3D _P; >>> -=A0=A0=A0 static const mask alnum=A0=A0=A0=A0 =3D _U | _L | _N; >>> +=A0=A0=A0 // Non-standard typedefs. >>> +=A0=A0=A0 typedef const unsigned char*=A0=A0=A0 __to_type; >>> + >>> +=A0=A0=A0 typedef unsigned char=A0=A0=A0 mask; >>> + >>> +=A0=A0=A0 static const mask upper=A0=A0=A0 =3D _U; >>> +=A0=A0=A0 static const mask lower=A0=A0=A0 =3D _L; >>> +=A0=A0=A0 static const mask alpha=A0=A0=A0 =3D _U | _L; >>> +=A0=A0=A0 static const mask digit=A0=A0=A0 =3D _N; >>> +=A0=A0=A0 static const mask xdigit=A0=A0=A0 =3D _N | _X; >>> +=A0=A0=A0 static const mask space=A0=A0=A0 =3D _S; >>> +=A0=A0=A0 static const mask print=A0=A0=A0 =3D _P | _U | _L | _N | _B; >>> +=A0=A0=A0 static const mask graph=A0=A0=A0 =3D _P | _U | _L | _N; >>> +=A0=A0=A0 static const mask cntrl=A0=A0=A0 =3D _C; >>> +=A0=A0=A0 static const mask punct=A0=A0=A0 =3D _P; >>> +=A0=A0=A0 static const mask alnum=A0=A0=A0 =3D _U | _L | _N; >>> #else >>> -=A0=A0=A0 static const mask upper=A0=A0=A0=A0=A0=A0=A0 =3D _CTYPE_U; >>> -=A0=A0=A0 static const mask lower=A0=A0=A0=A0 =3D _CTYPE_L; >>> -=A0=A0=A0 static const mask alpha=A0=A0=A0=A0 =3D _CTYPE_U | _CTYPE_L; >>> -=A0=A0=A0 static const mask digit=A0=A0=A0=A0 =3D _CTYPE_N; >>> -=A0=A0=A0 static const mask xdigit=A0=A0=A0=A0 =3D _CTYPE_N | _CTYPE_X; >>> -=A0=A0=A0 static const mask space=A0=A0=A0=A0 =3D _CTYPE_S; >>> -=A0=A0=A0 static const mask print=A0=A0=A0=A0 =3D _CTYPE_P | _CTYPE_U = | _CTYPE_L | >>> _CTYPE_N | _CTYPE_B; >>> -=A0=A0=A0 static const mask graph=A0=A0=A0=A0 =3D _CTYPE_P | _CTYPE_U = | _CTYPE_L | >>> _CTYPE_N; >>> -=A0=A0=A0 static const mask cntrl=A0=A0=A0=A0 =3D _CTYPE_C; >>> -=A0=A0=A0 static const mask punct=A0=A0=A0=A0 =3D _CTYPE_P; >>> -=A0=A0=A0 static const mask alnum=A0=A0=A0=A0 =3D _CTYPE_U | _CTYPE_L = | _CTYPE_N; >>> +=A0=A0=A0 typedef const unsigned short*=A0=A0=A0 __to_type; >>> + >>> +=A0=A0=A0 typedef unsigned short=A0=A0=A0 mask; >>> + >>> +=A0=A0=A0 static const mask upper=A0=A0=A0 =3D _CTYPE_U; >>> +=A0=A0=A0 static const mask lower=A0=A0=A0 =3D _CTYPE_L; >>> +=A0=A0=A0 static const mask alpha=A0=A0=A0 =3D _CTYPE_A; >>> +=A0=A0=A0 static const mask digit=A0=A0=A0 =3D _CTYPE_D; >>> +=A0=A0=A0 static const mask xdigit=A0=A0=A0 =3D _CTYPE_X; >>> +=A0=A0=A0 static const mask space=A0=A0=A0 =3D _CTYPE_S; >>> +=A0=A0=A0 static const mask print=A0=A0=A0 =3D _CTYPE_R; >>> +=A0=A0=A0 static const mask graph=A0=A0=A0 =3D _CTYPE_G; >>> +=A0=A0=A0 static const mask cntrl=A0=A0=A0 =3D _CTYPE_C; >>> +=A0=A0=A0 static const mask punct=A0=A0=A0 =3D _CTYPE_P; >>> +=A0=A0=A0 static const mask alnum=A0=A0=A0 =3D _CTYPE_A | _CTYPE_D; >>> #endif >>> #if __cplusplus >=3D 201103L >>> -=A0=A0=A0 static const mask blank=A0=A0=A0=A0 =3D space; >>> +=A0=A0=A0 static const mask blank=A0=A0=A0 =3D space; >>> #endif >>> =A0 }; >>> >>> diff --git a/libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc >>> b/libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc >>> index ed3b7cd0d6a..33358e8f5d8 100644 >>> --- a/libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc >>> +++ b/libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc >>> @@ -38,11 +38,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >>> >>> // Information as gleaned from /usr/include/ctype.h >>> >>> -=A0 extern "C" const u_int8_t _C_ctype_[]; >>> - >>> =A0 const ctype_base::mask* >>> =A0 ctype::classic_table() throw() >>> -=A0 { return _C_ctype_ + 1; } >>> +=A0 { return _C_ctype_tab_ + 1; } >> >> The first patch attached to PR 64271 (i.e. >> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D34254 ) does that >> differently. Is it safe to make this change unconditionally? >> > >This file is NetBSD only (at least in theory) and we likely can do the >right think without conditional build here. Yes, it's NetBSD-specific, but it's used for multiple versions of NetBSD. The patch in PR 64271 only uses _C_ctype_tab_+1 when _CTYPE_BL is defined, i.e. for newer versions of NetBSD. For older versions, it still uses _C_ctype_. So my question is whether _C_ctype_tab_+1 does the right thing for all versions of NetBSD, or only for newer ones.