tools: include necessary headers explicitly
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Sun, 21 Jan 2018 10:19:15 +0000 (19:19 +0900)
committerTom Rini <trini@konsulko.com>
Sun, 28 Jan 2018 17:27:31 +0000 (12:27 -0500)
Several host-tools use "bool" type without including <stdbool.h>.
This relies on the crappy header inclusion chain.

tools/Makefile has the following line:

  HOST_EXTRACFLAGS += -include $(srctree)/include/libfdt_env.h \

All host-tools are forced to include libfdt_env.h even if they are
totally unrelated to FDT.  Then, <stdbool.h> is indirectly included
as follows:

     include/libfdt_env.h
  -> include/linux/types.h
  -> <stdbool.h>

I am fixing this horrible crap.  In advance, I need to add necessary
include directives explicitly.  tools/fdtgrep.c needs more; <fctl.h>
for open() and <errno.h> for errno.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
tools/fdtgrep.c
tools/gen_ethaddr_crc.c
tools/ifdtool.c
tools/imagetool.h
tools/mips-relocs.c

index 7af77b7afe34085a7e305f765e6b50c012179a2c..8d33205ea2a0938f2ca073c8de1f916b392330e0 100644 (file)
 
 #include <assert.h>
 #include <ctype.h>
+#include <errno.h>
 #include <getopt.h>
+#include <fcntl.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index fe9896dca94d9ced23becf2cb4e4e15d3fa4cb90..8cf86f4835d8520487008eca60ec93a3becd2d95 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <ctype.h>
+#include <stdbool.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
index 195b1533ab69cf6e7747ce03d7d280d6dad2de3c..729991ee33f7ebf1677e186025ee63ecedead6a7 100644 (file)
@@ -12,6 +12,7 @@
 #include <assert.h>
 #include <fcntl.h>
 #include <getopt.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
index a8d505423b87ba0450f775a507e12d58d728cca3..e67de9b5ad34fb13e2bfc1304e211d3ebedb8e6c 100644 (file)
@@ -12,6 +12,7 @@
 #include "os_support.h"
 #include <errno.h>
 #include <fcntl.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 8be69d320fb3f227d3c8d5144e969228e4fd88be..27d47308e00314427043e721b9bd92f5454a4665 100644 (file)
@@ -11,6 +11,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <limits.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/mman.h>