Skip to contentSkip to conversation

fix build on Hurd which doesn't define PATH_MAX

PATCH New Luc Van Oostenryck 1 participant 1 message Aug 1, 2020 Sparse checker

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix build on Hurd which doesn't define PATH_MAX

Hurd doesn't define PATH_MAX but is needed by pre-process.c and sindex.c.

pre-process.c had already its local define but sindex doesn't. So, allow sindex to build on Hurd and avoid possible problems with some future tools by moving the default define of 4096 for it to lib.h where it will be visible for all code.

---
 lib.h         | 4 ++++
 pre-process.c | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)
lib.h +4 -0
index e767840c1038..17b17a72f531 100644
@@ -43,6 +43,10 @@
 #define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
 #endif
 
+#ifndef PATH_MAX
+#define PATH_MAX 4096			// Hurd doesn't define this
+#endif
+
 extern int verbose, optimize_level, optimize_size, preprocessing;
 extern int die_if_error;
 extern int repeat_phase;
pre-process.c +0 -4
index 38167802f465..ca613018720a 100644
@@ -890,10 +890,6 @@ static void set_stream_include_path(struct stream *stream)
 	includepath[0] = path;
 }
 
-#ifndef PATH_MAX
-#define PATH_MAX 4096	// for Hurd where it's not defined
-#endif
-
 static int try_include(const char *path, const char *filename, int flen, struct token **where, const char **next_path)
 {
 	int fd;

base-commit: b24508f10b9a24b01bd41289f440942ff79b197e

Signature · 1 line
2.28.0