package/uboot-omap: backport patches to fix build
[openwrt/staging/lynxis.git] / package / boot / uboot-omap / patches / 107-tools-include-necessary-headers-explicitly.patch
1 From ad23f45b346f196e07ba49d354a12762f19abfa4 Mon Sep 17 00:00:00 2001
2 From: Masahiro Yamada <yamada.masahiro@socionext.com>
3 Date: Sun, 21 Jan 2018 19:19:15 +0900
4 Subject: [PATCH 2/2] tools: include necessary headers explicitly
5
6 Several host-tools use "bool" type without including <stdbool.h>.
7 This relies on the crappy header inclusion chain.
8
9 tools/Makefile has the following line:
10
11 HOST_EXTRACFLAGS += -include $(srctree)/include/libfdt_env.h \
12
13 All host-tools are forced to include libfdt_env.h even if they are
14 totally unrelated to FDT. Then, <stdbool.h> is indirectly included
15 as follows:
16
17 include/libfdt_env.h
18 -> include/linux/types.h
19 -> <stdbool.h>
20
21 I am fixing this horrible crap. In advance, I need to add necessary
22 include directives explicitly. tools/fdtgrep.c needs more; <fctl.h>
23 for open() and <errno.h> for errno.
24
25 Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
26 Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
27 Reviewed-by: Simon Glass <sjg@chromium.org>
28 ---
29 tools/fdtgrep.c | 3 +++
30 tools/ifdtool.c | 1 +
31 tools/imagetool.h | 1 +
32 3 files changed, 5 insertions(+)
33
34 diff --git a/tools/fdtgrep.c b/tools/fdtgrep.c
35 index fbe38c824a41..13703fc3b1b9 100644
36 --- a/tools/fdtgrep.c
37 +++ b/tools/fdtgrep.c
38 @@ -10,7 +10,10 @@
39
40 #include <assert.h>
41 #include <ctype.h>
42 +#include <errno.h>
43 #include <getopt.h>
44 +#include <fcntl.h>
45 +#include <stdbool.h>
46 #include <stdio.h>
47 #include <stdlib.h>
48 #include <string.h>
49 diff --git a/tools/ifdtool.c b/tools/ifdtool.c
50 index c805597744bd..e4c2f82c4a1e 100644
51 --- a/tools/ifdtool.c
52 +++ b/tools/ifdtool.c
53 @@ -12,6 +12,7 @@
54 #include <assert.h>
55 #include <fcntl.h>
56 #include <getopt.h>
57 +#include <stdbool.h>
58 #include <stdlib.h>
59 #include <stdio.h>
60 #include <string.h>
61 diff --git a/tools/imagetool.h b/tools/imagetool.h
62 index 15c2a0c0e1c1..076e5e0dc8f9 100644
63 --- a/tools/imagetool.h
64 +++ b/tools/imagetool.h
65 @@ -12,6 +12,7 @@
66 #include "os_support.h"
67 #include <errno.h>
68 #include <fcntl.h>
69 +#include <stdbool.h>
70 #include <stdio.h>
71 #include <stdlib.h>
72 #include <string.h>
73 --
74 2.21.0
75