Skip to contentSkip to conversation

Makefile: avoid 0 as NULL pointer constant

PATCH In review Christian Göttsche 3 participants 3 messages Jun 23 – Jun 24

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: avoid 0 as NULL pointer constant

From: Christian Göttsche <[email protected]>

fts_close(3) takes a pointer as argument; use (void*)0 instead of pure 0 to please building with -Wzero-as-null-pointer-constant. Avoid using NULL to not require <stddef.h>.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 0e465f94..ae8586c6 100644
@@ -29,7 +29,7 @@ endif
 
 # check for fts_* availability
 H := \#
-ifneq (yes,$(shell printf '${H}include <fts.h>\nint main(void){return fts_close(0);}' | $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Werror=implicit-function-declaration -x c -o /dev/null - >/dev/null 2>&1 && echo yes))
+ifneq (yes,$(shell printf '${H}include <fts.h>\nint main(void){return fts_close((void*)0);}' | $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Werror=implicit-function-declaration -x c -o /dev/null - >/dev/null 2>&1 && echo yes))
 export FTS_LDLIBS := -lfts
 endif
 
Signature · 1 line
2.53.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Christian Göttsche

From: Christian Göttsche <[email protected]>

fts_close(3) takes a pointer as argument; use (void*)0 instead of pure 0 to please building with -Wzero-as-null-pointer-constant. Avoid using NULL to not require <stddef.h>.

Quoted 21 lines
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -2
index 0e465f94..ae8586c6 100644
@@ -29,7 +29,7 @@ endif
 
 # check for fts_* availability
 H := \#
-ifneq (yes,$(shell printf '${H}include <fts.h>\nint main(void){return fts_close(0);}' | $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Werror=implicit-function-declaration -x c -o /dev/null - >/dev/null 2>&1 && echo yes))
+ifneq (yes,$(shell printf '${H}include <fts.h>\nint main(void){return fts_close((void*)0);}' | $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Werror=implicit-function-declaration -x c -o /dev/null - >/dev/null 2>&1 && echo yes))
 export FTS_LDLIBS := -lfts
 endif
 
--

2.53.0

#2 lore raw
Quoted 5 lines · Stephen Smalley
Quoted 3 lines · Christian Göttsche

From: Christian Göttsche <[email protected]>

Quoted 7 lines
Quoted 5 lines

fts_close(3) takes a pointer as argument; use (void*)0 instead of pure 0 to please building with -Wzero-as-null-pointer-constant. Avoid using NULL to not require <stddef.h>.

Merged.

Quoted 21 lines
Quoted 21 lines
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -2
index 0e465f94..ae8586c6 100644
@@ -29,7 +29,7 @@ endif
 
 # check for fts_* availability
 H := \#
-ifneq (yes,$(shell printf '${H}include <fts.h>\nint main(void){return fts_close(0);}' | $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Werror=implicit-function-declaration -x c -o /dev/null - >/dev/null 2>&1 && echo yes))
+ifneq (yes,$(shell printf '${H}include <fts.h>\nint main(void){return fts_close((void*)0);}' | $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Werror=implicit-function-declaration -x c -o /dev/null - >/dev/null 2>&1 && echo yes))
 export FTS_LDLIBS := -lfts
 endif
 
--

2.53.0