mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 07:35:06 -05:00
configure: fix compiler warnings in system function checks
Avoid using (void *)1 as an output buffer to fix detection of supported system functions due to -Werror and -Wstringop-overflow etc.
This commit is contained in:
21
configure
vendored
21
configure
vendored
@@ -666,13 +666,15 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $try_clock_gettime = "1" ]; then
|
if [ $try_clock_gettime = "1" ]; then
|
||||||
if test_code 'clock_gettime()' 'time.h' '' '' \
|
if test_code 'clock_gettime()' 'time.h' '' '' '
|
||||||
'clock_gettime(CLOCK_REALTIME, (void *)1);'
|
struct timespec ts;
|
||||||
|
clock_gettime(CLOCK_REALTIME, &ts);'
|
||||||
then
|
then
|
||||||
add_def HAVE_CLOCK_GETTIME
|
add_def HAVE_CLOCK_GETTIME
|
||||||
else
|
else
|
||||||
if test_code 'clock_gettime() in -lrt' 'time.h' '' '-lrt' \
|
if test_code 'clock_gettime() in -lrt' 'time.h' '' '-lrt' '
|
||||||
'clock_gettime(CLOCK_REALTIME, (void *)1);'
|
struct timespec ts;
|
||||||
|
clock_gettime(CLOCK_REALTIME, &ts);'
|
||||||
then
|
then
|
||||||
add_def HAVE_CLOCK_GETTIME
|
add_def HAVE_CLOCK_GETTIME
|
||||||
EXTRA_LIBS="$EXTRA_LIBS -lrt"
|
EXTRA_LIBS="$EXTRA_LIBS -lrt"
|
||||||
@@ -699,13 +701,16 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $try_arc4random = "1" ] && \
|
if [ $try_arc4random = "1" ] && \
|
||||||
test_code 'arc4random_buf()' 'stdlib.h' '' '' \
|
test_code 'arc4random_buf()' 'stdlib.h' '' '' '
|
||||||
'arc4random_buf((void *)1, 1);'
|
char c;
|
||||||
|
arc4random_buf(&c, 1);'
|
||||||
then
|
then
|
||||||
add_def HAVE_ARC4RANDOM
|
add_def HAVE_ARC4RANDOM
|
||||||
else
|
else
|
||||||
if test_code 'getrandom()' 'stdlib.h sys/random.h' '' '' \
|
if test_code 'getrandom()' 'stdlib.h sys/random.h' '' '' '
|
||||||
'return getrandom((void *)1, 1, 0);'; then
|
char c;
|
||||||
|
return getrandom(&c, 1, 0);'
|
||||||
|
then
|
||||||
add_def HAVE_GETRANDOM
|
add_def HAVE_GETRANDOM
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user