[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 01/24] xen/mm: Don't use _{g, m}fn for defining INVALID_{G, M}FN
>>> On 13.06.17 at 18:20, <andrew.cooper3@xxxxxxxxxx> wrote: > On 13/06/17 17:13, Julien Grall wrote: >> INVALID_{G,M}FN are defined using static inline helpers _{g,m}fn. >> This means, they cannot be used to initialize a build time static variable: >> >> In file included from mm.c:24:0: >> xen/xen/include/xen/mm.h:59:26: error: initializer element is not constant >> #define INVALID_MFN _mfn(~0UL) >> >> Signed-off-by: Julien Grall <julien.grall@xxxxxxx> >> --- >> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> >> Cc: George Dunlap <George.Dunlap@xxxxxxxxxxxxx> >> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> >> Cc: Jan Beulich <jbeulich@xxxxxxxx> >> Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> >> Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx> >> Cc: Tim Deegan <tim@xxxxxxx> >> Cc: Wei Liu <wei.liu2@xxxxxxxxxx> >> >> I know that this solution will not work for non-debug build. I would >> like input from the community on way to fix it nicely. > > Hmm - a proper typedef gets inserted. I presume the compiler objects to > (unsigned long){ ~0UL } to initialise a scalar? > > It might be better to move the definition of INVALID_$FOO into the > TYPE_SAFE() declaration so we can create an appropriate initialiser for > each both builds. Except that you can't put a #define in a macro definition, and producing a static const wouldn't help Julien's case of wanting it in the initializer of a static variable. So best I can come up with right now would be to introduce a separate #define TYPE_SAFE_CONSTANT(name, val) \ (name##_t){ val } and #define TYPE_SAFE_CONSTANT(name, val) \ (name##_t)(val) for the !NDEBUG / NDEBUG cases respectively and use it as #define INVALID_MFN TYPE_SAFE_CONSTANT(mfn, ~0UL) Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |