commit: 55151a4cd953904bea4c4ed43eab61c92b0cd33d
parent f95ba4296e9ef3f2c47d1214f099af2d76b5794a
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Fri, 26 Jul 2024 10:50:41 +0200
cmd/expr: Define _POSIX_C_SOURCE at Makefile level
Works around OpenBSD yacc (aka oyacc) including <string.h> at
the very beginning of the file.
Diffstat:
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
@@ -163,7 +163,7 @@ cmd/expr.tab.c: cmd/expr.y Makefile
cmd/expr: cmd/expr.tab.c Makefile
$(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno}
- $(CC) -std=c99 $(CFLAGS) -o $@ cmd/expr.tab.c $(LDFLAGS) $(LDSTATIC)
+ $(CC) -std=c99 $(CFLAGS) -D_POSIX_C_SOURCE=200809L -o $@ cmd/expr.tab.c $(LDFLAGS) $(LDSTATIC)
cmd/install: cmd/install.c lib/mode.c lib/user_group_parse.c lib/user_group_parse.h lib/fs.c lib/fs.h lib/mkdir.c lib/mkdir.h Makefile config.mk
$(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno}
diff --git a/cmd/expr.y b/cmd/expr.y
@@ -9,7 +9,11 @@
* Largely rewritten by J.T. Conklin (jtc@wimsey.com)
*/
-#define _POSIX_C_SOURCE 200809L
+/*
+ * Warning: OpenBSD yacc prints the following at the very beginning:
+ * #include <string.h>
+ * #include <stdlib.h>
+ */
#include <sys/types.h>
#include <ctype.h>