From: Joel Brobecker <brobecker@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: gdb-patches@sourceware.org
Subject: [RFA] libiberty/mkstemps.c: Include <time.h> if <sys/time.h> not available.
Date: Fri, 08 May 2015 14:38:00 -0000 [thread overview]
Message-ID: <1431095891-7196-1-git-send-email-brobecker@adacore.com> (raw)
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
next reply other threads:[~2015-05-08 14:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-08 14:38 Joel Brobecker [this message]
2015-05-08 16:48 ` DJ Delorie
2015-05-08 17:18 ` Joel Brobecker
2015-05-08 18:51 ` Jeff Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1431095891-7196-1-git-send-email-brobecker@adacore.com \
--to=brobecker@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox