[PATCH] bfd: add missing include <time.h>

Clément Chigot chigot@adacore.com
Wed Mar 13 10:37:28 GMT 2024


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



More information about the Binutils mailing list