diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-11-23 19:19:04 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-11-23 19:19:04 +0000 |
commit | 3549d662799f4c8d9ed0a0fac7ca17c2e80ba63b (patch) | |
tree | f9980dd7c68687c63d72fa784f9fa58ec154801d | |
parent | f23d466992b53d9bf706686c38273c6417d55122 (diff) | |
download | mpfr-3549d662799f4c8d9ed0a0fac7ca17c2e80ba63b.tar.gz |
stdarg-related corrections, as HAVE_STDARG is not standard thus must not
be tested in mpfr.h!
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4998 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | mpfr.h | 13 | ||||
-rw-r--r-- | printf.c | 1 | ||||
-rw-r--r-- | vasprintf.c | 16 |
3 files changed, 16 insertions, 14 deletions
@@ -39,16 +39,15 @@ MPFR_VERSION_NUM(MPFR_VERSION_MAJOR,MPFR_VERSION_MINOR,MPFR_VERSION_PATCHLEVEL) # include <gmp.h> #endif -/* Try to include stdarg.h */ -#ifdef HAVE_STDARG -# include <stdarg.h> -#endif - /* Check if stdio.h is included or if the user wants FILE */ #if defined (_GMP_H_HAVE_FILE) || defined (MPFR_USE_FILE) # define _MPFR_H_HAVE_FILE 1 #endif +#if defined (_GMP_H_HAVE_VA_LIST) +# define _MPFR_H_HAVE_VA_LIST 1 +#endif + /* Check if stdint.h/inttypes.h is included or if the user wants intmax_t */ #if (defined (INTMAX_C) && defined (UINTMAX_C)) || defined (MPFR_USE_INTMAX_T) # define _MPFR_H_HAVE_INTMAX_T 1 @@ -333,7 +332,7 @@ __MPFR_DECLSPEC size_t mpfr_out_str _MPFR_PROTO ((FILE*, int, size_t, mpfr_srcptr, mpfr_rnd_t)); #endif -#ifdef HAVE_STDARG +#ifdef _MPFR_H_HAVE_VA_LIST #ifdef _MPFR_H_HAVE_FILE __MPFR_DECLSPEC int mpfr_printf _MPFR_PROTO ((__gmp_const char*, ...)); __MPFR_DECLSPEC int mpfr_fprintf _MPFR_PROTO ((FILE*, __gmp_const char*, @@ -354,7 +353,7 @@ __MPFR_DECLSPEC int mpfr_snprintf _MPFR_PROTO ((char*, size_t, __gmp_const char*, ...)); __MPFR_DECLSPEC int mpfr_vsnprintf _MPFR_PROTO ((char*, size_t, __gmp_const char*, va_list)); -#endif /* HAVE_STDARG */ +#endif /* _MPFR_H_HAVE_VA_LIST */ __MPFR_DECLSPEC int mpfr_pow _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t)); @@ -23,6 +23,7 @@ MA 02110-1301, USA. */ /* The mpfr_printf-like functions are defined only if stdarg.h exist */ #ifdef HAVE_STDARG +#include <stdarg.h> #include "mpfr-impl.h" #ifdef _MPFR_H_HAVE_FILE diff --git a/vasprintf.c b/vasprintf.c index d19ebae1e..b52e61a7b 100644 --- a/vasprintf.c +++ b/vasprintf.c @@ -1,4 +1,4 @@ -/* mpfr_vasprintf -- main function for the printf functions family +/* mpfr_vasprintf -- main function for the printf functions family plus helper macros & functions. Copyright 2007 Free Software Foundation, Inc. @@ -24,6 +24,8 @@ MA 02110-1301, USA. */ /* The mpfr_printf-like functions are defined only if stdarg.h exist */ #ifdef HAVE_STDARG +#include <stdarg.h> + #ifdef HAVE_STDINT_H #include <stdint.h> #endif @@ -56,7 +58,7 @@ MA 02110-1301, USA. */ /* We assume that a single conversion specifier produces at most 4095 chars - (Rationale for International Standard —Programming Languages— C + (Rationale for International Standard -Programming Languages- C Revision 5.10 April-2003, 7.19.6.1 p152). */ #define MAX_CHAR_PRODUCED_BY_SPEC 4096 @@ -90,7 +92,7 @@ MA 02110-1301, USA. */ } \ } while (0) -/* __arg_type contains all the types described by the 'type' field of the +/* __arg_type contains all the types described by the 'type' field of the format string */ enum __arg_type { @@ -277,7 +279,7 @@ parse_arg_type (__gmp_const char *format, struct printf_spec *specinfo) #define CASE_INTMAX_ARG \ case INTMAX_ARG: \ (void) va_arg ((ap), intmax_t); \ - break; + break; #endif #define CONSUME_VA_ARG(specinfo, ap) \ @@ -495,7 +497,7 @@ sprnt_fp (struct string_buffer *buf, mpfr_srcptr p, struct printf_spec spec) char *str; char *str_curr = NULL; - /* char_fp details how much characters are needed in each part of a float + /* char_fp details how much characters are needed in each part of a float print. */ struct char_fp { @@ -862,7 +864,7 @@ mpfr_vasprintf (char **ptr, __gmp_const char *fmt, va_list ap) /* informations on the conversion specification filled by the parser */ struct printf_spec spec; - /* flag raised when previous part of fmt need to be processed by + /* flag raised when previous part of fmt need to be processed by gmp_vsnprintf */ int gmp_fmt_flag; /* beginning and end of the previous unprocessed part of fmt */ @@ -1002,7 +1004,7 @@ mpfr_vasprintf (char **ptr, __gmp_const char *fmt, va_list ap) case 'G': case 'a': case 'A': - case 'b': + case 'b': sprnt_fp (&buf, p, spec); } } |