From patchwork Mon Feb 4 14:36:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Bauer X-Patchwork-Id: 1035962 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-495255-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="daZPbsI7"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="IzjS2KCy"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43tVdT0h6lz9s3l for ; Tue, 5 Feb 2019 01:36:28 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=ZIfnGFGCjtakqs8pp1zYbvPgXzHecHTB96gihDZzerq2eQ Ii0sFpXEbzATvBBmEZWrFRedDXbhd49iBH387/+m9vbPZZ0c+1OcPGkuayjmCX6I QXvfo7eoWGjlVhpubU+YcuCcmtd0ab+3nLOtlZkehUJWEu2KEqEE8TGDhjsCs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=oopVAesiQtPTS3MR9ScopliSsdY=; b=daZPbsI71L3LLYY0c5i+ Yfy7JTXbHUmktDx6mOT7flT6Ilb9QGrd5QMYlc6z0B4LHpYmEyJsLwJVyL3V4zBL 5wXRItX+uU8YFiaBOqpF8CEIWjI2Y1+yjchBGh93xwa4o7RMY+gSBfn0JFSw0ef7 QMQ+eII7w6pn9SqQRVn+G/E= Received: (qmail 35333 invoked by alias); 4 Feb 2019 14:36:21 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 35322 invoked by uid 89); 4 Feb 2019 14:36:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=dist, 3811, cntrl X-HELO: mail-it1-f178.google.com Received: from mail-it1-f178.google.com (HELO mail-it1-f178.google.com) (209.85.166.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 Feb 2019 14:36:19 +0000 Received: by mail-it1-f178.google.com with SMTP id p197so213163itp.0 for ; Mon, 04 Feb 2019 06:36:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=9f8zDxNGQmJiGLdO4OiTGr75tX4cilbYRMkIxYwhAOg=; b=IzjS2KCyCDf/a4d1Z1Cr5eOkKZOzapWDxoA9jkGAhZeaFrALe9uUAsy3vwq5MnJTw6 MXuI6KK4Xp9ONQhc36zoETSPiHpp3Oo1T33gbPOIXzMxP2cI5mh3dnToyc8eeKMTAB3e iZlaJBHanz+vtxmq8h0N88HZM4DpkhRAuAl16Q7hPS6+9NwyeDpcM1AN6FrdN/F+2b7l QTRZIgm3Ne2S7t+leReaG5noqyYD+4+7iKnuwGrX92PuY9eTo+hFLUgG/mr2VyqXjLwX mNM+k5ZvxePXZiAmcGvfNYsKIMTAxzG42XP0ZYzkixx0MrSaCpxbrQwN7MmGJhgFV2lG ALDQ== MIME-Version: 1.0 From: Matthew Bauer Date: Mon, 4 Feb 2019 09:36:06 -0500 Message-ID: Subject: [PATCH] libstdcxx: Update ctype_base.h from NetBSD upstream To: gcc-patches@gcc.gnu.org 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). Thanks, Matthew Bauer 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 /// @brief Base class for ctype. struct ctype_base { - // Non-standard typedefs. - typedef const unsigned char* __to_type; // NB: Offsets into ctype::_M_table force a particular size // on the mask type. Because of this, we don't use an enum. - typedef unsigned char mask; #ifndef _CTYPE_U - static const mask upper = _U; - static const mask lower = _L; - static const mask alpha = _U | _L; - static const mask digit = _N; - static const mask xdigit = _N | _X; - static const mask space = _S; - static const mask print = _P | _U | _L | _N | _B; - static const mask graph = _P | _U | _L | _N; - static const mask cntrl = _C; - static const mask punct = _P; - static const mask alnum = _U | _L | _N; + // Non-standard typedefs. + typedef const unsigned char* __to_type; + + typedef unsigned char mask; + + static const mask upper = _U; + static const mask lower = _L; + static const mask alpha = _U | _L; + static const mask digit = _N; + static const mask xdigit = _N | _X; + static const mask space = _S; + static const mask print = _P | _U | _L | _N | _B; + static const mask graph = _P | _U | _L | _N; + static const mask cntrl = _C; + static const mask punct = _P; + static const mask alnum = _U | _L | _N; #else - static const mask upper = _CTYPE_U; - static const mask lower = _CTYPE_L; - static const mask alpha = _CTYPE_U | _CTYPE_L; - static const mask digit = _CTYPE_N; - static const mask xdigit = _CTYPE_N | _CTYPE_X; - static const mask space = _CTYPE_S; - static const mask print = _CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N | _CTYPE_B; - static const mask graph = _CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N; - static const mask cntrl = _CTYPE_C; - static const mask punct = _CTYPE_P; - static const mask alnum = _CTYPE_U | _CTYPE_L | _CTYPE_N; + typedef const unsigned short* __to_type; + + typedef unsigned short mask; + + static const mask upper = _CTYPE_U; + static const mask lower = _CTYPE_L; + static const mask alpha = _CTYPE_A; + static const mask digit = _CTYPE_D; + static const mask xdigit = _CTYPE_X; + static const mask space = _CTYPE_S; + static const mask print = _CTYPE_R; + static const mask graph = _CTYPE_G; + static const mask cntrl = _CTYPE_C; + static const mask punct = _CTYPE_P; + static const mask alnum = _CTYPE_A | _CTYPE_D; #endif #if __cplusplus >= 201103L - static const mask blank = space; + static const mask blank = space; #endif }; 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 - extern "C" const u_int8_t _C_ctype_[]; - const ctype_base::mask* ctype::classic_table() throw() - { return _C_ctype_ + 1; } + { return _C_ctype_tab_ + 1; } ctype::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) @@ -69,14 +67,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION char ctype::do_toupper(char __c) const - { return ::toupper((int) __c); } + { return ::toupper((int)(unsigned char) __c); } const char* ctype::do_toupper(char* __low, const char* __high) const { while (__low < __high) { - *__low = ::toupper((int) *__low); + *__low = ::toupper((int)(unsigned char) *__low); ++__low; } return __high; @@ -84,14 +82,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION char ctype::do_tolower(char __c) const - { return ::tolower((int) __c); } + { return ::tolower((int)(unsigned char) __c); } const char* ctype::do_tolower(char* __low, const char* __high) const { while (__low < __high) { - *__low = ::tolower((int) *__low); + *__low = ::tolower((int)(unsigned char) *__low); ++__low; } return __high; diff --git a/libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h b/libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h index ace1120fba2..3234ce17c70 100644 --- a/libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h +++ b/libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h @@ -48,7 +48,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION is(const char* __low, const char* __high, mask* __vec) const { while (__low < __high) - *__vec++ = _M_table[*__low++]; + *__vec++ = _M_table[(unsigned char)*__low++]; return __high; }