symbols: Add __maybe_unused flag to region variable symbols
In DECLARE_REGION and DECLARE_OPTIONAL_REGION, a set of 3 variables will be defined, that is the region 'base', 'end' and 'size'. However, in many codes, the users will only selectively use 'end' or 'size' instead of both of them, which will trigger compiler errors for unused variables. This patch sets __maybe_unused attributes on 'end' and 'size' so that users do not need to use all of them. TEST=intel/archercity CRB Change-Id: Ia5ed183b2dd7a474ce51de47dbc1f9e3f61e5a41 Signed-off-by: Shuo Liu <shuo.liu@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/81209 Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Martin L Roth <gaumless@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
950da598d6
commit
965db62429
@ -10,9 +10,9 @@ extern u8 _dram[];
|
|||||||
#define REGION_SIZE(name) ((size_t)_##name##_size)
|
#define REGION_SIZE(name) ((size_t)_##name##_size)
|
||||||
|
|
||||||
#define DECLARE_REGION(name) \
|
#define DECLARE_REGION(name) \
|
||||||
extern u8 _##name[]; \
|
__maybe_unused extern u8 _##name[]; \
|
||||||
extern u8 _e##name[]; \
|
__maybe_unused extern u8 _e##name[]; \
|
||||||
extern u8 _##name##_size[];
|
__maybe_unused extern u8 _##name##_size[];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Regions can be declared optional if not all configurations provide them in
|
* Regions can be declared optional if not all configurations provide them in
|
||||||
@ -23,9 +23,9 @@ extern u8 _dram[];
|
|||||||
* should then check (REGION_SIZE(name) != 0) before accessing it.
|
* should then check (REGION_SIZE(name) != 0) before accessing it.
|
||||||
*/
|
*/
|
||||||
#define DECLARE_OPTIONAL_REGION(name) \
|
#define DECLARE_OPTIONAL_REGION(name) \
|
||||||
__weak extern u8 _##name[]; \
|
__maybe_unused __weak extern u8 _##name[]; \
|
||||||
__weak extern u8 _e##name[]; \
|
__maybe_unused __weak extern u8 _e##name[]; \
|
||||||
__weak extern u8 _##name##_size[];
|
__maybe_unused __weak extern u8 _##name##_size[];
|
||||||
|
|
||||||
DECLARE_REGION(sram)
|
DECLARE_REGION(sram)
|
||||||
DECLARE_OPTIONAL_REGION(timestamp)
|
DECLARE_OPTIONAL_REGION(timestamp)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user