comparison m4/floor.m4 @ 39912:062361de7628

floor, ceil, trunc, truncf, truncl: Defeat GCC optimizations. * m4/floor.m4 (gl_FUNC_FLOOR_LIBS): Use 'floor' also through a function pointer. * m4/ceil.m4 (gl_FUNC_CEIL_LIBS): Use 'ceil' also through a function pointer. * m4/trunc.m4 (gl_FUNC_TRUNC): Use 'trunc' also through a function pointer. * m4/truncf.m4 (gl_FUNC_TRUNCF): Use 'truncf' also through a function pointer. * m4/truncl.m4 (gl_FUNC_TRUNCL): Use 'truncl' also through a function pointer.
author Bruno Haible <bruno@clisp.org>
date Sun, 14 Oct 2018 09:27:21 +0200
parents 10eb9086bea0
children b06060465f09
comparison
equal deleted inserted replaced
39911:5f0ef98dc2ce 39912:062361de7628
1 # floor.m4 serial 10 1 # floor.m4 serial 11
2 dnl Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc. 2 dnl Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation 3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it, 4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved. 5 dnl with or without modifications, as long as this notice is preserved.
6 6
75 [AC_LANG_PROGRAM( 75 [AC_LANG_PROGRAM(
76 [[#ifndef __NO_MATH_INLINES 76 [[#ifndef __NO_MATH_INLINES
77 # define __NO_MATH_INLINES 1 /* for glibc */ 77 # define __NO_MATH_INLINES 1 /* for glibc */
78 #endif 78 #endif
79 #include <math.h> 79 #include <math.h>
80 double (*funcptr) (double) = floor;
80 double x;]], 81 double x;]],
81 [[x = floor(x);]])], 82 [[x = funcptr(x) + floor(x);]])],
82 [gl_cv_func_floor_libm=]) 83 [gl_cv_func_floor_libm=])
83 if test "$gl_cv_func_floor_libm" = "?"; then 84 if test "$gl_cv_func_floor_libm" = "?"; then
84 save_LIBS="$LIBS" 85 save_LIBS="$LIBS"
85 LIBS="$LIBS -lm" 86 LIBS="$LIBS -lm"
86 AC_LINK_IFELSE( 87 AC_LINK_IFELSE(
87 [AC_LANG_PROGRAM( 88 [AC_LANG_PROGRAM(
88 [[#ifndef __NO_MATH_INLINES 89 [[#ifndef __NO_MATH_INLINES
89 # define __NO_MATH_INLINES 1 /* for glibc */ 90 # define __NO_MATH_INLINES 1 /* for glibc */
90 #endif 91 #endif
91 #include <math.h> 92 #include <math.h>
93 double (*funcptr) (double) = floor;
92 double x;]], 94 double x;]],
93 [[x = floor(x);]])], 95 [[x = funcptr(x) + floor(x);]])],
94 [gl_cv_func_floor_libm="-lm"]) 96 [gl_cv_func_floor_libm="-lm"])
95 LIBS="$save_LIBS" 97 LIBS="$save_LIBS"
96 fi 98 fi
97 ]) 99 ])
98 FLOOR_LIBM="$gl_cv_func_floor_libm" 100 FLOOR_LIBM="$gl_cv_func_floor_libm"