mirror of
https://github.com/netdata/libbpf.git
synced 2026-03-18 07:19:07 +08:00
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>
20 lines
355 B
Bash
Executable File
20 lines
355 B
Bash
Executable File
#!/bin/sh
|
|
# Usage: check-reallocarray.sh cc_path [cc_args...]
|
|
|
|
tfile=$(mktemp /tmp/test_reallocarray_XXXXXXXX.c)
|
|
ofile=${tfile%.c}.o
|
|
|
|
cat > $tfile <<EOL
|
|
#define _GNU_SOURCE
|
|
#include <stdlib.h>
|
|
|
|
int main(void)
|
|
{
|
|
return !!reallocarray(NULL, 1, 1);
|
|
}
|
|
EOL
|
|
|
|
"$@" $tfile -o $ofile >/dev/null 2>&1
|
|
if [ $? -ne 0 ]; then echo "FAIL"; fi
|
|
/bin/rm -f $tfile $ofile
|