summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorBill XIE <persmule@hardenedlinux.org>2022-07-08 16:53:21 +0800
committerFelix Held <felix-coreboot@felixheld.de>2022-07-14 23:08:09 +0000
commitac136250b26ddcb54d61ed8428f110b607cb3c88 (patch)
tree40be3a5d3f1674bd18b44e3c45cc3ac1ef9af017 /util
parentf7ba881f98db6561e8c4964663f8774e1a82f41b (diff)
downloadcoreboot-ac136250b26ddcb54d61ed8428f110b607cb3c88.tar.gz
coreboot-ac136250b26ddcb54d61ed8428f110b607cb3c88.tar.bz2
coreboot-ac136250b26ddcb54d61ed8428f110b607cb3c88.zip
commonlib: Substitude macro "__unused" in compiler.h
Since there are many identifiers whose name contain "__unused" in headers of musl libc, introducing a macro which expands "__unused" to the source of a util may have disastrous effect during its compiling under a musl-based platform. However, it is hard to detect musl at build time as musl is notorious for having explicitly been refusing to add a macro like "__MUSL__" to announce its own presence. Using __always_unused and __maybe_unused for everything may be a good idea. This is how it works in the Linux kernel, so that would at least make us match some other standard rather than doing our own thing (especially since the other compiler.h shorthand macros are also inspired by Linux). Signed-off-by: Bill XIE <persmule@hardenedlinux.org> Change-Id: I547ae3371d7568f5aed732ceefe0130a339716a9 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65717 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'util')
-rw-r--r--util/cbfstool/cbfstool.c2
-rw-r--r--util/sconfig/main.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index ff10131e4744..87b5d00f19a4 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -1499,7 +1499,7 @@ static int cbfs_layout(void)
return 0;
}
-static enum cb_err verify_walker(__unused cbfs_dev_t dev, size_t offset,
+static enum cb_err verify_walker(__always_unused cbfs_dev_t dev, size_t offset,
const union cbfs_mdata *mdata, size_t already_read, void *arg)
{
uint32_t type = be32toh(mdata->h.type);
diff --git a/util/sconfig/main.c b/util/sconfig/main.c
index 1de98d481ad8..6648254d0aab 100644
--- a/util/sconfig/main.c
+++ b/util/sconfig/main.c
@@ -1970,7 +1970,7 @@ static void generate_outputc(FILE *f, const char *static_header)
fprintf(f, "#include <fw_config.h>\n");
fprintf(f, "#include <%s>\n", static_header);
emit_chip_headers(f, chip_header.next);
- fprintf(f, "\n#define STORAGE static __unused DEVTREE_CONST\n\n");
+ fprintf(f, "\n#define STORAGE static __maybe_unused DEVTREE_CONST\n\n");
walk_device_tree(NULL, NULL, &base_root_dev, inherit_subsystem_ids);
fprintf(f, "\n/* pass 0 */\n");