After some brainstorming and some help from a mingw.org user we managed
to get gcc building again with pthreads-w32. Theres a few changes
needed, first and foremost windows.h must not be included in pthread.h,
i used a guard to only allow it at build time but it should newer be
allowed if we want to do this correctly since it breaks gcc macros.
Secondly the check for __MINGW64__ is wrong since __MINGW64__ ==
__MINGW32__ if you want to distinguish the builds for the mingw-w64
compiler the correct define is __MINGW64_VERSION_MAJOR.
Rest of the changes are against gcc itself and have been pushed to the
gcc dev team.
Im not sure where to submit patches for pthreads-w32 since the
repository is read only,
but i can forward them to you if you prefer it that way.