From: Jim Meyering Date: Mon, 3 Jan 2005 18:43:09 +0000 (+0000) Subject: If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are X-Git-Tag: v5.3.0~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f6d0aeb3ac198512be54ae9684ed26702446477;p=thirdparty%2Fcoreutils.git If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are not all defined and either ULONG_MAX or ULLONG_MAX is not defined, then fail at compile-time rather than let tools like od produce invalid results at run time. --- diff --git a/src/system.h b/src/system.h index 27aff00d79..9fd123812c 100644 --- a/src/system.h +++ b/src/system.h @@ -368,28 +368,38 @@ initialize_exit_failure (int status) # include #endif -#if ULONG_MAX < ULLONG_MAX -# define LONGEST_MODIFIER "ll" -#else -# define LONGEST_MODIFIER "l" -#endif #if PRI_MACROS_BROKEN # undef PRIdMAX # undef PRIoMAX # undef PRIuMAX # undef PRIxMAX #endif + +#if ULONG_MAX < ULLONG_MAX +# define LONGEST_MODIFIER "ll" +#else +# define LONGEST_MODIFIER "l" +#endif + #ifndef PRIdMAX # define PRIdMAX LONGEST_MODIFIER "d" +# defined USED_LONGEST_MODIFIER #endif #ifndef PRIoMAX # define PRIoMAX LONGEST_MODIFIER "o" +# defined USED_LONGEST_MODIFIER #endif #ifndef PRIuMAX # define PRIuMAX LONGEST_MODIFIER "u" +# defined USED_LONGEST_MODIFIER #endif #ifndef PRIxMAX # define PRIxMAX LONGEST_MODIFIER "x" +# defined USED_LONGEST_MODIFIER +#endif + +#if USED_LONGEST_MODIFIER && (!defined ULONG_MAX || !defined ULLONG_MAX) +# error "your PRI.MAX macros are broken and we don't work around it" #endif #include