public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: i.nixman@autistici.org
Cc: gdb@sourceware.org
Subject: Re: _WIN32_WINNT redefined?
Date: Wed, 02 Nov 2022 17:18:44 +0200	[thread overview]
Message-ID: <83h6zh9ygb.fsf@gnu.org> (raw)
In-Reply-To: <b9583b31c9c4061bf750b1331dc475ee@autistici.org> (i.nixman@autistici.org)

> 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.

  reply	other threads:[~2022-11-02 15:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02  8:14 i.nixman
2022-11-02  8:21 ` i.nixman
2022-11-02  8:44   ` i.nixman
2022-11-02  9:46     ` i.nixman
2022-11-02 10:15       ` i.nixman
2022-11-02 12:59         ` Eli Zaretskii
2022-11-02 13:10           ` Jeffrey Walton
2022-11-02 13:26             ` Eli Zaretskii
2022-11-02 12:50       ` Eli Zaretskii
2022-11-02 14:13         ` i.nixman
2022-11-02 15:18           ` Eli Zaretskii [this message]
2022-11-02 15:51             ` i.nixman
2022-11-02 16:02               ` i.nixman
2022-11-02 16:51               ` Eli Zaretskii
2022-11-02 17:20                 ` i.nixman
2022-11-02 18:13                   ` Eli Zaretskii
2022-11-02 12:55     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83h6zh9ygb.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=gdb@sourceware.org \
    --cc=i.nixman@autistici.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).