From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id aEMxHuYVHWLFVAAAWB0awg (envelope-from ) for ; Mon, 28 Feb 2022 13:35:18 -0500 Received: by simark.ca (Postfix, from userid 112) id 7834F1F3C8; Mon, 28 Feb 2022 13:35:18 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id AF6971EDF0 for ; Mon, 28 Feb 2022 13:35:17 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3B081385842A for ; Mon, 28 Feb 2022 18:35:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B081385842A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1646073317; bh=HsqketRw7qeSWiM8T1iAKYndUOooBPrbM2Ty2798IkU=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=gwaQOBEUqSqnlHf9KxK96EmZpWJ+72xQJCOgHYypM6ZbbesZShUHgfBWhLWMufkF0 Kau5YeEhAXQ1YOgKiF1RPF3wd9WLexwJSJ5aHZgbaRkGWfFp8KRxk3XeiIO12HWHW5 9bgXC71qFkK4TjQYdwy9KLUb9upyKyH30tJv4+no= Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by sourceware.org (Postfix) with ESMTPS id 215DD3858D20 for ; Mon, 28 Feb 2022 18:33:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 215DD3858D20 Received: by mail-io1-xd29.google.com with SMTP id m185so15719247iof.10 for ; Mon, 28 Feb 2022 10:33:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HsqketRw7qeSWiM8T1iAKYndUOooBPrbM2Ty2798IkU=; b=Av/Lc5/E4+eGOOHilQwMOCHgJkdVJXa/BGThEpTnFxzyKdiDzKL5lG7qMlQey57v9y Dg0+tGRRmLZRnZ7aqmGcsw/3vOZvD+Z7E16WPA+J8kg+O85NLU1al/REkaaDJ6GB+QpX 7Vc8co1euDxbIUjXfqfBLNJcJLOSjL7Lqplw2WZF1MLcr+jIBoE+8th20y6gahtY7kgt BjTyeLM8qQ/1stwPGARc+CQTLGQP7hvlHCGZ/we7MVb+M6tCO9spZ+Ra15y1hKv88K+2 tNqT6XU7N9diLbRWwCbqAmoD5zgTc5bopZ6qgF7ymHz+BlvGeKmdPHE6G5/X92zFQpAI xZog== X-Gm-Message-State: AOAM531j9KDO6cWuvwIt65v8r4RVZasCSW7tXKXvTlPBlm5iDz+Omtqs hvW8M2YpHaMa7X88sMDR0XeoydT1JXg93A== X-Google-Smtp-Source: ABdhPJwWgTl5hPFwrOqn9yKJhYJviCQkiPh8RxGHx5ZNI/rD+EHrQtEND6oMze3lJ8MynORPMZr3HQ== X-Received: by 2002:a5d:8ace:0:b0:641:2a6e:471c with SMTP id e14-20020a5d8ace000000b006412a6e471cmr16398913iot.42.1646073189554; Mon, 28 Feb 2022 10:33:09 -0800 (PST) Received: from murgatroyd.Home (75-166-141-253.hlrn.qwest.net. [75.166.141.253]) by smtp.gmail.com with ESMTPSA id h9-20020a92c089000000b002b8b3ce939fsm6558845ile.9.2022.02.28.10.33.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 10:33:09 -0800 (PST) To: gdb-patches@sourceware.org Subject: [PATCH 4/5] Define HOST_UTF32 in charset.h Date: Mon, 28 Feb 2022 11:33:03 -0700 Message-Id: <20220228183304.1162089-5-tromey@adacore.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220228183304.1162089-1-tromey@adacore.com> References: <20220228183304.1162089-1-tromey@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Tom Tromey via Gdb-patches Reply-To: Tom Tromey Cc: Tom Tromey Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" rust-parse.c has a #define for the host-specific UTF-32 charset name. A later patch needs the same thing, so this patch moves the definition to charset.h for easier reuse. --- gdb/charset.h | 6 ++++++ gdb/rust-parse.c | 12 ++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/gdb/charset.h b/gdb/charset.h index 7a7041f10f2..2daa9a25060 100644 --- a/gdb/charset.h +++ b/gdb/charset.h @@ -159,4 +159,10 @@ class wchar_iterator character. */ char host_letter_to_control_character (char c); +#if WORDS_BIGENDIAN +#define HOST_UTF32 "UTF-32BE" +#else +#define HOST_UTF32 "UTF-32LE" +#endif + #endif /* CHARSET_H */ diff --git a/gdb/rust-parse.c b/gdb/rust-parse.c index 1f75b4290c2..4006df7086b 100644 --- a/gdb/rust-parse.c +++ b/gdb/rust-parse.c @@ -33,12 +33,6 @@ using namespace expr; -#if WORDS_BIGENDIAN -#define UTF32 "UTF-32BE" -#else -#define UTF32 "UTF-32LE" -#endif - /* A regular expression for matching Rust numbers. This is split up since it is very long and this gives us a way to comment the sections. */ @@ -601,7 +595,8 @@ lex_multibyte_char (const char *text, int *len) return 0; auto_obstack result; - convert_between_encodings (host_charset (), UTF32, (const gdb_byte *) text, + convert_between_encodings (host_charset (), HOST_UTF32, + (const gdb_byte *) text, quote, 1, &result, translit_none); int size = obstack_object_size (&result); @@ -732,7 +727,8 @@ rust_parser::lex_string () if (is_byte) obstack_1grow (&obstack, value); else - convert_between_encodings (UTF32, "UTF-8", (gdb_byte *) &value, + convert_between_encodings (HOST_UTF32, "UTF-8", + (gdb_byte *) &value, sizeof (value), sizeof (value), &obstack, translit_none); } -- 2.31.1