mirror of
https://github.com/netdata/libbpf.git
synced 2026-11-05 17:30:15 +08:00
check-reallocarray.sh: Use the same compiler Make does
Currently we hardcode "gcc", which means we get a bogus result any time a non-default CC is passed to Make. In fact, it's bogus even when CC is not explicitly set, since Make's default is "cc", which isn't necessarily the same as "gcc". Fix the issue by passing the compiler to use to check-reallocarray.sh. Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
This commit is contained in:
1 parent
f56874ba8a
commit
734b3f0afe
2 files changed
+3
-2
No files matched your search
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
# Usage: check-reallocarray.sh cc_path [cc_args...]
|
||||||
|
|
||||||
tfile=$(mktemp /tmp/test_reallocarray_XXXXXXXX.c)
|
tfile=$(mktemp /tmp/test_reallocarray_XXXXXXXX.c)
|
||||||
ofile=${tfile%.c}.o
|
ofile=${tfile%.c}.o
|
||||||
@@ -13,6 +14,6 @@ int main(void)
|
|||||||
}
|
}
|
||||||
EOL
|
EOL
|
||||||
|
|
||||||
gcc $tfile -o $ofile >/dev/null 2>&1
|
"$@" $tfile -o $ofile >/dev/null 2>&1
|
||||||
if [ $? -ne 0 ]; then echo "FAIL"; fi
|
if [ $? -ne 0 ]; then echo "FAIL"; fi
|
||||||
/bin/rm -f $tfile $ofile
|
/bin/rm -f $tfile $ofile
|
||||||
+1
-1
@@ -10,7 +10,7 @@ TOPDIR = ..
|
|||||||
INCLUDES := -I. -I$(TOPDIR)/include -I$(TOPDIR)/include/uapi
|
INCLUDES := -I. -I$(TOPDIR)/include -I$(TOPDIR)/include/uapi
|
||||||
ALL_CFLAGS := $(INCLUDES)
|
ALL_CFLAGS := $(INCLUDES)
|
||||||
|
|
||||||
FEATURE_REALLOCARRAY := $(shell $(TOPDIR)/scripts/check-reallocarray.sh)
|
FEATURE_REALLOCARRAY := $(shell $(TOPDIR)/scripts/check-reallocarray.sh $(CC))
|
||||||
ifneq ($(FEATURE_REALLOCARRAY),)
|
ifneq ($(FEATURE_REALLOCARRAY),)
|
||||||
ALL_CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
|
ALL_CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in new issue
Block a user