[sim] Include defs.h in ppc/hw_memory.c

Message ID 20211008201657.630932-1-cbiesinger@google.com
State New
Headers show
Series
  • [sim] Include defs.h in ppc/hw_memory.c
Related show

Commit Message

Philippe Waroquiers via Gdb-patches Oct. 8, 2021, 8:16 p.m.
From: Christian Biesinger <cbiesinger@chromium.org>


To fix this error (seen on cygwin):
/../../sim/ppc/../common ../../../sim/ppc/hw_memory.c
In file included from ../../gnulib/import/stdlib.h:100,
                 from ../../../sim/ppc/hw_memory.c:28:
../../gnulib/import/unistd.h:663:3: error: #error "Please include config.h first."
  663 |  #error "Please include config.h first."
      |   ^~~~~
../../gnulib/import/unistd.h:665:24: error: expected ‘;’ before ‘extern’
  665 | _GL_INLINE_HEADER_BEGIN
      |                        ^
      |                        ;
../../gnulib/import/unistd.h:2806:22: error: expected ‘;’ before ‘extern’
 2806 | _GL_INLINE_HEADER_END
      |                      ^
      |                      ;
---
 sim/ppc/hw_memory.c | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.33.0.882.g93a45727a2-goog

Comments

Philippe Waroquiers via Gdb-patches Oct. 9, 2021, 1:16 a.m. | #1
lgtm, thanks

(if you need me to push, lemme know)
-mike

Patch

diff --git a/sim/ppc/hw_memory.c b/sim/ppc/hw_memory.c
index 46b22f7b6e3..2376be6730b 100644
--- a/sim/ppc/hw_memory.c
+++ b/sim/ppc/hw_memory.c
@@ -25,6 +25,9 @@ 
 #define STATIC_INLINE_HW_MEMORY STATIC_INLINE
 #endif
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdlib.h>
 
 #include "device_table.h"