* [RFA] libiberty/mkstemps.c: Include <time.h> if <sys/time.h> not available.
@ 2015-05-08 14:38 Joel Brobecker
2015-05-08 16:48 ` DJ Delorie
2015-05-08 18:51 ` Jeff Law
0 siblings, 2 replies; 4+ messages in thread
From: Joel Brobecker @ 2015-05-08 14:38 UTC (permalink / raw)
To: gcc-patches; +Cc: gdb-patches
Hello,
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.
OK to commit?
Thank you,
--
Joel
---
libiberty/mkstemps.c | 2 ++
1 file changed, 2 insertions(+)
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"
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] libiberty/mkstemps.c: Include <time.h> if <sys/time.h> not available.
2015-05-08 14:38 [RFA] libiberty/mkstemps.c: Include <time.h> if <sys/time.h> not available Joel Brobecker
@ 2015-05-08 16:48 ` DJ Delorie
2015-05-08 17:18 ` Joel Brobecker
2015-05-08 18:51 ` Jeff Law
1 sibling, 1 reply; 4+ messages in thread
From: DJ Delorie @ 2015-05-08 16:48 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gcc-patches, gdb-patches
> * mkstemps.c: #include <time.h> if HAVE_TIME_H is defined
> but not HAVE_SYS_TIME_H.
Ok.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] libiberty/mkstemps.c: Include <time.h> if <sys/time.h> not available.
2015-05-08 16:48 ` DJ Delorie
@ 2015-05-08 17:18 ` Joel Brobecker
0 siblings, 0 replies; 4+ messages in thread
From: Joel Brobecker @ 2015-05-08 17:18 UTC (permalink / raw)
To: DJ Delorie; +Cc: gcc-patches, gdb-patches
> > * mkstemps.c: #include <time.h> if HAVE_TIME_H is defined
> > but not HAVE_SYS_TIME_H.
>
> Ok.
Thank you, DJ. Pushed to both GCC and binutils-gdb.
--
Joel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] libiberty/mkstemps.c: Include <time.h> if <sys/time.h> not available.
2015-05-08 14:38 [RFA] libiberty/mkstemps.c: Include <time.h> if <sys/time.h> not available Joel Brobecker
2015-05-08 16:48 ` DJ Delorie
@ 2015-05-08 18:51 ` Jeff Law
1 sibling, 0 replies; 4+ messages in thread
From: Jeff Law @ 2015-05-08 18:51 UTC (permalink / raw)
To: Joel Brobecker, gcc-patches; +Cc: gdb-patches
On 05/08/2015 08:38 AM, Joel Brobecker wrote:
> Hello,
>
> Attempting to build libiberty on LynxOS-178 fails trying to compile
> mkstemps.c with the following error:
LynxOS? I haven't had to do anything with that since, umm, the early
90s. So sorry you've got that task...
>
> libiberty/ChangeLog:
>
> * mkstemps.c: #include <time.h> if HAVE_TIME_H is defined
> but not HAVE_SYS_TIME_H.
>
> OK to commit?
OK.
jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-08 18:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-08 14:38 [RFA] libiberty/mkstemps.c: Include <time.h> if <sys/time.h> not available Joel Brobecker
2015-05-08 16:48 ` DJ Delorie
2015-05-08 17:18 ` Joel Brobecker
2015-05-08 18:51 ` Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox