summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2004-08-04 22:26:23 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2004-08-04 22:26:23 +0000
commit01b9ae45c62cd142c157f2f9766264eb7da5a549 (patch)
tree98b05472c8179b1f123f715abdb339fdd09d8e98 /src
parent4e3640a010dfc2e8fa2a84fc86bdda620feaf19e (diff)
downloadcoreutils-01b9ae45c62cd142c157f2f9766264eb7da5a549.tar.xz
(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.
Diffstat (limited to 'src')
-rw-r--r--src/system.h37
1 files 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 <stdint.h>
#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 <ctype.h>
@@ -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