aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@adacore.com>2014-09-16 14:32:09 -0400
committerJoel Brobecker <brobecker@adacore.com>2015-05-08 10:15:28 -0700
commit519b5f619baa43f000ad18c079017bea8e7fc06a (patch)
tree1b8e1349e1cc0fe7fa451f766214987f091a8042 /libiberty
parenta4674e4efc0c93abd2865d5cf97da710fa3affae (diff)
downloadgdb-519b5f619baa43f000ad18c079017bea8e7fc06a.zip
gdb-519b5f619baa43f000ad18c079017bea8e7fc06a.tar.gz
gdb-519b5f619baa43f000ad18c079017bea8e7fc06a.tar.bz2
libiberty/mkstemps.c: Include <time.h> if <sys/time.h> not available.
Attempting to build libiberty on LynxOS-178 fails trying to compile mkstemps.c with the following error: mkstemps.c:84:18: error: storage size of 'tv' isn't known struct timeval tv; ^ This file would normally include <sys/time.h> to get the type's definition, but unfortunately LynxOS-178 does not want us to use <sys/time.h>, only <time.h>. The configure script correctly finds this out and generates a config.h file where HAVE_SYS_TIME_H is undefined: /* Define to 1 if you have the <sys/time.h> header file. */ /* #undef HAVE_SYS_TIME_H */ This patch fixes the build issue by falling back on including <time.h> if <sys/time.h> could not be included (and provided that HAVE_TIME_H is defined, of course). libiberty/ChangeLog: * mkstemps.c: #include <time.h> if HAVE_TIME_H is defined but not HAVE_SYS_TIME_H.
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog5
-rw-r--r--libiberty/mkstemps.c2
2 files changed, 7 insertions, 0 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 5009807..923613d 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-08 Joel Brobecker <brobecker@adacore.com>
+
+ * mkstemps.c: #include <time.h> if HAVE_TIME_H is defined
+ but not HAVE_SYS_TIME_H.
+
2015-04-22 Eli Zaretskii <eliz@gnu.org>
* setenv.c <environ>: Declare only if not a macro.
diff --git a/libiberty/mkstemps.c b/libiberty/mkstemps.c
index a0e68a7..0e06fe1 100644
--- a/libiberty/mkstemps.c
+++ b/libiberty/mkstemps.c
@@ -35,6 +35,8 @@
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
+#elif HAVE_TIME_H
+#include <time.h>
#endif
#include "ansidecl.h"