From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EE6603854816; Wed, 5 May 2021 12:11:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EE6603854816 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/100429] threading support on windows. _GLIBCXX_HAS_GTHREADS macro is not 1 but libgcc is correct Date: Wed, 05 May 2021 12:11:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 12:11:48 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100429 --- Comment #2 from Jonathan Wakely --- (In reply to cqwrteur from comment #0) > It looks like libgcc DOES provide threading support for windows. However, > _GLIBCXX_HAS_GTHREADS does not get defined for libstdc++, I guess it is > another libtool issue. >=20 > SO GOOD, if we fix them, we will have our own threading support for GCC on > windows. >=20 >=20 > https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/i386/gthr-win= 32.h >=20 >=20 > _GLIBCXX_HAS_GTHREADS Just read the comments in libgcc/gthr.h If the following are also defined, you should #define __GTHREADS_CXX0X 1 to enable the c++0x thread library. None of the required functions are defined by gthr-win32.h so it (correctly) doesn't define __GTHREADS_CXX0X and so libstdc++ doesn't use it. > In file included from > d:\toolchains\include\c++\12.0.0\x86_64-w64-mingw32\bits\gthr.h:148, > from b.cc:4: > d:\toolchains\include\c++\12.0.0\x86_64-w64-mingw32\bits\gthr-default.h: = In > function 'int __gthread_setspecific(__gthread_key_t, const void*)': > d:\toolchains\include\c++\12.0.0\x86_64-w64-mingw32\bits\gthr-default.h:6= 29: > 27: error: types may not be defined in casts > 629 | if (TlsSetValue (__key, CONST_CAST2(void *, const void *, __ptr= )) > !=3D 0) > | ^~~~~~~~~~~ >=20 > BTW. there is another bug in libgcc. This does not work. >=20 > An alternative code should be if (TlsSetValue (__key, void*( __ptr)) !=3D= 0) This seems like an entirely separate issue.=