The gawk regex engine didn't include stdio.h, and only include
stddef.h if HAVE_STDDEF_H is set.
Adding -DHAVE_STDDEF_H caused some internal errors in by /usr/include
headers, so change the regex.h code to include it unconditionally.
We also need to define -DGAWK so that e.g. "bool", "MAX" and other
similar things used inside gawk get defined.
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
Makefile | 4 ++++
compat/regex/regex.h | 7 +++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index b4745a5..6704780 100644
--- a/Makefile
+++ b/Makefile
@@ -1443,6 +1443,10 @@ ifdef UNRELIABLE_FSTAT
BASIC_CFLAGS += -DUNRELIABLE_FSTAT
endif
ifdef NO_REGEX
+ # TODO: How do I compile just regex.o with this flag, not the
+ # whole of Git?
+ BASIC_CFLAGS += -DGAWK
+
COMPAT_CFLAGS += -Icompat/regex
COMPAT_OBJS += compat/regex/regex.o
endif
diff --git a/compat/regex/regex.h b/compat/regex/regex.h
index de93327..508bc80 100644
--- a/compat/regex/regex.h
+++ b/compat/regex/regex.h
@@ -22,9 +22,12 @@
#ifndef _REGEX_H
#define _REGEX_H 1
-#ifdef HAVE_STDDEF_H
+#include <stdio.h>
+/*
+ Git: Was in `#ifdef HAVE_STDDEF_H` in gawk, adding -DHAVE_STDDEF_H makes a
+ *lot* of other things break
+*/
#include <stddef.h>
-#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
--
1.7.2.1.389.gc3d0b