about summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>2017-09-06 10:00:42 +0200
committerAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>2018-10-24 12:53:27 +0200
commit3500dd283b8e5d8a4916423855514cdbfee36eac (patch)
tree1a4a7a09096f94d446db94617b86b5b10ebe4ea7 /include
parentf1869e11225d9aa054fb11474887d8f109af0949 (diff)
downloadglibc-3500dd283b8e5d8a4916423855514cdbfee36eac.tar.gz
glibc-3500dd283b8e5d8a4916423855514cdbfee36eac.tar.xz
glibc-3500dd283b8e5d8a4916423855514cdbfee36eac.zip
Y2038: add _TIME_BITS support aaribaud/y2038
This makes all previously defined Y2038-proof API types, functions and
implementations the default when _TIME_BITS==64 and __WORDSIZE==32 (so
that 64-bit architectures are unaffected).

Note: it is assumed that the API is consistent, i.e. for each API type
which is enabled here, all API functions which depend on this type are
enabled and mapped to Y2038-proof implementations.
Diffstat (limited to 'include')
-rw-r--r--include/features.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/features.h b/include/features.h
index 5bed0a4996..47eb58b825 100644
--- a/include/features.h
+++ b/include/features.h
@@ -364,6 +364,25 @@
 # define __USE_FILE_OFFSET64	1
 #endif
 
+/* we need to know the word size in order to check the time size */
+#include <bits/wordsize.h>
+
+#if defined _TIME_BITS
+# if _TIME_BITS == 64
+#  if ! defined(_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS != 64
+#   error _TIME_BIT==64 is allowed only when _FILE_OFFSET_BITS==64
+#  elif __WORDSIZE == 32
+#   define __USE_TIME_BITS64	1
+#  endif
+# elif __TIME_BITS == 32
+#  if __WORDSIZE > 32
+#   error __TIME_BITS=32 is not compatible with __WORDSIZE > 32
+#  endif
+# else
+#  error Invalid _TIME_BITS value (can only be 32 or 64)
+# endif
+#endif
+
 #if defined _DEFAULT_SOURCE
 # define __USE_MISC	1
 #endif