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 D37E83857030 for ; Wed, 2 Nov 2022 15:19:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D37E83857030 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oqFW7-0004i7-Qu; Wed, 02 Nov 2022 11:18:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=iTqxJqxKN1DxpKDy2X1ZJF7okUk02h79GMIJCev0LMg=; b=kNgFHJEAdXAN A9Q+0EU6MbI3OosDwqQ8fM0mGjYzXo/vA3hz4UWOUJJ9SJImEc1mGktYdXDu16RDwW+G7CA1U94kl uk00dAa8rNNbzsrlRBmyokRPsptt0I1yhMD7WKD4BbOGlA2MhUAfm8ppE+ZCynA089BXv48YB9n1A hsW8j6tQ4wmJ0dAjLmZhaRRVLC8TbCxFQdaU9ah9WiB1E7GHplzQQ7iH8lizRNyTLdMn4mox/xrdI s8NkBl3XWjfCGdSfT07UwsNhhXhn15QKRxwPHDx536FVfmj25g0W4uuByOlEzCCq+SXDReqV2YGCY g8+xhJbokG0uP5DXob7kBA==; Received: from [87.69.77.57] (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 1oqFW6-0003k3-2E; Wed, 02 Nov 2022 11:18:59 -0400 Date: Wed, 02 Nov 2022 17:18:44 +0200 Message-Id: <83h6zh9ygb.fsf@gnu.org> From: Eli Zaretskii To: i.nixman@autistici.org Cc: gdb@sourceware.org In-Reply-To: (i.nixman@autistici.org) Subject: Re: _WIN32_WINNT redefined? References: <6485dbfe07e21a1c451b17d3fda5b3d9@autistici.org> <41193fbdb742b1c2d4d7b4ab06561822@autistici.org> <8335b1bjv2.fsf@gnu.org> 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,KAM_SHORT,RCVD_IN_BARRACUDACENTRAL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > Date: Wed, 02 Nov 2022 14:13:13 +0000 > From: i.nixman@autistici.org > > the root of the issue: GDB wan't build using MinGW-W64 toolchain uses > this patch: > https://gcc.gnu.org/pipermail/libstdc++/2022-October/054895.html > (for short, the patch provides the ability to libstdc++ to enable the > support for std-threads and so on but without the need to use > libwinpthreads: > https://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-libraries/winpthreads/) > > next, as I wrote earlier, I have faced with a trouble I can't build GDB > using that path: > ``` > In file included from > mingw64/lib/gcc/x86_64-w64-mingw32/13.0.0/include/c++/mutex:45, > from > ../src/gdb-11.2/gdbsupport/../gdbsupport/thread-pool.h:27, > from ../src/gdb-11.2/gdbsupport/thread-pool.cc:24: > mingw64/lib/gcc/x86_64-w64-mingw32/13.0.0/include/c++/bits/std_mutex.h:163:5: > error: '__gthread_cond_t' does not name a type; did you mean > '__gthread_once_t'? > 163 | __gthread_cond_t* native_handle() noexcept { return > &_M_cond; } > | ^~~~~~~~~~~~~~~~ > ``` > > because the patch requires the _WIN32_WINNT will be set to 0x0600 or > greater. Then the stuff in common-defs.h should be augmented to define _WIN32_WINNT to the value 0x0600 or greater, if it isn't already high enough, but only if the patch for gthreads is being used. How exactly to write the cpp conditional for that, I don't know, but hopefully you will be able to figure that out. Or maybe you should do that in gdbsupport/thread-pool.cc instead. Whatever is easier. One thing is certain: GDB builds on Windows that don't use the gthread patch should not be broken by increasing the minimum value of _WIN32_WINNT with which GDB can be built on Windows. > as solution I see two ways: > 1) to remove that PP block completely, because as I wrote earlier - no > one in the GDB sources refers to it. > 2) to hide that PP block so that it cannot "infect" other code by by > getting into public headers. I think the right solution is: 3) amend the cpp block to define _WIN32_WINNT to 0x0600 if the threads patch is being used.