Skip to content

Commit

Permalink
build: compatibility with GCC 14 and local config
Browse files Browse the repository at this point in the history
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
tshakalekholoane committed Dec 14, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
tshakalekholoane Tshaka Lekholoane
1 parent 06f1187 commit e0cb8cf
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
4 changes: 0 additions & 4 deletions src/main.c
Original file line number Diff line number Diff line change
@@ -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 <errno.h>
#include <getopt.h>
#include <objc/message.h>

0 comments on commit e0cb8cf

Please sign in to comment.