From e0cb8cfda0174a6a6bebebf60d6b35edce75ca41 Mon Sep 17 00:00:00 2001 From: Tshaka Lekholoane Date: Sat, 14 Dec 2024 13:05:50 +0200 Subject: [PATCH] build: compatibility with GCC 14 and local config Update to work with my local configuration which uses GCC 14 and puts the executable in a different directory. GCC 14 also does not appear to reliably expand the __STDC_VERSION__ macro to the correct value i.e., 202311, when -std=c23 is set. [1] [1]: https://stackoverflow.com/a/78582932 --- Makefile | 6 +++--- src/main.c | 4 ---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index aa68f7f..6d806c2 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ COMMIT = $(shell git rev-parse --short HEAD) DATE = $(shell date -u +"%Y.%m.%d") BUILD = $(shell printf "%s (%s)" "$(DATE)" "$(COMMIT)" ) -CC = cc +CC = gcc-14 CFLAGS = -DCAN_BUILD="\"$(BUILD)\"" -O3 -Wall -Wextra -Wno-c++98-compat \ -Wno-cast-function-type-strict -Wno-declaration-after-statement \ -Wno-format-nonliteral -Wno-incompatible-pointer-types-discards-qualifiers \ @@ -12,7 +12,7 @@ CFLAGS = -DCAN_BUILD="\"$(BUILD)\"" -O3 -Wall -Wextra -Wno-c++98-compat \ all: mkdir -p bin/ - $(CC) $(CFLAGS) -o bin/can src/main.c + $(CC) $(CFLAGS) -o ../can.exe src/main.c clean: - rm -rf bin/ + rm -rf ../can.exe diff --git a/src/main.c b/src/main.c index 26d045b..d2eef54 100644 --- a/src/main.c +++ b/src/main.c @@ -2,10 +2,6 @@ #error "This program is intended to only run on macOS." #endif -#if __STDC_VERSION__ < 202311L -#error "This code requires C23 or later." -#endif - #include #include #include