From ac14a40d0e17571ad3495d45216842044def289e Mon Sep 17 00:00:00 2001 From: Werner Zeh Date: Thu, 11 Jul 2019 12:47:19 +0200 Subject: util/sconfig: Fix compile error with older glibc-headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In patch e29a6ac16a9f478fc00ce7cb83f3779954e3168d (util/sconfig: Add commonlib/helpers.h) helpers.h has been added to the include-list. In headers.h we have a definition for __unused: On a host system environment where glibc-headers-2.12-1.212 is installed, a file included by called bits/stat.h have the following content on line 105 and onwards: long int __unused[3]; where the mentioned part is part of the structure called struct stat. If we include commonlib/helpers.h _before_ , the symbol for __unused will be defined by the preprocessor to be '__attribute__((unused))', therefore the above mentioned structure member will be expanded by the preprocessor to be 'long int __attribute__((unused))[3];', which is not a valid C syntax and therefore produces a compile error for sconfig tool. To handle this case we need to make sure commonlib/helpers.h is included _after_ . As the needed part of stat.h (which is struct stat) is only used in main.c it is safe to move the include from sconfig.h directly into main.c while taking care of the order. Change-Id: I9e6960a318d3dd999e1e9c1df326d67094f3b5ce Signed-off-by: Werner Zeh Reviewed-on: https://review.coreboot.org/c/coreboot/+/34236 Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki Reviewed-by: Patrick Georgi --- util/sconfig/main.c | 2 ++ util/sconfig/sconfig.h | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'util/sconfig') diff --git a/util/sconfig/main.c b/util/sconfig/main.c index 385ced16ab..85e0d8ea7f 100644 --- a/util/sconfig/main.c +++ b/util/sconfig/main.c @@ -15,6 +15,8 @@ */ #include +/* stat.h needs to be included before commonlib/helpers.h to avoid errors.*/ +#include #include #include "sconfig.h" #include "sconfig.tab.h" diff --git a/util/sconfig/sconfig.h b/util/sconfig/sconfig.h index e6363dea83..eea2a14e40 100644 --- a/util/sconfig/sconfig.h +++ b/util/sconfig/sconfig.h @@ -18,7 +18,6 @@ #include #include #include -#include #include #include -- cgit v1.2.3