Skip to contentSkip to conversation

shut up gcc4's signed pointer warnings

PATCH New Kay Sievers 1 participant 1 message Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 shut up gcc4's signed pointer warnings

Suppress these stupid warnings if gcc supports it:

ls-tree.c: In function ‘list_recursive’:
ls-tree.c:34: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness ls-tree.c:34: warning: pointer targets in passing argument 1 of ‘__builtin_strcmp’ differ in signedness ls-tree.c:34: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness ls-tree.c:34: warning: pointer targets in passing argument 1 of ‘__builtin_strcmp’ differ in signedness ls-tree.c:34: warning: pointer targets in passing argument 1 of ‘__builtin_strcmp’ differ in signedness ls-tree.c:34: warning: pointer targets in passing argument 1 of ‘__builtin_strcmp’ differ in signedness ls-tree.c:66: warning: pointer targets in passing argument 2 of ‘list_recursive’ differ in signedness

---

Makefile +4 -0
@@ -7,7 +7,11 @@
 # BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely randomly
 # break unless your underlying filesystem supports those sub-second times
 # (my ext3 doesn't).
+
+cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;}
+
 CFLAGS=-g -O2 -Wall
+CFLAGS+= $(call cc-supports,-Wno-pointer-sign)
 
 CC=gcc
 AR=ar