summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--acinclude.m46
-rw-r--r--src/vasprintf.c4
-rw-r--r--tests/tfprintf.c8
-rw-r--r--tests/tprintf.c8
-rw-r--r--tests/tsprintf.c4
5 files changed, 16 insertions, 14 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 28ccecfce..6727f69ef 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1060,7 +1060,8 @@ MPFR_FUNC_GMP_PRINTF_SPEC([lld], [long long int], [
MPFR_FUNC_GMP_PRINTF_SPEC([Lf], [long double], [
#include <gmp.h>
- ],,
+ ],
+ [AC_DEFINE([PRINTF_L], 1, [gmp_printf can read long double])],
[AC_DEFINE([NPRINTF_L], 1, [gmp_printf cannot read long double])])
MPFR_FUNC_GMP_PRINTF_SPEC([td], [ptrdiff_t], [
@@ -1070,6 +1071,7 @@ MPFR_FUNC_GMP_PRINTF_SPEC([td], [ptrdiff_t], [
#include <stddef.h>
#endif
#include <gmp.h>
- ],,
+ ],
+ [AC_DEFINE([PRINTF_T], 1, [gmp_printf can read ptrdiff_t])],
[AC_DEFINE([NPRINTF_T], 1, [gmp_printf cannot read ptrdiff_t])])
])
diff --git a/src/vasprintf.c b/src/vasprintf.c
index 8db67babb..bb16e165a 100644
--- a/src/vasprintf.c
+++ b/src/vasprintf.c
@@ -315,7 +315,7 @@ parse_arg_type (const char *format, struct printf_spec *specinfo)
break;
case 't':
++format;
-#ifndef NPRINTF_T
+#ifdef PRINTF_T
specinfo->arg_type = PTRDIFF_ARG;
#else
specinfo->arg_type = UNSUPPORTED;
@@ -323,7 +323,7 @@ parse_arg_type (const char *format, struct printf_spec *specinfo)
break;
case 'L':
++format;
-#ifndef NPRINTF_L
+#ifdef PRINTF_L
specinfo->arg_type = LONG_DOUBLE_ARG;
#else
specinfo->arg_type = UNSUPPORTED;
diff --git a/tests/tfprintf.c b/tests/tfprintf.c
index c02ea3268..21c470699 100644
--- a/tests/tfprintf.c
+++ b/tests/tfprintf.c
@@ -147,11 +147,11 @@ check_mixed (FILE *fout)
unsigned long ulo = 1;
float f = -1.25;
double d = -1.25;
-#if !defined(NPRINTF_T) || !defined(NPRINTF_L)
+#if defined(PRINTF_T) || defined(PRINTF_L)
long double ld = -1.25;
#endif
-#ifndef NPRINTF_T
+#ifdef PRINTF_T
ptrdiff_t p = 1, saved_p;
#endif
size_t sz = 1;
@@ -197,7 +197,7 @@ check_mixed (FILE *fout)
(void *) &i);
check_length_with_cmp (7, mpfr, 15, mpfr_cmp_ui (mpfr, 15), Rg);
-#ifndef NPRINTF_T
+#ifdef PRINTF_T
saved_p = p;
check_vfprintf (fout, "%% a. %RNg, b. %Qx, c. %td%tn", mpfr, mpq, p, &p);
if (p != 20)
@@ -205,7 +205,7 @@ check_mixed (FILE *fout)
check_length (8, (long) p, 20, ld); /* no format specifier "%td" in C89 */
#endif
-#ifndef NPRINTF_L
+#ifdef PRINTF_L
check_vfprintf (fout, "a. %RA, b. %Lf, c. %QX%zn", mpfr, ld, mpq, &sz);
check_length (9, (unsigned long) sz, 30, lu); /* no format specifier "%zu" in C89 */
#endif
diff --git a/tests/tprintf.c b/tests/tprintf.c
index 4d2731c64..288c9b13d 100644
--- a/tests/tprintf.c
+++ b/tests/tprintf.c
@@ -255,11 +255,11 @@ check_mixed (void)
unsigned long ulo = 1;
float f = -1.25;
double d = -1.25;
-#if !defined(NPRINTF_T) || !defined(NPRINTF_L)
+#if defined(PRINTF_T) || defined(PRINTF_L)
long double ld = -1.25;
#endif
-#ifndef NPRINTF_T
+#ifdef PRINTF_T
ptrdiff_t p = 1, saved_p;
#endif
size_t sz = 1;
@@ -298,7 +298,7 @@ check_mixed (void)
mpfr, mpq, &mpfr, (void *) &i);
check_length_with_cmp (7, mpfr, 15, mpfr_cmp_ui (mpfr, 15), Rg);
-#ifndef NPRINTF_T
+#ifdef PRINTF_T
saved_p = p;
check_vprintf ("%% a. %RNg, b. %Qx, c. %td%tn", mpfr, mpq, p, &p);
if (p != 20)
@@ -306,7 +306,7 @@ check_mixed (void)
check_length (8, (long) p, 20, ld); /* no format specifier '%td' in C89 */
#endif
-#ifndef NPRINTF_L
+#ifdef PRINTF_L
check_vprintf ("a. %RA, b. %Lf, c. %QX%zn", mpfr, ld, mpq, &sz);
check_length (9, (unsigned long) sz, 30, lu); /* no format specifier '%zu' in C89 */
#endif
diff --git a/tests/tsprintf.c b/tests/tsprintf.c
index dade713ad..dcea3c76d 100644
--- a/tests/tsprintf.c
+++ b/tests/tsprintf.c
@@ -783,7 +783,7 @@ mixed (void)
int n1;
int n2;
int i = 121;
-#ifndef NPRINTF_L
+#ifdef PRINTF_L
long double d = 1. / 31.;
#endif
mpf_t mpf;
@@ -820,7 +820,7 @@ mixed (void)
exit (1);
}
-#ifndef NPRINTF_L
+#ifdef PRINTF_L
check_vsprintf ("00000010610209857723, -1.2345678875e+07, 0.032258",
"%.*Zi, %R*e, %Lf", 20, mpz, rnd, x, d);
#endif