From 28bcf330f04575d7e93dec590c7b238eec5174f0 Mon Sep 17 00:00:00 2001 From: Jon Daniel Date: Fri, 27 Jun 2025 22:10:36 +0200 Subject: [PATCH] use C99 stdbool.h and __USE_POSIX for time.h - Use -std=c99 - Avoids warning/error with gcc-14/15 about bool being a typedef - Avoids localtime_r not being defined with -std=c99 --- Makefile | 2 +- README.md | 2 +- db_ipx.c | 5 +---- drally.h | 1 + 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 7fd2218a..d1e562fb 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ MSBUILD := MSBuild.exe DEFINES := -DDR_MULTIPLAYER -DIPXNET -DDR_LETTERBOX #-DDR_CDCHECK INCLUDES := -I/usr/include/SDL2 FLAGS ?= -O3 -FLAGS += -Werror -Wno-unused-result +FLAGS += -std=c99 -Werror -Wno-unused-result LDFLAGS := -lm -lSDL2 -lSDL2_net OBJS := data.o bss.o diff --git a/README.md b/README.md index 7e195554..1e85bac7 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ The main goal of this project is to create a port of Death Rally (1996) running natively on Linux and BSD based operating systems. #### Linux requirements -* GCC/Clang C compiler +* GCC/Clang C compiler supporting C99/POSIX * GNU/Make * SDL2 diff --git a/db_ipx.c b/db_ipx.c index 3cc67313..7d81b276 100644 --- a/db_ipx.c +++ b/db_ipx.c @@ -1,5 +1,6 @@ #include #include +#include #include "drally_ipx.h" @@ -12,10 +13,6 @@ #define CONVIPX(hostvar) hostvar[0], hostvar[1], hostvar[2], hostvar[3], hostvar[4], hostvar[5] -typedef int bool; -#define true 1 -#define false 0 - typedef unsigned char Bit8u; typedef signed short Bit16s; typedef unsigned short Bit16u; diff --git a/drally.h b/drally.h index 7cd48594..6a4257cf 100644 --- a/drally.h +++ b/drally.h @@ -5,6 +5,7 @@ #include #include #include +#define __USE_POSIX 1 #include #include #include