From 01b9ae45c62cd142c157f2f9766264eb7da5a549 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 4 Aug 2004 22:26:23 +0000 Subject: [PATCH] (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define to a concatenation of string literals, not to an expression; needed for concatenation contexts. (INTMAX_MAX, INTMAX_MIN): New macros. --- src/system.h | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/system.h b/src/system.h index a24e66f8f..f70616be9 100644 --- a/src/system.h +++ b/src/system.h @@ -369,21 +369,28 @@ initialize_exit_failure (int status) # include #endif -#if !defined PRIdMAX || PRI_MACROS_BROKEN -# undef PRIdMAX -# define PRIdMAX (sizeof (uintmax_t) == sizeof (long int) ? "ld" : "lld") +#if ULONG_MAX < ULLONG_MAX +# define LONGEST_MODIFIER "ll" +#else +# define LONGEST_MODIFIER "l" #endif -#if !defined PRIoMAX || PRI_MACROS_BROKEN +#if PRI_MACROS_BROKEN +# undef PRIdMAX # undef PRIoMAX -# define PRIoMAX (sizeof (uintmax_t) == sizeof (long int) ? "lo" : "llo") -#endif -#if !defined PRIuMAX || PRI_MACROS_BROKEN # undef PRIuMAX -# define PRIuMAX (sizeof (uintmax_t) == sizeof (long int) ? "lu" : "llu") -#endif -#if !defined PRIxMAX || PRI_MACROS_BROKEN # undef PRIxMAX -# define PRIxMAX (sizeof (uintmax_t) == sizeof (long int) ? "lx" : "llx") +#endif +#ifndef PRIdMAX +# define PRIdMAX LONGEST_MODIFIER "d" +#endif +#ifndef PRIoMAX +# define PRIoMAX LONGEST_MODIFIER "o" +#endif +#ifndef PRIuMAX +# define PRIuMAX LONGEST_MODIFIER "u" +#endif +#ifndef PRIxMAX +# define PRIxMAX LONGEST_MODIFIER "x" #endif #include @@ -683,6 +690,14 @@ enum # define INT_MIN TYPE_MINIMUM (int) #endif +#ifndef INTMAX_MAX +# define INTMAX_MAX TYPE_MAXIMUM (intmax_t) +#endif + +#ifndef INTMAX_MIN +# define INTMAX_MIN TYPE_MINIMUM (intmax_t) +#endif + #ifndef UINT_MAX # define UINT_MAX TYPE_MAXIMUM (unsigned int) #endif -- 2.34.1