diff options
-rw-r--r-- | README.dev | 23 | ||||
-rw-r--r-- | acinclude.m4 | 6 | ||||
-rw-r--r-- | fits_intmax.c | 9 | ||||
-rw-r--r-- | fits_uintmax.c | 9 | ||||
-rw-r--r-- | get_sj.c | 9 | ||||
-rw-r--r-- | get_uj.c | 9 | ||||
-rw-r--r-- | m4/size_max.m4 | 8 | ||||
-rw-r--r-- | set_sj.c | 9 | ||||
-rw-r--r-- | set_uj.c | 9 | ||||
-rw-r--r-- | tests/tfits.c | 9 | ||||
-rw-r--r-- | tests/tfprintf.c | 9 | ||||
-rw-r--r-- | tests/tget_sj.c | 6 | ||||
-rw-r--r-- | tests/tprintf.c | 9 | ||||
-rw-r--r-- | tests/tset_sj.c | 9 | ||||
-rw-r--r-- | vasprintf.c | 9 |
15 files changed, 78 insertions, 64 deletions
diff --git a/README.dev b/README.dev index 00f78eaeb..3d4a660d1 100644 --- a/README.dev +++ b/README.dev @@ -249,7 +249,8 @@ List of the used macros for building MPFR: + HAVE_STDARG: Define if the system supports 'stdarg.h'. Otherwise it is assumed it is 'vararg.h'. -+ HAVE_STDINT_H: Define if 'intmax_t' is supported (ISO C99). ++ HAVE_INTTYPES_H: Define if <inttypes.h> is available (ISO C99). ++ HAVE_STDINT_H: Define if <stdint.h> is available (ISO C99). + MPFR_HAVE_INTMAX_MAX: Define if the INTMAX_MAX macro works correctly (if 'intmax_t' is supported). @@ -348,6 +349,26 @@ use 0 (possibly casted to the target pointer type). ==================================================================== +For files that need intmax_t or similar, use: + +#if HAVE_INTTYPES_H +# include <inttypes.h> +#endif +#if HAVE_STDINT_H +# include <stdint.h> +#endif + +Note that even though the ISO C99 standard requires that <inttypes.h> +include <stdint.h>, in practice this is not true on all platforms, +such as OSF/1 (Tru64) 5.1. This is consistent with autoconf, which +has used this form since 2004-01-26 (in headers.m4). + +References: + http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=62ac9bbfebe879581dabeed78c6ac66b907dd51d + http://websympa.loria.fr/wwsympa/arc/mpfr/2010-08/msg00015.html + + ==================================================================== + Use locale-dependent functions when the result needs to depend on the locales, e.g. the fractional point in mpfr_out_str. diff --git a/acinclude.m4 b/acinclude.m4 index b42d24a02..5e411444b 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -838,12 +838,12 @@ AC_DEFUN([MPFR_CHECK_PRINTF_SPEC], [ AC_REQUIRE([MPFR_CONFIGS])dnl if test "$ac_cv_type_intmax_t" = yes; then MPFR_FUNC_GMP_PRINTF_SPEC([jd], [intmax_t], [ -#ifdef HAVE_STDINT_H -# include <stdint.h> -#endif #ifdef HAVE_INTTYPES_H # include <inttypes.h> #endif +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif ],, [AC_DEFINE([NPRINTF_J], 1, [gmp_printf cannot read intmax_t])]) fi diff --git a/fits_intmax.c b/fits_intmax.c index 5a28b59d4..fc6c5ef56 100644 --- a/fits_intmax.c +++ b/fits_intmax.c @@ -32,11 +32,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #endif #if HAVE_INTTYPES_H -# include <inttypes.h> /* for intmax_t */ -#else -# if HAVE_STDINT_H -# include <stdint.h> -# endif +# include <inttypes.h> +#endif +#if HAVE_STDINT_H +# include <stdint.h> #endif #include "mpfr-impl.h" diff --git a/fits_uintmax.c b/fits_uintmax.c index 58d7bb90d..54ce6d3c9 100644 --- a/fits_uintmax.c +++ b/fits_uintmax.c @@ -32,11 +32,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #endif #if HAVE_INTTYPES_H -# include <inttypes.h> /* for intmax_t */ -#else -# if HAVE_STDINT_H -# include <stdint.h> -# endif +# include <inttypes.h> +#endif +#if HAVE_STDINT_H +# include <stdint.h> #endif #include "mpfr-impl.h" @@ -32,11 +32,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #endif #if HAVE_INTTYPES_H -# include <inttypes.h> /* for intmax_t */ -#else -# if HAVE_STDINT_H -# include <stdint.h> -# endif +# include <inttypes.h> +#endif +#if HAVE_STDINT_H +# include <stdint.h> #endif #include "mpfr-impl.h" @@ -32,11 +32,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #endif #if HAVE_INTTYPES_H -# include <inttypes.h> /* for intmax_t */ -#else -# if HAVE_STDINT_H -# include <stdint.h> -# endif +# include <inttypes.h> +#endif +#if HAVE_STDINT_H +# include <stdint.h> #endif #include "mpfr-impl.h" diff --git a/m4/size_max.m4 b/m4/size_max.m4 index 6cb486892..e44618eec 100644 --- a/m4/size_max.m4 +++ b/m4/size_max.m4 @@ -1,10 +1,11 @@ # size_max.m4 serial 6 -dnl Copyright (C) 2003, 2005-2006 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2005-2006, 2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. +dnl Change by Vincent Lefevre: added <inttypes.h> for consistency with MPFR AC_DEFUN([gl_SIZE_MAX], [ @@ -15,8 +16,11 @@ AC_DEFUN([gl_SIZE_MAX], gl_cv_size_max= AC_EGREP_CPP([Found it], [ #include <limits.h> +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +#endif #if HAVE_STDINT_H -#include <stdint.h> +# include <stdint.h> #endif #ifdef SIZE_MAX Found it @@ -32,11 +32,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #endif #if HAVE_INTTYPES_H -# include <inttypes.h> /* for intmax_t */ -#else -# if HAVE_STDINT_H -# include <stdint.h> -# endif +# include <inttypes.h> +#endif +#if HAVE_STDINT_H +# include <stdint.h> #endif #include "mpfr-impl.h" @@ -32,11 +32,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #endif #if HAVE_INTTYPES_H -# include <inttypes.h> /* for intmax_t */ -#else -# if HAVE_STDINT_H -# include <stdint.h> -# endif +# include <inttypes.h> +#endif +#if HAVE_STDINT_H +# include <stdint.h> #endif #define MPFR_NEED_LONGLONG_H diff --git a/tests/tfits.c b/tests/tfits.c index 3ece79132..39c794a20 100644 --- a/tests/tfits.c +++ b/tests/tfits.c @@ -38,11 +38,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #endif #if HAVE_INTTYPES_H -# include <inttypes.h> /* for intmax_t */ -#else -# if HAVE_STDINT_H -# include <stdint.h> -# endif +# include <inttypes.h> +#endif +#if HAVE_STDINT_H +# include <stdint.h> #endif #include "mpfr-test.h" diff --git a/tests/tfprintf.c b/tests/tfprintf.c index 152d964db..2697dc79b 100644 --- a/tests/tfprintf.c +++ b/tests/tfprintf.c @@ -27,11 +27,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include <stddef.h> #if HAVE_INTTYPES_H -# include <inttypes.h> /* for intmax_t */ -#else -# if HAVE_STDINT_H -# include <stdint.h> -# endif +# include <inttypes.h> +#endif +#if HAVE_STDINT_H +# include <stdint.h> #endif #include "mpfr-test.h" diff --git a/tests/tget_sj.c b/tests/tget_sj.c index 69c709c71..94fa77fec 100644 --- a/tests/tget_sj.c +++ b/tests/tget_sj.c @@ -34,12 +34,12 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., # define __STDC_CONSTANT_MACROS #endif -#ifdef HAVE_STDINT_H -# include <stdint.h> -#endif #ifdef HAVE_INTTYPES_H # include <inttypes.h> #endif +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif #include "mpfr-test.h" diff --git a/tests/tprintf.c b/tests/tprintf.c index ebc222e02..aa413845d 100644 --- a/tests/tprintf.c +++ b/tests/tprintf.c @@ -26,11 +26,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include <stddef.h> #if HAVE_INTTYPES_H -# include <inttypes.h> /* for intmax_t */ -#else -# if HAVE_STDINT_H -# include <stdint.h> -# endif +# include <inttypes.h> +#endif +#if HAVE_STDINT_H +# include <stdint.h> #endif #include "mpfr-test.h" diff --git a/tests/tset_sj.c b/tests/tset_sj.c index a9c69a6a7..ad4fbb09a 100644 --- a/tests/tset_sj.c +++ b/tests/tset_sj.c @@ -37,11 +37,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #endif #if HAVE_INTTYPES_H -# include <inttypes.h> /* for intmax_t */ -#else -# if HAVE_STDINT_H -# include <stdint.h> -# endif +# include <inttypes.h> +#endif +#if HAVE_STDINT_H +# include <stdint.h> #endif #include "mpfr-test.h" diff --git a/vasprintf.c b/vasprintf.c index 883fccd24..d9efc9459 100644 --- a/vasprintf.c +++ b/vasprintf.c @@ -53,11 +53,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #endif #if HAVE_INTTYPES_H -# include <inttypes.h> /* for intmax_t */ -#else -# if HAVE_STDINT_H -# include <stdint.h> /* for WINT_MAX in particular */ -# endif +# include <inttypes.h> +#endif +#if HAVE_STDINT_H +# include <stdint.h> #endif #define MPFR_NEED_LONGLONG_H |