bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

round, roundf: avoid compiler warnings


From: Bruno Haible
Subject: round, roundf: avoid compiler warnings
Date: Tue, 11 Jul 2017 03:52:43 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-83-generic; KDE/5.18.0; x86_64; ; )

Compilers warn when a configure test uses exit() without including <stdlib.h>.
This fixes it:


2017-07-10  Bruno Haible  <address@hidden>

        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";;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]