Discussion:
round, roundf: avoid compiler warnings
Bruno Haible
2017-07-11 01:52:43 UTC
Permalink
Compilers warn when a configure test uses exit() without including <stdlib.h>.
This fixes it:


2017-07-10 Bruno Haible <***@clisp.org>

round, roundf: Avoid compiler warning in configure test.
* m4/round.m4 (gl_FUNC_ROUND): Use 'return' instead of exit().
* m4/roundf.m4 (gl_FUNC_ROUNDF): Likewise.

diff --git a/m4/round.m4 b/m4/round.m4
index 45b7df4..ede34b2 100644
--- a/m4/round.m4
+++ b/m4/round.m4
@@ -1,4 +1,4 @@
-# round.m4 serial 16
+# round.m4 serial 17
dnl Copyright (C) 2007, 2009-2017 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -57,7 +57,7 @@ int main()
* (double) (1U << ((DBL_MANT_DIG + 3) / 5))
* (double) (1U << ((DBL_MANT_DIG + 4) / 5));
volatile double x = 0.5 - 0.5 / TWO_MANT_DIG;
- exit (x < 0.5 && round (x) != 0.0);
+ return (x < 0.5 && round (x) != 0.0);
}]])], [gl_cv_func_round_works=yes], [gl_cv_func_round_works=no],
[case "$host_os" in
netbsd* | aix*) gl_cv_func_round_works="guessing no";;
diff --git a/m4/roundf.m4 b/m4/roundf.m4
index 543ee0f..f623b55 100644
--- a/m4/roundf.m4
+++ b/m4/roundf.m4
@@ -1,4 +1,4 @@
-# roundf.m4 serial 17
+# roundf.m4 serial 18
dnl Copyright (C) 2007-2017 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -54,7 +54,7 @@ int main()
* (float) (1U << ((FLT_MANT_DIG + 1) / 3))
* (float) (1U << ((FLT_MANT_DIG + 2) / 3));
volatile float x = 0.5f - 0.5f / TWO_MANT_DIG;
- exit (x < 0.5f && roundf (x) != 0.0f);
+ return (x < 0.5f && roundf (x) != 0.0f);
}]])], [gl_cv_func_roundf_works=yes], [gl_cv_func_roundf_works=no],
[case "$host_os" in
mingw*) gl_cv_func_roundf_works="guessing no";;

Loading...