From patchwork Mon Jan 9 14:47:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 62851 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 106A13858416 for ; Mon, 9 Jan 2023 14:47:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 106A13858416 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673275667; bh=IXkkHUJlQ7lI+K4NXY3oe8zZOKZLUtiBEfKvsC9+UmU=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=K3DE0SgEpiz6B8mhrFA1kevmU8HSMpAZ7ARJympSysR/rlmdy7qdszPCgSdZCGMh3 ZfuPjQp/fNgrcOJkq1Ob0wUpRMceKOJCqrT3rCFSFomfnJLneOyxv7f1jQnOpd2DHO o5kJA6a2+QiLgLV3mREn7fobJF29zEOAr5elUhN8= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by sourceware.org (Postfix) with ESMTPS id 30A423858D1E for ; Mon, 9 Jan 2023 14:47:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 30A423858D1E Received: by mail-il1-x132.google.com with SMTP id x6so308041ill.10 for ; Mon, 09 Jan 2023 06:47:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IXkkHUJlQ7lI+K4NXY3oe8zZOKZLUtiBEfKvsC9+UmU=; b=1NMoEcx1P9TgrfvFsE7tnD+I8EA+PJg+k411oqn2D3lZrFjoV5V3tAFiHHYCqoR7jy 7FEaYMf3WqOExDHjwnuahevw2WAi78G8G59RU2j0YBNhOY2guABOJNJzdWXWU5bQa8Dn cbv+U1aZz9fVmFMgbnDTLeZRWbtqLOtjcv2MVDzfsbZxwHIB7jsSZ8BaDarRRgO2R+Cj nGifyuPo22h6+LLw2oVoRWaiytAYCTfXyUSofIpqfMtSGd51W+IMkd/Rz4nOVLEuTLjE TSziOLxnJqTsh8Uj4tgHRLypjuO1lyRTxPRmQxM6kGp19cJ70es8hbzEP1w4DepcHMiZ XPhg== X-Gm-Message-State: AFqh2krucvm89Qi1agZYgsDaJfIpAWwAc9JXntx1eVV8fv+j30pLVwEy uoOJ6xAdAdhBhwdI7QA5wDMQaLY6ULe8/w6P X-Google-Smtp-Source: AMrXdXvmsq9H9jglGWn9V0e6BEinGp8nKjzBuHDJ+hKCdtj/zImyb4e4ye08cEwISrsHk2ym7Hm1vQ== X-Received: by 2002:a92:c90b:0:b0:302:392c:5878 with SMTP id t11-20020a92c90b000000b00302392c5878mr44850889ilp.13.1673275643409; Mon, 09 Jan 2023 06:47:23 -0800 (PST) Received: from localhost.localdomain (97-122-76-186.hlrn.qwest.net. [97.122.76.186]) by smtp.gmail.com with ESMTPSA id c32-20020a023f60000000b0038a01eba60fsm2844499jaf.69.2023.01.09.06.47.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 06:47:22 -0800 (PST) To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Set _WIN32_WINNT in common.m4 configure check Date: Mon, 9 Jan 2023 07:47:16 -0700 Message-Id: <20230109144716.1988567-1-tromey@adacore.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 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-Patchwork-Original-From: Tom Tromey via Gdb-patches From: Tom Tromey Reply-To: Tom Tromey Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" GCC recently added support for the Windows thread model, enabling libstdc++ to support Windows natively. However, this supporrt requires a version of Windows later than the minimum version that is supported by GDB. PR build/29966 points out that the GDB configure test for std::thread does not work in this situation, because _WIN32_WINNT is not defined in test program, and so seems to be fine. This patch is an attempt to fix the problem, by using the same setting for _WIN32_WINNT at configure time as is used at build time. I don't have access to one of the older systems so I don't think I can truly test this. I did do a mingw cross build, though. I'm going to ask the bug reporter to test it. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29966 --- gdb/configure | 12 +++++++++++- gdbserver/configure | 12 +++++++++++- gdbsupport/common-defs.h | 4 +++- gdbsupport/common.m4 | 13 ++++++++++++- gdbsupport/configure | 12 +++++++++++- 5 files changed, 48 insertions(+), 5 deletions(-) diff --git a/gdb/configure b/gdb/configure index 0591d187f0a..0455af120f3 100755 --- a/gdb/configure +++ b/gdb/configure @@ -24969,7 +24969,17 @@ if ${gdb_cv_cxx_std_thread+:} false; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + #if defined (__MINGW32__) || defined (__CYGWIN__) + # ifdef _WIN32_WINNT + # if _WIN32_WINNT < 0x0501 + # undef _WIN32_WINNT + # define _WIN32_WINNT 0x0501 + # endif + # else + # define _WIN32_WINNT 0x0501 + # endif + #endif /* __MINGW32__ || __CYGWIN__ */ + #include void callback() { } int main () diff --git a/gdbserver/configure b/gdbserver/configure index e5e0cb14d03..e807c60c08a 100755 --- a/gdbserver/configure +++ b/gdbserver/configure @@ -7951,7 +7951,17 @@ if ${gdb_cv_cxx_std_thread+:} false; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + #if defined (__MINGW32__) || defined (__CYGWIN__) + # ifdef _WIN32_WINNT + # if _WIN32_WINNT < 0x0501 + # undef _WIN32_WINNT + # define _WIN32_WINNT 0x0501 + # endif + # else + # define _WIN32_WINNT 0x0501 + # endif + #endif /* __MINGW32__ || __CYGWIN__ */ + #include void callback() { } int main () diff --git a/gdbsupport/common-defs.h b/gdbsupport/common-defs.h index bcebd7187d9..5e529f6febf 100644 --- a/gdbsupport/common-defs.h +++ b/gdbsupport/common-defs.h @@ -70,7 +70,9 @@ /* We don't support Windows versions before XP, so we define _WIN32_WINNT correspondingly to ensure the Windows API headers - expose the required symbols. */ + expose the required symbols. + + NOTE: this must be kept in sync with common.m4. */ #if defined (__MINGW32__) || defined (__CYGWIN__) # ifdef _WIN32_WINNT # if _WIN32_WINNT < 0x0501 diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4 index c6b9a25b744..3909ec81ccb 100644 --- a/gdbsupport/common.m4 +++ b/gdbsupport/common.m4 @@ -100,7 +100,18 @@ AC_DEFUN([GDB_AC_COMMON], [ AC_CACHE_CHECK([for std::thread], gdb_cv_cxx_std_thread, [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [[#include + dnl NOTE: this must be kept in sync with common-defs.h. + [[#if defined (__MINGW32__) || defined (__CYGWIN__) + # ifdef _WIN32_WINNT + # if _WIN32_WINNT < 0x0501 + # undef _WIN32_WINNT + # define _WIN32_WINNT 0x0501 + # endif + # else + # define _WIN32_WINNT 0x0501 + # endif + #endif /* __MINGW32__ || __CYGWIN__ */ + #include void callback() { }]], [[std::thread t(callback);]])], gdb_cv_cxx_std_thread=yes, diff --git a/gdbsupport/configure b/gdbsupport/configure index a0e4a3f94a4..9433ac41468 100755 --- a/gdbsupport/configure +++ b/gdbsupport/configure @@ -8967,7 +8967,17 @@ if ${gdb_cv_cxx_std_thread+:} false; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + #if defined (__MINGW32__) || defined (__CYGWIN__) + # ifdef _WIN32_WINNT + # if _WIN32_WINNT < 0x0501 + # undef _WIN32_WINNT + # define _WIN32_WINNT 0x0501 + # endif + # else + # define _WIN32_WINNT 0x0501 + # endif + #endif /* __MINGW32__ || __CYGWIN__ */ + #include void callback() { } int main ()