Skip to content

rts/win32/IOManager.h declarations conflict with windows.h

rts/win32/IOManager.h has the following:

/* On the yucky side..suppress -Wmissing-declarations warnings when
 * including <windows.h>
 */
extern void* GetCurrentFiber ( void );
extern void* GetFiberData ( void );
#include <windows.h>

Which causes problems on my system:

In file included from d:\progging\mingw\bin\../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../../../include/windef.h:253,
                 from d:\progging\mingw\bin\../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../../../include/windows.h:48,
                 from IOManager.h:14,
                 from IOManager.c:11:
d:\progging\mingw\bin\../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../../../include/winnt.h:3832: error: static declaration of 'GetCurrentFiber' follows non-static declaration
IOManager.h:12: error: previous declaration of 'GetCurrentFiber' was here
d:\progging\mingw\bin\../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../../../include/winnt.h:3842: error: static declaration of 'GetFiberData' follows non-static declaration
IOManager.h:13: error: previous declaration of 'GetFiberData' was here

Commenting out the two declarations makes things work again.

A possible reason why this hasn't been a problem for others is that I'm using a 'technology preview' of MinGW from 2007 which comes with GCC 4.2.1, instead of the stable 3.4.5 from 2006.

My winnt.h contains the following (snipped down to size where irrelevant):

#if (__GNUC__ >= 3)
/* Support -masm=intel.  */
static __inline__ PVOID GetCurrentFiber(void)
{
...
}
...
#else /* __GNUC__ >= 3 */
static __inline__ PVOID GetCurrentFiber(void)
{
...
}

So it seems that with a recent enough version of these headers the fiber functions get defined in any case, regardless of compiler version; were people to grab the latest version of w32api they'd run into these problems as well. Judging from the file timestamps I've got 3.11, the second-newest. 3.12's winnt.h appears identical in this respect, so updating wouldn't help.

Since the two lines are claimed to be only for warning avoidance, I suggest just removing them.

Trac metadata
Trac field Value
Version 6.11
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Runtime System
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information