mirror of
https://gitee.com/openharmony/third_party_libbpf
synced 2024-10-07 06:23:25 +00: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:
parent
f56874ba8a
commit
734b3f0afe
@ -1,4 +1,5 @@
|
||||
#!/bin/sh
|
||||
# Usage: check-reallocarray.sh cc_path [cc_args...]
|
||||
|
||||
tfile=$(mktemp /tmp/test_reallocarray_XXXXXXXX.c)
|
||||
ofile=${tfile%.c}.o
|
||||
@ -13,6 +14,6 @@ int main(void)
|
||||
}
|
||||
EOL
|
||||
|
||||
gcc $tfile -o $ofile >/dev/null 2>&1
|
||||
"$@" $tfile -o $ofile >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then echo "FAIL"; fi
|
||||
/bin/rm -f $tfile $ofile
|
||||
|
@ -10,7 +10,7 @@ TOPDIR = ..
|
||||
INCLUDES := -I. -I$(TOPDIR)/include -I$(TOPDIR)/include/uapi
|
||||
ALL_CFLAGS := $(INCLUDES)
|
||||
|
||||
FEATURE_REALLOCARRAY := $(shell $(TOPDIR)/scripts/check-reallocarray.sh)
|
||||
FEATURE_REALLOCARRAY := $(shell $(TOPDIR)/scripts/check-reallocarray.sh $(CC))
|
||||
ifneq ($(FEATURE_REALLOCARRAY),)
|
||||
ALL_CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user