From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 8F5F63838205 for ; Thu, 26 May 2022 19:04:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8F5F63838205 Received: from fencepost.gnu.org ([2001:470:142:3::e]:41172) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nuImp-0000R0-J6; Thu, 26 May 2022 15:04:43 -0400 Received: from [87.69.77.57] (port=3511 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nuImp-0002Fz-2C; Thu, 26 May 2022 15:04:43 -0400 Date: Thu, 26 May 2022 22:04:36 +0300 Message-Id: <83mtf4nmij.fsf@gnu.org> From: Eli Zaretskii To: Tom Tromey Cc: gdb-patches@sourceware.org, jon.turney@dronecode.org.uk In-Reply-To: <87zgj46xfm.fsf@tromey.com> (message from Tom Tromey on Thu, 26 May 2022 11:00:45 -0600) Subject: Re: [PATCH 1/9] Fix possible Cygwin build problem References: <20220413191756.1146768-1-tromey@adacore.com> <20220413191756.1146768-2-tromey@adacore.com> <83sfp383t5.fsf@gnu.org> <87zgj46xfm.fsf@tromey.com> X-Spam-Status: No, score=1.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: , X-List-Received-Date: Thu, 26 May 2022 19:04:46 -0000 > From: Tom Tromey > Cc: Jon Turney , Eli Zaretskii , > tromey@adacore.com > Date: Thu, 26 May 2022 11:00:45 -0600 > > >>>>> "Eli" == Eli Zaretskii via Gdb-patches writes: > > Eli> __USEWIDE in native Windows programming assumes the use of wchar_t for > Eli> character and character strings, something that GDB sources aren't > Eli> equipped for doing, at least not easily. AFAIK, Cygwin alleviates > Eli> that by using UTF-8 encoded strings, but native Windows programming > Eli> cannot (yet) do that safely enough on all supported Windows versions. > > It looks like windows-nat.c defines __USEWIDE only for Cygwin, and then > is careful to use the *W forms of various Windows APIs. So maybe it > works ok in practice? I doubt it, in general, because GDB uses 'char *' for strings, and those won't work in *W APIs without an explicit conversion to wchar_t. However, I see only 2 calls to *W APIs in windows-nat.c, and they are both under the __CYGWIN__ condition. So I think we are good. > Eli> As long as MinGW builds of GDB support only the so-called "ANSI" > Eli> encoding (i.e. the current system codepage), there's no reason to use > Eli> __USEWIDE in the MinGW build of GDB, and every reason not to use it. > > Yeah, I think __USEWIDE is not used for mingw. However I wonder if we > could remove it for Cygwin as well... that would clean up some code. > Not a huge amount, but every Cygwin divergence is a bit of a pain. This will need a Cygwin expert, which I'm not.