From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 9D89E3857808; Thu, 15 Oct 2020 17:11:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9D89E3857808 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: Corinna Vinschen To: cygwin-cvs@sourceware.org, newlib-cvs@sourceware.org Subject: [newlib-cygwin] libc/time: Move internal newlib tz-structs into own header X-Act-Checkin: newlib-cygwin X-Git-Author: =?utf-8?q?Torbj=C3=B6rn_SVENSSON_via_Newlib?= X-Git-Refname: refs/heads/master X-Git-Oldrev: 93216e27916bd588fc01425bcb18498672dcaa10 X-Git-Newrev: 7ed952000c2e43f4297fe247f0331e50a14cd688 Message-Id: <20201015171157.9D89E3857808@sourceware.org> Date: Thu, 15 Oct 2020 17:11:57 +0000 (GMT) X-BeenThere: newlib-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib GIT logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2020 17:11:57 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=7ed952000c2e43f4297fe247f0331e50a14cd688 commit 7ed952000c2e43f4297fe247f0331e50a14cd688 Author: Torbjörn SVENSSON via Newlib Date: Mon Oct 5 14:50:13 2020 +0200 libc/time: Move internal newlib tz-structs into own header As discussed in GCC bug 97088 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97088), parameters in prototypes of library functions should use reserved names, or no name at all. This patch moves the internal struct __tzrule_struct to its own internal header sys/_tz_structs.h. This is included from newlib's time code as well as from Cygwin's localtime wrapper. Signed-off-by: Torbjörn SVENSSON Signed-off-by: Corinna Vinschen Diff: --- newlib/libc/include/sys/_tz_structs.h | 24 ++++++++++++++++++++++++ newlib/libc/include/time.h | 20 -------------------- newlib/libc/sys/linux/include/time.h | 20 -------------------- newlib/libc/sys/phoenix/include/time.h | 17 ----------------- newlib/libc/time/local.h | 1 + winsup/cygwin/tzcode/localtime_wrapper.c | 1 + 6 files changed, 26 insertions(+), 57 deletions(-) diff --git a/newlib/libc/include/sys/_tz_structs.h b/newlib/libc/include/sys/_tz_structs.h new file mode 100644 index 000000000..9610b0681 --- /dev/null +++ b/newlib/libc/include/sys/_tz_structs.h @@ -0,0 +1,24 @@ +#ifndef _SYS__TZ_STRUCTS_H_ +#define _SYS__TZ_STRUCTS_H_ + +typedef struct __tzrule_struct +{ + char ch; + int m; /* Month of year if ch=M */ + int n; /* Week of month if ch=M */ + int d; /* Day of week if ch=M, day of year if ch=J or ch=D */ + int s; /* Time of day in seconds */ + time_t change; + long offset; /* Match type of _timezone. */ +} __tzrule_type; + +typedef struct __tzinfo_struct +{ + int __tznorth; + int __tzyear; + __tzrule_type __tzrule[2]; +} __tzinfo_type; + +__tzinfo_type *__gettzinfo (void); + +#endif /* _SYS__TZ_STRUCTS_H_ */ diff --git a/newlib/libc/include/time.h b/newlib/libc/include/time.h index 3031590b4..ed6cc70fe 100644 --- a/newlib/libc/include/time.h +++ b/newlib/libc/include/time.h @@ -102,26 +102,6 @@ void tzset (void); #endif void _tzset_r (struct _reent *); -typedef struct __tzrule_struct -{ - char ch; - int m; - int n; - int d; - int s; - time_t change; - long offset; /* Match type of _timezone. */ -} __tzrule_type; - -typedef struct __tzinfo_struct -{ - int __tznorth; - int __tzyear; - __tzrule_type __tzrule[2]; -} __tzinfo_type; - -__tzinfo_type *__gettzinfo (void); - /* getdate functions */ #ifdef HAVE_GETDATE diff --git a/newlib/libc/sys/linux/include/time.h b/newlib/libc/sys/linux/include/time.h index 5e61d2b65..917a35858 100644 --- a/newlib/libc/sys/linux/include/time.h +++ b/newlib/libc/sys/linux/include/time.h @@ -84,26 +84,6 @@ char *strptime (const char *, const char *, struct tm *); void tzset (void); void _tzset_r (struct _reent *); -typedef struct __tzrule_struct -{ - char ch; - int m; - int n; - int d; - int s; - time_t change; - long offset; /* Match type of _timezone. */ -} __tzrule_type; - -typedef struct __tzinfo_struct -{ - int __tznorth; - int __tzyear; - __tzrule_type __tzrule[2]; -} __tzinfo_type; - -__tzinfo_type *__gettzinfo (void); - /* getdate functions */ #ifndef _REENT_ONLY diff --git a/newlib/libc/sys/phoenix/include/time.h b/newlib/libc/sys/phoenix/include/time.h index 3a9449c77..41fb137e4 100644 --- a/newlib/libc/sys/phoenix/include/time.h +++ b/newlib/libc/sys/phoenix/include/time.h @@ -40,23 +40,6 @@ extern char *_tzname[2]; #define tzname _tzname #endif -typedef struct __tzrule_struct { - char ch; - int m; - int n; - int d; - int s; - time_t change; - long offset; -} __tzrule_type; - -typedef struct __tzinfo_struct { - int __tznorth; - int __tzyear; - __tzrule_type __tzrule[2]; -} __tzinfo_type; - -__tzinfo_type *__gettzinfo(); void tzset(); clock_t clock(); diff --git a/newlib/libc/time/local.h b/newlib/libc/time/local.h index dce51cda2..bfe06e622 100644 --- a/newlib/libc/time/local.h +++ b/newlib/libc/time/local.h @@ -1,6 +1,7 @@ /* local header used by libc/time routines */ #include <_ansi.h> #include +#include #define SECSPERMIN 60L #define MINSPERHOUR 60L diff --git a/winsup/cygwin/tzcode/localtime_wrapper.c b/winsup/cygwin/tzcode/localtime_wrapper.c index 3ac8f8cb0..4e784480b 100644 --- a/winsup/cygwin/tzcode/localtime_wrapper.c +++ b/winsup/cygwin/tzcode/localtime_wrapper.c @@ -11,6 +11,7 @@ details. */ #include "tz_posixrules.h" #include #include +#include static NO_COPY SRWLOCK tzset_guard = SRWLOCK_INIT;