[PATCH v2] libc/time: Move internal newlib tz-structs to local.h

Torbjorn SVENSSON torbjorn.svensson@st.com
Thu Oct 15 06:52:19 GMT 2020


Ping!

-----Original Message-----
From: Torbjorn SVENSSON <torbjorn.svensson@st.com> 
Sent: den 5 oktober 2020 14:50
To: newlib@sourceware.org
Cc: Torbjorn SVENSSON <torbjorn.svensson@st.com>; jjohnstn@redhat.com
Subject: [PATCH v2] libc/time: Move internal newlib tz-structs to local.h

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 from the public
API to the internal headerfile newlib/libc/time/local.h.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
---
 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               | 19 +++++++++++++++++++
 4 files changed, 19 insertions(+), 57 deletions(-)

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..290e1aee5 100644
--- a/newlib/libc/time/local.h
+++ b/newlib/libc/time/local.h
@@ -38,3 +38,22 @@ void _tzset_unlocked (void);
 void __tz_lock (void);
 void __tz_unlock (void);
 
+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);
-- 
2.18.0



More information about the Newlib mailing list