From patchwork Fri Dec 13 16:04:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Hainque X-Patchwork-Id: 1209235 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-515904-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="LUpdSfXh"; 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 47ZFqN0zN0z9sPT for ; Sat, 14 Dec 2019 03:04:46 +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:from :content-type:subject:date:message-id:cc:to:mime-version; q=dns; s=default; b=JfTNZ1ooCCJ3swW0zjAOSS64ybNSeI0d4ODg3QEyJc5IjmWB3k cyqx9qskKs6JmUJ9NZM+2+IrmhzCyj0G0Serg6zouMkMh/czzswJ2oQdypBzTZzY MdzXWkcWMoSq5g7SSGkLJY5wHEIibNWOnb7m4A1i5YD8qM7GUaSeNsow4= 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:from :content-type:subject:date:message-id:cc:to:mime-version; s= default; bh=hAKPo6vlMAxtc9qA8gAKObrXC4Y=; b=LUpdSfXhtfa+NYAS+0Nl 3/ojvVx6KDEeDgzc9Y0+2qR48/qY8FJ+2xe4jaVf/teDyLNBTHNcsuDnLIk1uZBD 864muLGXwovjwdSkdA/0pBjrB3eOi2ZnKSqhBWhUdyJwNEI/3DfgkxDJ77QKAFPB 9fRwvSZD3VsTvY16LY5V710= Received: (qmail 42312 invoked by alias); 13 Dec 2019 16:04:38 -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 40007 invoked by uid 89); 13 Dec 2019 16:04:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=Alexandre, alexandre, oliva, devised X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Dec 2019 16:04:36 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 9FAF3818D7; Fri, 13 Dec 2019 17:04:34 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id H4ErQwzZ2kTG; Fri, 13 Dec 2019 17:04:34 +0100 (CET) Received: from [IPv6:2a02:2ab8:224:100::1002] (unknown [IPv6:2a02:2ab8:224:100::1002]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id CB9AF8138F; Fri, 13 Dec 2019 17:04:33 +0100 (CET) From: Olivier Hainque Subject: [patch] Refine definitions for wchar_t/wint_t on VxWorks Date: Fri, 13 Dec 2019 17:04:31 +0100 Message-Id: Cc: Olivier Hainque , Alexandre Oliva To: GCC Patches Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) This change refines the VxWorks macro definitions configuring wchar_t to accommodate the VxWorks7 environment, where wchar_t is now typically a 32bit type. We also ensure that the definitions for wint_t are always based on those for wchar_t, so the two remain in sync in environments where WCHAR_TYPE is redefined for a specific CPU architecture. The patch posted here is a minor variation on a change initially devised by Alexandre, just moved to an even more common place where other type related definitions are. Tested in accordance with the description in https://gcc.gnu.org/ml/gcc-patches/2019-12/msg00911.html Committing to mainline. Olivier 2019-12-13 Alexandre Oliva Olivier Hainque * config/vx-common.h (WCHAR_TYPE_SIZE): 32 on VxWorks 7. (WCHAR_TYPE): Pick accordingly. (WINT_TYPE_SIZE): Define in terms of WCHAR_TYPE_SIZE. (WINT_TYPE): Define in terms of WCHAR_TYPE. gcc/config/vx-common.h | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/gcc/config/vx-common.h b/gcc/config/vx-common.h index ed3e4254e77..594db5122ac 100644 --- a/gcc/config/vx-common.h +++ b/gcc/config/vx-common.h @@ -43,17 +43,32 @@ along with GCC; see the file COPYING3. If not see /* ----------------------- Common type descriptions ----------------------- */ -/* VxWorks uses wchar_t == unsigned short (UCS2) on all architectures. */ +/* Regardless of the target architecture, VxWorks uses a signed 32bit + integer for wchar_t starting with vx7 SR06xx. An unsigned short + otherwise. */ +#if TARGET_VXWORKS7 + +#undef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE 32 #undef WCHAR_TYPE -#define WCHAR_TYPE "short unsigned int" +#define WCHAR_TYPE (TARGET_VXWORKS64 ? "int" : "long int") + +#else + #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE 16 +#undef WCHAR_TYPE +#define WCHAR_TYPE "short unsigned int" -/* Likewise wint_t. */ -#undef WINT_TYPE -#define WINT_TYPE "short unsigned int" +#endif + +/* The VxWorks headers base wint_t on the definitions used for wchar_t. + Do the same here to make sure they remain in sync, in case WCHAR_TYPE + gets redefined for a specific CPU architecture. */ #undef WINT_TYPE_SIZE -#define WINT_TYPE_SIZE 16 +#define WINT_TYPE_SIZE WCHAR_TYPE_SIZE +#undef WINT_TYPE +#define WINT_TYPE WCHAR_TYPE /* ---------------------- Debug and unwind info formats ------------------ */