summaryrefslogtreecommitdiff
path: root/src/system.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2016-08-28 16:46:34 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2016-08-28 16:47:13 -0700
commit688f4fb211b603050ef7efd6cbe1db63b31f2fd7 (patch)
tree68fad14686d0a24e5928e9ccdfd8d6a04a0c36af /src/system.h
parentf2712fcddff9c7ff571b19ace30d0d3a195ebde8 (diff)
downloaddiffutils-688f4fb211b603050ef7efd6cbe1db63b31f2fd7.tar.gz
diff: don't assume ptrdiff_t <= long long int
* src/system.h (printint, pI): Port to (theoretical) platforms where ptrdiff_t is wider than long long int (Bug#24311).
Diffstat (limited to 'src/system.h')
-rw-r--r--src/system.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/system.h b/src/system.h
index 481d3a0..028113e 100644
--- a/src/system.h
+++ b/src/system.h
@@ -134,17 +134,19 @@ typedef ptrdiff_t lin;
#define LIN_MAX PTRDIFF_MAX
/* The signed integer type for printing line numbers, and its printf
- length modifier. Prefer 'long int' if it suffices, to cater to C
- implementations that lack support for "ll". The natural
- C99-or-later implementation with ptrdiff_t and "t" is less portable
- in practice. */
+ length modifier. This is not simply ptrdiff_t, to cater to older
+ and/or nonstandard C libraries where "l" works but "ll" and "t" do
+ not, or where 'long' is too narrow and "ll" works but "t" does not. */
#if LIN_MAX <= LONG_MAX
typedef long int printint;
# define pI "l"
-#else
+#elif LIN_MAX <= LLONG_MAX
typedef long long int printint;
# define pI "ll"
+#else
+typedef ptrdiff_t printint;
+# define pI "t"
#endif
verify (TYPE_SIGNED (lin));