4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-18 23:12:15 +08:00

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 <torbjorn.svensson@st.com>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Torbjörn SVENSSON via Newlib 2020-10-05 14:50:13 +02:00 committed by Corinna Vinschen
parent 93216e2791
commit 7ed952000c
6 changed files with 26 additions and 57 deletions

View File

@ -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_ */

View File

@ -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

View File

@ -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

View File

@ -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();

View File

@ -1,6 +1,7 @@
/* local header used by libc/time routines */
#include <_ansi.h>
#include <time.h>
#include <sys/_tz_structs.h>
#define SECSPERMIN 60L
#define MINSPERHOUR 60L

View File

@ -11,6 +11,7 @@ details. */
#include "tz_posixrules.h"
#include <cygwin/version.h>
#include <stdlib.h>
#include <sys/_tz_structs.h>
static NO_COPY SRWLOCK tzset_guard = SRWLOCK_INIT;