aboutsummaryrefslogtreecommitdiff
path: root/libgm2/libm2iso/wraptime.cc
diff options
context:
space:
mode:
authorGaius Mulley <gaiusmod2@gmail.com>2024-05-29 17:26:59 +0100
committerGaius Mulley <gaiusmod2@gmail.com>2024-05-29 17:26:59 +0100
commitd1a1f7e9f0bedea55c558ab95127679bc3e9ff72 (patch)
tree0532d694161ace9bc7b644d3b2c015691f966349 /libgm2/libm2iso/wraptime.cc
parent547143df5aa0960fb149a26933dad7ca1c363afb (diff)
downloadgcc-d1a1f7e9f0bedea55c558ab95127679bc3e9ff72.zip
gcc-d1a1f7e9f0bedea55c558ab95127679bc3e9ff72.tar.gz
gcc-d1a1f7e9f0bedea55c558ab95127679bc3e9ff72.tar.bz2
PR modula2/115276 bugfix libgm2 wraptime.InitTM returns NIL
This patch fixes libgm2/libm2iso/wraptime.cc:InitTM so that it does not always return NULL. The incorrect autoconf macro was used (inside InitTM) and the function short circuited to return NULL. The fix is to use HAVE_SYS_TIME_H and use AC_HEADER_TIME in libgm2/configure.ac. libgm2/ChangeLog: PR modula2/115276 * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Use AC_HEADER_TIME. * libm2iso/wraptime.cc (InitTM): Check HAVE_SYS_TIME_H before using struct tm to obtain the size. gcc/testsuite/ChangeLog: PR modula2/115276 * gm2/isolib/run/pass/testinittm.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
Diffstat (limited to 'libgm2/libm2iso/wraptime.cc')
-rw-r--r--libgm2/libm2iso/wraptime.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/libgm2/libm2iso/wraptime.cc b/libgm2/libm2iso/wraptime.cc
index 158086b..4bbd5f9 100644
--- a/libgm2/libm2iso/wraptime.cc
+++ b/libgm2/libm2iso/wraptime.cc
@@ -113,7 +113,7 @@ EXPORT(KillTimezone) (struct timezone *tv)
/* InitTM - returns a newly created opaque type. */
-#if defined(HAVE_STRUCT_TM) && defined(HAVE_MALLOC_H)
+#if defined(HAVE_SYS_TIME_H) && defined(HAVE_MALLOC_H)
extern "C" struct tm *
EXPORT(InitTM) (void)
{