summaryrefslogtreecommitdiff
path: root/missing_d
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2018-09-21 12:45:13 +0300
committerArnold D. Robbins <arnold@skeeve.com>2018-09-21 12:45:13 +0300
commita7c32b55995136013af2bff2a0fe4d6c69678cb7 (patch)
tree997a0596a33886fe7b07130859de34ceaf548c37 /missing_d
parent82f0a742be462298c0da027bc4fb56ddcb667c02 (diff)
parentf6a89a9b3ecd956e97b61719ea0d634886ace814 (diff)
downloadgawk-a7c32b55995136013af2bff2a0fe4d6c69678cb7.tar.gz
Merge branch 'gawk-4.2-stable'
Diffstat (limited to 'missing_d')
-rw-r--r--missing_d/ChangeLog5
-rw-r--r--missing_d/intprops.h4
-rw-r--r--missing_d/mktime-internal.h53
-rw-r--r--missing_d/mktime.c6
-rw-r--r--missing_d/verify.h3
5 files changed, 63 insertions, 8 deletions
diff --git a/missing_d/ChangeLog b/missing_d/ChangeLog
index bb4c01a2..9c4879a5 100644
--- a/missing_d/ChangeLog
+++ b/missing_d/ChangeLog
@@ -1,3 +1,8 @@
+2018-09-21 Arnold D. Robbins <arnold@skeeve.com>
+
+ * intprops.h, mktime.c, verify.h: Updated from GNULIB.
+ * mktime-internal.h: New file, imported from GNULIB.
+
2018-09-07 Arnold D. Robbins <arnold@skeeve.com>
* intprops.h, mktime.c: Updated from GNULIB.
diff --git a/missing_d/intprops.h b/missing_d/intprops.h
index a4be30b8..9702aec4 100644
--- a/missing_d/intprops.h
+++ b/missing_d/intprops.h
@@ -342,8 +342,8 @@
Arguments should be free of side effects. */
#define _GL_BINARY_OP_OVERFLOW(a, b, op_result_overflow) \
op_result_overflow (a, b, \
- _GL_INT_MINIMUM ((1 ? 0 : (b)) + (a)), \
- _GL_INT_MAXIMUM ((1 ? 0 : (b)) + (a)))
+ _GL_INT_MINIMUM (_GL_INT_CONVERT (a, b)), \
+ _GL_INT_MAXIMUM (_GL_INT_CONVERT (a, b)))
/* Store the low-order bits of A + B, A - B, A * B, respectively, into *R.
Return 1 if the result overflows. See above for restrictions. */
diff --git a/missing_d/mktime-internal.h b/missing_d/mktime-internal.h
new file mode 100644
index 00000000..3e64156e
--- /dev/null
+++ b/missing_d/mktime-internal.h
@@ -0,0 +1,53 @@
+/* mktime variant that also uses an offset guess
+
+ Copyright 2016-2018 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this program; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <time.h>
+
+/* mktime_offset_t is a signed type wide enough to hold a UTC offset
+ in seconds, and used as part of the type of the offset-guess
+ argument to mktime_internal. Use time_t on platforms where time_t
+ is signed, to be compatible with platforms like BeOS that export
+ this implementation detail of mktime. On platforms where time_t is
+ unsigned, GNU and POSIX code can assume 'int' is at least 32 bits
+ which is wide enough for a UTC offset. */
+
+#if TIME_T_IS_SIGNED
+typedef time_t mktime_offset_t;
+#else
+typedef int mktime_offset_t;
+#endif
+
+time_t mktime_internal (struct tm *,
+ struct tm * (*) (time_t const *, struct tm *),
+ mktime_offset_t *);
+
+/* Although glibc source code uses leading underscores, Gnulib wants
+ ordinary names.
+
+ Portable standalone applications should supply a <time.h> that
+ declares a POSIX-compliant localtime_r, for the benefit of older
+ implementations that lack localtime_r or have a nonstandard one.
+ Similarly for gmtime_r. See the gnulib time_r module for one way
+ to implement this. */
+
+#undef __gmtime_r
+#undef __localtime_r
+#define __gmtime_r gmtime_r
+#define __localtime_r localtime_r
+
+#define __mktime_internal mktime_internal
diff --git a/missing_d/mktime.c b/missing_d/mktime.c
index 1a332e14..3ecab0d1 100644
--- a/missing_d/mktime.c
+++ b/missing_d/mktime.c
@@ -76,11 +76,7 @@
# define NEED_MKTIME_WORKING DEBUG_MKTIME
#endif
-#ifdef _LIBC
-typedef long int mktime_offset_t;
-#else
# include "mktime-internal.h"
-#endif
#ifndef _LIBC
static void
@@ -531,7 +527,7 @@ mktime (struct tm *tp)
be set as if the tzset() function had been called. */
__tzset ();
-# if defined __LIBC || NEED_MKTIME_WORKING
+# if defined _LIBC || NEED_MKTIME_WORKING
static mktime_offset_t localtime_offset;
return __mktime_internal (tp, __localtime_r, &localtime_offset);
# else
diff --git a/missing_d/verify.h b/missing_d/verify.h
index bc7f99db..3b57ddee 100644
--- a/missing_d/verify.h
+++ b/missing_d/verify.h
@@ -276,7 +276,8 @@ template <int w>
when 'assume' silences warnings even with older GCCs. */
# define assume(R) ((R) ? (void) 0 : __builtin_trap ())
#else
-# define assume(R) ((void) (0 && (R)))
+ /* Some tools grok NOTREACHED, e.g., Oracle Studio 12.6. */
+# define assume(R) ((R) ? (void) 0 : /*NOTREACHED*/ (void) 0)
#endif
/* @assert.h omit end@ */