summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2015-04-18 22:26:49 +0300
committerIgor Pashev <pashev.igor@gmail.com>2015-04-18 22:26:49 +0300
commit4099793c02b840a26c3e7a83075a126028ce6b86 (patch)
tree81607fa836f1fa55e10c6ac4643f65f4945fa3e5 /libc
parent2055b03fe5b26e70a69fe06b93798fb4eac1fbaf (diff)
downloadillumos-packaging-4099793c02b840a26c3e7a83075a126028ce6b86.tar.gz
struct-tm.patch: use redefine_extname
Diffstat (limited to 'libc')
-rw-r--r--libc/debian/changelog2
-rw-r--r--libc/debian/patches/series2
-rw-r--r--libc/debian/patches/struct-tm.patch106
3 files changed, 79 insertions, 31 deletions
diff --git a/libc/debian/changelog b/libc/debian/changelog
index 2941fc2..cdb4f1f 100644
--- a/libc/debian/changelog
+++ b/libc/debian/changelog
@@ -2,6 +2,8 @@ libc (4.3+17) UNRELEASED; urgency=medium
* debian/patches/__time_t.patch: define __time_t == time_t in time.h
for nano
+ * debian/patches/struct-tm.patch: use redefine_extname instead of
+ macros: /usr/include/c++/4.9/ctime undefines our macros
-- Igor Pashev <pashev.igor@gmail.com> Thu, 02 Apr 2015 23:00:37 +0300
diff --git a/libc/debian/patches/series b/libc/debian/patches/series
index 7e06083..fd57eea 100644
--- a/libc/debian/patches/series
+++ b/libc/debian/patches/series
@@ -115,7 +115,6 @@ rpc_gss.patch
no-unwind.patch
string-strings.patch
gnu-basename.patch
-struct-tm.patch
i386-regset.patch
libnsl-getdomainname.patch
remove-statfs.patch
@@ -131,3 +130,4 @@ features.patch
libld-reg.patch
rtld-mmapobj.patch
__time_t.patch
+struct-tm.patch
diff --git a/libc/debian/patches/struct-tm.patch b/libc/debian/patches/struct-tm.patch
index fa0f781..7a90175 100644
--- a/libc/debian/patches/struct-tm.patch
+++ b/libc/debian/patches/struct-tm.patch
@@ -14,7 +14,7 @@ Index: libc/usr/src/head/iso/time_iso.h
#ifdef __cplusplus
extern "C" {
-@@ -94,8 +94,17 @@ struct tm { /* see ctime(3) */
+@@ -94,9 +94,15 @@ struct tm { /* see ctime(3) */
int tm_wday;
int tm_yday;
int tm_isdst;
@@ -27,11 +27,33 @@ Index: libc/usr/src/head/iso/time_iso.h
+#endif
};
-+#undef mktime
-+#define mktime __gnu_mktime
-
+-
#if defined(__STDC__)
+ extern char *asctime(const struct tm *);
+@@ -105,11 +111,21 @@ extern char *ctime(const time_t *);
+ extern double difftime(time_t, time_t);
+ extern struct tm *gmtime(const time_t *);
+ extern struct tm *localtime(const time_t *);
+-extern time_t mktime(struct tm *);
+ extern time_t time(time_t *);
+ extern size_t strftime(char *_RESTRICT_KYWD, size_t, const char *_RESTRICT_KYWD,
+ const struct tm *_RESTRICT_KYWD);
+
++#ifndef __IN_LIBC
++#ifdef __PRAGMA_REDEFINE_EXTNAME
++extern time_t mktime(struct tm *);
++#pragma redefine_extname mktime __gnu_mktime
++#else
++static time_t mktime(struct tm *___tm) {
++ return __gnu_mktime(___tm);
++}
++#endif
++#endif /* __IN_LIBC */
++
+ #else /* __STDC__ */
+
+ extern char *asctime();
Index: libc/usr/src/head/time.h
===================================================================
--- libc.orig/usr/src/head/time.h
@@ -45,43 +67,67 @@ Index: libc/usr/src/head/time.h
#include <iso/time_iso.h>
#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
(_POSIX_C_SOURCE > 2) || defined(__EXTENSIONS__)
-@@ -80,6 +80,10 @@ typedef int timer_t;
+@@ -85,10 +85,27 @@ typedef int timer_t;
#if defined(__EXTENSIONS__) || \
(!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
(_POSIX_C_SOURCE - 0 >= 199506L) || defined(_REENTRANT)
-+#undef gmtime_r
-+#undef localtime_r
-+#define gmtime_r __gnu_gmtime_r
-+#define localtime_r __gnu_localtime_r
++
++#ifndef __IN_LIBC
++#ifdef __PRAGMA_REDEFINE_EXTNAME
extern struct tm *gmtime_r(const time_t *_RESTRICT_KYWD,
struct tm *_RESTRICT_KYWD);
extern struct tm *localtime_r(const time_t *_RESTRICT_KYWD,
-@@ -178,6 +182,8 @@ extern int daylight;
+ struct tm *_RESTRICT_KYWD);
++#pragma redefine_extname gmtime_r __gnu_gmtime_r
++#pragma redefine_extname localtime_r __gnu_localtime_r
++#else /* ! __PRAGMA_REDEFINE_EXTNAME */
++static struct tm *gmtime_r(const time_t *_RESTRICT_KYWD __t,
++ struct tm *_RESTRICT_KYWD __tm) {
++ return __gnu_gmtime_r(__t, __tm);
++}
++static struct tm *localtime_r(const time_t *_RESTRICT_KYWD __t,
++ struct tm *_RESTRICT_KYWD __tm) {
++ return __gnu_localtime_r(__t, __tm);
++}
++#endif /* __PRAGMA_REDEFINE_EXTNAME */
++#endif /* __IN_LIBC */
++
+ #endif
+
+ #if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
+@@ -183,7 +200,18 @@ extern int daylight;
#if (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
defined(__EXTENSIONS__)
-+#undef timegm
-+#define timegm __gnu_timegm
++
++#ifndef __IN_LIBC
++#ifdef __PRAGMA_REDEFINE_EXTNAME
extern time_t timegm(struct tm *);
++#pragma redefine_extname timegm __gnu_timegm
++#else /* ! __PRAGMA_REDEFINE_EXTNAME */
++static time_t timegm(struct tm *__tm) {
++ return __gnu_timegm(__tm);
++}
++#endif /* __PRAGMA_REDEFINE_EXTNAME */
++#endif /* __IN_LIBC */
++
extern int cftime(char *, char *, const time_t *);
extern int ascftime(char *, const char *, const struct tm *);
+ extern long altzone;
Index: libc/usr/src/lib/libc/port/gen/localtime.c
===================================================================
--- libc.orig/usr/src/lib/libc/port/gen/localtime.c
+++ libc/usr/src/lib/libc/port/gen/localtime.c
-@@ -117,6 +117,11 @@
- #include <sys/stat.h>
- #include <sys/mman.h>
-
-+#undef gmtime_r
-+#undef localtime_r
-+#undef mktime
-+#undef timegm
+@@ -88,6 +88,8 @@
+ * Functions that are common to ctime(3C) and cftime(3C)
+ */
+
+
- /* JAN_01_1902 cast to (int) - negative number of seconds from 1970 */
- #define JAN_01_1902 (int)0x8017E880
- #define LEN_TZDIR (sizeof (TZDIR) - 1)
-@@ -488,6 +493,14 @@ gmtime_r(const time_t *timep, struct tm
++#define __IN_LIBC
+ #pragma weak _tzset = tzset
+
+ #undef TZDIR
+@@ -488,6 +490,14 @@ gmtime_r(const time_t *timep, struct tm
return (offtime_u((time_t)*timep, 0L, p_tm));
}
@@ -96,7 +142,7 @@ Index: libc/usr/src/lib/libc/port/gen/localtime.c
/*
* Accepts a time_t, returns a tm struct based on it, with
* no local timezone adjustment.
-@@ -507,7 +520,7 @@ gmtime(const time_t *timep)
+@@ -507,7 +517,7 @@ gmtime(const time_t *timep)
if (p_tm == NULL) /* memory allocation failure */
p_tm = &tm; /* use static buffer and hope for the best */
@@ -105,7 +151,7 @@ Index: libc/usr/src/lib/libc/port/gen/localtime.c
}
/*
-@@ -649,6 +662,34 @@ localtime_r(const time_t *timep, struct
+@@ -649,6 +659,34 @@ localtime_r(const time_t *timep, struct
return (rt);
}
@@ -140,7 +186,7 @@ Index: libc/usr/src/lib/libc/port/gen/localtime.c
/*
* Accepts a time_t, returns a tm struct based on it, correcting
* for the local timezone. Produces documented side-effects to
-@@ -673,7 +714,7 @@ localtime(const time_t *timep)
+@@ -673,7 +711,7 @@ localtime(const time_t *timep)
if (p_tm == NULL) /* memory allocation failure */
p_tm = &tm; /* use static buffer and hope for the best */
@@ -149,7 +195,7 @@ Index: libc/usr/src/lib/libc/port/gen/localtime.c
}
/*
-@@ -682,7 +723,7 @@ localtime(const time_t *timep)
+@@ -682,7 +720,7 @@ localtime(const time_t *timep)
* extern global zone state variables. (See mktime(3C)).
*/
static time_t
@@ -158,7 +204,7 @@ Index: libc/usr/src/lib/libc/port/gen/localtime.c
{
struct tm _tm;
long long t; /* must hold more than 32-bit time_t */
-@@ -823,7 +864,19 @@ mktime1(struct tm *tmptr, int usetz)
+@@ -823,7 +861,19 @@ mktime1(struct tm *tmptr, int usetz)
mketimerrno = EOVERFLOW;
t = -1;
} else {
@@ -179,7 +225,7 @@ Index: libc/usr/src/lib/libc/port/gen/localtime.c
}
lmutex_unlock(&_time_lock);
-@@ -837,15 +890,26 @@ mktime1(struct tm *tmptr, int usetz)
+@@ -837,15 +887,26 @@ mktime1(struct tm *tmptr, int usetz)
time_t
mktime(struct tm *tmptr)
{