[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 1/3] x86/mm: do not attempt to convert _PAGE_GNTTAB to a boolean
On 05.05.2020 11:24, Roger Pau Monne wrote: > Clang 10 complains with: > > mm.c:1239:10: error: converting the result of '<<' to a boolean always > evaluates to true > [-Werror,-Wtautological-constant-compare] > if ( _PAGE_GNTTAB && (l1e_get_flags(l1e) & _PAGE_GNTTAB) && > ^ > xen/include/asm/x86_64/page.h:161:25: note: expanded from macro '_PAGE_GNTTAB' > #define _PAGE_GNTTAB (1U<<22) > ^ This is a rather odd warning. Do they also warn for "if ( 0 )" or "do { } while ( 0 )", as we use in various places? There's no difference to me between a plain number and a constant composed via an expression. > Remove the conversion of _PAGE_GNTTAB to a boolean, since the and > operation performed afterwards will already return false if the value > of the macro is 0. I'm sorry, but no. The expression was put there on purpose by 0932210ac095 ("x86: Address "Bitwise-and with zero CONSTANT_EXPRESSION_RESULT" Coverity issues"), and the description there is clearly telling us that this wants to stay unless Coverity changed in the meantime. Otherwise I'm afraid a more elaborate solution will be needed to please both. Or a more simplistic one, like using "#if _PAGE_GNTTAB" around the construct. Jan
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |