From 97c4d3318909ba49003e12cac208ac40581dd4ae Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 14 Apr 2023 12:52:25 +0200 Subject: [PATCH] year2038: Add reminder to include before time_t gets defined. * lib/sched.in.h: Check that config.h was already included before the * lib/sys_select.in.h: Likewise. * lib/sys_stat.in.h: Likewise. * lib/sys_time.in.h: Likewise. * lib/sys_types.in.h: Likewise. * lib/time.in.h: Likewise. * lib/utime.in.h: Likewise. * modules/year2038 (Depends-on): Add sched, sys_msg, sys_select, sys_sem, sys_shm, sys_stat, sys_time, sys_types, time-h, utime-h. --- ChangeLog | 12 ++++++++++++ lib/sched.in.h | 7 +++++++ lib/sys_select.in.h | 7 +++++++ lib/sys_stat.in.h | 7 +++++++ lib/sys_time.in.h | 7 +++++++ lib/sys_types.in.h | 7 +++++++ lib/time.in.h | 7 +++++++ lib/utime.in.h | 7 +++++++ modules/year2038 | 10 ++++++++++ 9 files changed, 71 insertions(+) diff --git a/ChangeLog b/ChangeLog index 58a28aef68..d547837fe1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2023-04-14 Bruno Haible + year2038: Add reminder to include before time_t gets defined. + * lib/sched.in.h: Check that config.h was already included before the + #include_next. + * lib/sys_select.in.h: Likewise. + * lib/sys_stat.in.h: Likewise. + * lib/sys_time.in.h: Likewise. + * lib/sys_types.in.h: Likewise. + * lib/time.in.h: Likewise. + * lib/utime.in.h: Likewise. + * modules/year2038 (Depends-on): Add sched, sys_msg, sys_select, + sys_sem, sys_shm, sys_stat, sys_time, sys_types, time-h, utime-h. + sys_shm: New module. * lib/sys_shm.in.h: New file. * m4/sys_shm_h.m4: New file. diff --git a/lib/sched.in.h b/lib/sched.in.h index 1f9d0d219a..21aab51938 100644 --- a/lib/sched.in.h +++ b/lib/sched.in.h @@ -21,6 +21,13 @@ #endif @PRAGMA_COLUMNS@ +/* This file uses #include_next of a system file that defines time_t. + For the 'year2038' module to work right, needs to have been + included before. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + /* The include_next requires a split double-inclusion guard. */ #if @HAVE_SCHED_H@ # if @HAVE_SYS_CDEFS_H@ diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h index ce57c7573a..3abfc48af0 100644 --- a/lib/sys_select.in.h +++ b/lib/sys_select.in.h @@ -19,6 +19,13 @@ # endif @PRAGMA_COLUMNS@ +/* This file uses #include_next of a system file that defines time_t. + For the 'year2038' module to work right, needs to have been + included before. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + /* On OSF/1 and Solaris 2.6, and both include . On Cygwin and OpenBSD, includes . diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h index 96bad04e3f..ad4da17fa4 100644 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h @@ -25,6 +25,13 @@ #endif @PRAGMA_COLUMNS@ +/* This file uses #include_next of a system file that defines time_t. + For the 'year2038' module to work right, needs to have been + included before. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #if defined __need_system_sys_stat_h /* Special invocation convention. */ diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h index 5eb6173267..59cce1440d 100644 --- a/lib/sys_time.in.h +++ b/lib/sys_time.in.h @@ -24,6 +24,13 @@ #endif @PRAGMA_COLUMNS@ +/* This file uses #include_next of a system file that defines time_t. + For the 'year2038' module to work right, needs to have been + included before. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + /* On Cygwin and on many BSDish systems, includes itself recursively via . Simply delegate to the system's header in this case; it is a no-op. diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h index 082a6c674d..ea77e140be 100644 --- a/lib/sys_types.in.h +++ b/lib/sys_types.in.h @@ -20,6 +20,13 @@ #endif @PRAGMA_COLUMNS@ +/* This file uses #include_next of a system file that defines time_t. + For the 'year2038' module to work right, needs to have been + included before. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #if defined _WIN32 && !defined __CYGWIN__ \ && (defined __need_off_t || defined __need___off64_t \ || defined __need_ssize_t || defined __need_time_t) diff --git a/lib/time.in.h b/lib/time.in.h index 60e31897e4..84cb1fa933 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -20,6 +20,13 @@ #endif @PRAGMA_COLUMNS@ +/* This file uses #include_next of a system file that defines time_t. + For the 'year2038' module to work right, needs to have been + included before. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + /* Don't get in the way of glibc when it includes time.h merely to declare a few standard symbols, rather than to declare all the symbols. (However, skip this for MinGW as it treats __need_time_t diff --git a/lib/utime.in.h b/lib/utime.in.h index eeb485d495..da49169748 100644 --- a/lib/utime.in.h +++ b/lib/utime.in.h @@ -21,6 +21,13 @@ #endif @PRAGMA_COLUMNS@ +/* This file uses #include_next of a system file that defines time_t. + For the 'year2038' module to work right, needs to have been + included before. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + /* The include_next requires a split double-inclusion guard. */ #if @HAVE_UTIME_H@ # @INCLUDE_NEXT@ @NEXT_UTIME_H@ diff --git a/modules/year2038 b/modules/year2038 index 5e6cc7c58b..7a7b5d4eb5 100644 --- a/modules/year2038 +++ b/modules/year2038 @@ -10,6 +10,16 @@ Files: Depends-on: largefile +sched +sys_msg +sys_select +sys_sem +sys_shm +sys_stat +sys_time +sys_types +time-h +utime-h configure.ac-early: AC_REQUIRE([AC_SYS_YEAR2038]) -- 2.39.5