Skip to content

Commit 9d67af9

Browse files
Merge pull request #20 from wojciech-graj/revert-18-master
Revert "compat: Use standard bool to resolve C99+ keyword conflicts"
2 parents 4885126 + d4456ce commit 9d67af9

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ CFLAGS+=-DNORMALUNIX -DLINUX
1515
OUTPUT=$(BINDIR)/doom_ascii
1616
endif
1717

18-
CFLAGS+=-Os -flto -Wall -D_DEFAULT_SOURCE #-DSNDSERV -DUSEASM
18+
CFLAGS+=-Os -flto -Wall -D_DEFAULT_SOURCE -std=c99 #-DSNDSERV -DUSEASM
1919
LDFLAGS+=-flto
2020
LIBS+=-lm
2121

src/doomtype.h

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,22 @@
6565

6666
#include <inttypes.h>
6767

68-
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus)
69-
// For C99+ and C++, use the standard boolean type
70-
#include <stdbool.h>
68+
#ifdef __cplusplus
69+
70+
// Use builtin bool type with C++.
71+
72+
typedef bool bool;
73+
7174
#else
72-
// For older C standards, use the original custom enum
73-
typedef enum { false = 0, true = 1 } bool;
74-
#endif
7575

76-
// The original enum also defined an 'undef' state.
77-
// left for compatibility
78-
enum {
79-
undef = 0xFFFFFFFF
80-
};
76+
typedef enum
77+
{
78+
false = 0,
79+
true = 1,
80+
undef = 0xFFFFFFFF
81+
} bool;
82+
83+
#endif
8184

8285
typedef uint8_t byte;
8386

0 commit comments

Comments
 (0)