diff options
author | Werner Zeh <werner.zeh@siemens.com> | 2019-07-11 12:47:19 +0200 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2019-07-12 11:02:29 +0000 |
commit | ac14a40d0e17571ad3495d45216842044def289e (patch) | |
tree | ce6cf38ba6f7a217690f5e63c4f21e6439ab68e1 /util/cbfstool/compress.c | |
parent | 98d19572b175ad44a83614cdf2c57ed0ba94a733 (diff) |
util/sconfig: Fix compile error with older glibc-headers
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 <sys/stat.h> 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_ <sys/stat.h>, 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_ <sys/stat.h>. 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 <werner.zeh@siemens.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34236
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'util/cbfstool/compress.c')
0 files changed, 0 insertions, 0 deletions