DescriptionStig M. Halvorsen
2014-02-10 07:44:05 EST
Building q3_ui wil fail and break the entire build process if you build a branch with the cURL issue (https://bugzilla.icculus.org/show_bug.cgi?id=6086) patched due to a strange macro issue:
----------
UI_CC code/q3_ui/ui_main.c
<command-line>:0:4: error: expected identifier or '(' before numeric constant
code/q3_ui/../qcommon/q_shared.h:190:15: note: in expansion of macro 'ui'
unsigned int ui;
^
In file included from code/q3_ui/ui_local.h:26:0,
from code/q3_ui/ui_main.c:32:
code/q3_ui/../qcommon/q_shared.h:191:1: warning: no semicolon at end of struct o
r union [enabled by default]
} floatint_t;
^
----------
This is because the union uses "ui" as a member which is somehow defined as a macro in the build process. I have not been able to locate the definition of the ui macro. I have attempted searching for it using grep and listing all GCC predefinitions (gcc -dM -E - < /dev/null). It is not in the Makefile either.
The error does not occur on Ubuntu, OSX or if I use CC=clang in MinGW.
Adding this in q_shared.h before the union declaration resolves the issue:
----------
#ifdef ui
#undef ui
#endif
----------
It can also potentially be fixed by refactoring the union member variable's name.
Other resources regarding this topic:
- http://community.ioquake.org/t/building-ioquake3-using-mingw-on-windows-7-fails/198
- http://openarena.ws/board/index.php?topic=4925.msg50279
Created attachment 3409[details]
Demonstrates a bug in mingw32 gcc.
This is a bug in mingw32, not ioq3.
It appears that if there is a subdirectory with the same name as a macro, the macro magically becomes case insensitive.
I've attached a text file demonstrating the bug, recommending the use of mingw64, which doesn't have this bug, and closing this. In addition, this is not msys specific, I have tried it in cmd.exe with the mingw32 compiler and seen the same behaviour.
Created attachment 3409 [details] Demonstrates a bug in mingw32 gcc. This is a bug in mingw32, not ioq3. It appears that if there is a subdirectory with the same name as a macro, the macro magically becomes case insensitive. I've attached a text file demonstrating the bug, recommending the use of mingw64, which doesn't have this bug, and closing this. In addition, this is not msys specific, I have tried it in cmd.exe with the mingw32 compiler and seen the same behaviour.