* [PATCH] bfd: add missing include <time.h>
@ 2024-03-13 10:37 Clément Chigot
2024-03-14 12:46 ` Clément Chigot
2024-03-18 11:49 ` Nick Clifton
0 siblings, 2 replies; 5+ messages in thread
From: Clément Chigot @ 2024-03-13 10:37 UTC (permalink / raw)
To: binutils; +Cc: nickc, Clément Chigot
bdfio.c is defining bfd_get_current_time which is returning a time_t.
This type is defined in time.h and thus, must be included in bfd main
header to avoid undefined type when include bfd.h.
Note that most of the time, <time.h> is pulled by <sys/stat.h> already
included in bfd.h. That's why it went unnoticed.
---
bfd/bfd-in.h | 1 +
bfd/bfd-in2.h | 1 +
2 files changed, 2 insertions(+)
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 0ff1e2f3ed5..04e65aad5f0 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -36,6 +36,7 @@ extern "C" {
#include "symcat.h"
#include <stdint.h>
#include <stdbool.h>
+#include <time.h>
#include "diagnostics.h"
#include <stdarg.h>
#include <string.h>
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index a335df522d2..eb58b674d25 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -44,6 +44,7 @@ extern "C" {
#include "symcat.h"
#include <stdint.h>
#include <stdbool.h>
+#include <time.h>
#include "diagnostics.h"
#include <stdarg.h>
#include <string.h>
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bfd: add missing include <time.h>
2024-03-13 10:37 [PATCH] bfd: add missing include <time.h> Clément Chigot
@ 2024-03-14 12:46 ` Clément Chigot
2024-03-15 15:39 ` Tom Tromey
2024-03-18 11:49 ` Nick Clifton
1 sibling, 1 reply; 5+ messages in thread
From: Clément Chigot @ 2024-03-14 12:46 UTC (permalink / raw)
To: binutils; +Cc: nickc
Hi Nick,
This patch looks trivial. Though, I'm wondering if binutils might
support some non-posix systems where this new include could trigger
issues. Do you think this could be the case ?
Clément
On Wed, Mar 13, 2024 at 11:37 AM Clément Chigot <chigot@adacore.com> wrote:
>
> bdfio.c is defining bfd_get_current_time which is returning a time_t.
> This type is defined in time.h and thus, must be included in bfd main
> header to avoid undefined type when include bfd.h.
>
> Note that most of the time, <time.h> is pulled by <sys/stat.h> already
> included in bfd.h. That's why it went unnoticed.
> ---
> bfd/bfd-in.h | 1 +
> bfd/bfd-in2.h | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
> index 0ff1e2f3ed5..04e65aad5f0 100644
> --- a/bfd/bfd-in.h
> +++ b/bfd/bfd-in.h
> @@ -36,6 +36,7 @@ extern "C" {
> #include "symcat.h"
> #include <stdint.h>
> #include <stdbool.h>
> +#include <time.h>
> #include "diagnostics.h"
> #include <stdarg.h>
> #include <string.h>
> diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
> index a335df522d2..eb58b674d25 100644
> --- a/bfd/bfd-in2.h
> +++ b/bfd/bfd-in2.h
> @@ -44,6 +44,7 @@ extern "C" {
> #include "symcat.h"
> #include <stdint.h>
> #include <stdbool.h>
> +#include <time.h>
> #include "diagnostics.h"
> #include <stdarg.h>
> #include <string.h>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bfd: add missing include <time.h>
2024-03-14 12:46 ` Clément Chigot
@ 2024-03-15 15:39 ` Tom Tromey
2024-03-18 11:49 ` Nick Clifton
0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2024-03-15 15:39 UTC (permalink / raw)
To: Clément Chigot; +Cc: binutils, nickc
>>>>> "Clément" == Clément Chigot <chigot@adacore.com> writes:
Clément> This patch looks trivial. Though, I'm wondering if binutils might
Clément> support some non-posix systems where this new include could trigger
Clément> issues. Do you think this could be the case ?
FWIW a good resource for answering this kind of question is the gnulib
manual. It normally documents when a header is missing or when it
doesn't define something that it ought to.
On this basis time.h seems safe:
https://www.gnu.org/software/gnulib/manual/html_node/time_002eh.html
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bfd: add missing include <time.h>
2024-03-13 10:37 [PATCH] bfd: add missing include <time.h> Clément Chigot
2024-03-14 12:46 ` Clément Chigot
@ 2024-03-18 11:49 ` Nick Clifton
1 sibling, 0 replies; 5+ messages in thread
From: Nick Clifton @ 2024-03-18 11:49 UTC (permalink / raw)
To: Clément Chigot, binutils
Hi Clément,
> bdfio.c is defining bfd_get_current_time which is returning a time_t.
> This type is defined in time.h and thus, must be included in bfd main
> header to avoid undefined type when include bfd.h.
>
> Note that most of the time, <time.h> is pulled by <sys/stat.h> already
> included in bfd.h. That's why it went unnoticed.
Ah - that explains it.
Patch approved - please apply.
Cheers
Nick
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bfd: add missing include <time.h>
2024-03-15 15:39 ` Tom Tromey
@ 2024-03-18 11:49 ` Nick Clifton
0 siblings, 0 replies; 5+ messages in thread
From: Nick Clifton @ 2024-03-18 11:49 UTC (permalink / raw)
To: Tom Tromey, Clément Chigot; +Cc: binutils
Hi Tom,
> Clément> This patch looks trivial. Though, I'm wondering if binutils might
> Clément> support some non-posix systems where this new include could trigger
> Clément> issues. Do you think this could be the case ?
>
> FWIW a good resource for answering this kind of question is the gnulib
> manual. It normally documents when a header is missing or when it
> doesn't define something that it ought to.
>
> On this basis time.h seems safe:
>
> https://www.gnu.org/software/gnulib/manual/html_node/time_002eh.html
Thanks for the tip and for checking. :-)
Cheers
Nick
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-03-18 11:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-13 10:37 [PATCH] bfd: add missing include <time.h> Clément Chigot
2024-03-14 12:46 ` Clément Chigot
2024-03-15 15:39 ` Tom Tromey
2024-03-18 11:49 ` Nick Clifton
2024-03-18 11:49 ` Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).