From bbbe89351275ed6ac09207fe9aeb80b606af1a4d Mon Sep 17 00:00:00 2001 From: Julien Grall Date: Tue, 27 Jun 2017 10:33:20 +0100 Subject: [PATCH] xen/mm: Introduce {G,M}FN_INVALID_INITIALIZER The current implementation of {G,M}FN_INVALID cannot be used to initialize global variable because the initializer element is not a constant. Due to a bug in GCC 4.9 and older ([1]), it is not easy to find a common value to initialize a variable and directly passed as an argument. Introduce 2 news define {G,M}FN_INVALID_INITIALIZER to be used for initializing a variable. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856 Signed-off-by: Julien Grall Acked-by: Tim Deegan --- xen/include/xen/mm.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index 0050fba498..503b92e4b0 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -57,6 +57,11 @@ TYPE_SAFE(unsigned long, mfn); #define PRI_mfn "05lx" #define INVALID_MFN _mfn(~0UL) +/* + * To be used for global variable initialization. This workaround a bug + * in GCC < 5.0. + */ +#define INVALID_MFN_INITIALIZER { ~0UL } #ifndef mfn_t #define mfn_t /* Grep fodder: mfn_t, _mfn() and mfn_x() are defined above */ @@ -90,6 +95,11 @@ static inline bool_t mfn_eq(mfn_t x, mfn_t y) TYPE_SAFE(unsigned long, gfn); #define PRI_gfn "05lx" #define INVALID_GFN _gfn(~0UL) +/* + * To be used for global variable initialization. This workaround a bug + * in GCC < 5.0 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856 + */ +#define INVALID_GFN_INITIALIZER { ~0UL } #ifndef gfn_t #define gfn_t /* Grep fodder: gfn_t, _gfn() and gfn_x() are defined above */ -- 2.39.5