-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Please include the following in your bug report:
Version of emscripten/emsdk:
3.1.71
The problem is in my program, bools used to be defined like this in a header file:
typedef enum {false, true} boolean;
And for whatever reason importing emscripten.h
conflicts with that, even though it is boolean
and not bool
. When compiling the file I added Emscripten's header into, the compiler gives this error.
emcc -m32 -O3 -g -s USE_SDL=2 -Wall -DNORMALUNIX -DLINUX -DSDL -c d_main.c -o linux/d_main.o
In file included from d_main.c:49:
In file included from ./doomstat.h:33:
In file included from ./doomdata.h:28:
./doomtype.h:34:15: error: expected identifier
34 | typedef enum {false, true} boolean;
| ^
/home/runner/work/_temp/593f506f-5435-42e1-b4a8-af6c31095bf8/emsdk-main/upstream/lib/clang/20/include/stdbool.h:26:15: note: expanded from macro 'false'
26 | #define false 0
| ^
In file included from d_main.c:49:
In file included from ./doomstat.h:33:
In file included from ./doomdata.h:28:
./doomtype.h:34:22: error: expected identifier
34 | typedef enum {false, true} boolean;
| ^
/home/runner/work/_temp/593f506f-5435-42e1-b4a8-af6c31095bf8/emsdk-main/upstream/lib/clang/20/include/stdbool.h:25:14: note: expanded from macro 'true'
25 | #define true 1
| ^
d_main.c:163:18: warning: multiple unsequenced modifications to 'eventhead' [-Wunsequenced]
163 | eventhead = (++eventhead)&(MAXEVENTS-1);
| ~ ^
d_main.c:180:51: warning: multiple unsequenced modifications to 'eventtail' [-Wunsequenced]
180 | for ( ; eventtail != eventhead ; eventtail = (++eventtail)&(MAXEVENTS-1) )
| ~ ^
2 warnings and 2 errors generated.
So I had to change the definition to this to please Emscripten.
#include <stdbool.h>
typedef bool boolean;
But that did not please my program, since it has many errors where it compares booleans to ints and vice versa, some of which are not pointed out by the compiler.
I personally can't wrangle the spaghetti source code of the program I am planning to port to Emscripten, because of a lack of C experience. If not a bug, is there any way I can fix this conflict without resorting to the newer C99 bindings and making major modifications?