[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH for-4.9 v2 2/2] x86/dm: fix clang build
The current code in dm_op breaks clang build with: dm.c:411:21: error: 'break' is bound to loop, GCC binds it to switch [-Werror,-Wgcc-compat] while ( read_atomic(&p2m->ioreq.entry_count) && ^ xen/include/asm/atomic.h:53:43: note: expanded from macro 'read_atomic' default: x_ = 0; __bad_atomic_size(); break; \ ^ Move the read_atomic check inside the loop body in order to fix the error. Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> --- Cc: Jan Beulich <jbeulich@xxxxxxxx> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- Changes since v1: - New in this version. --- xen/arch/x86/hvm/dm.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c index d72b7bd835..d7aaaf6ff8 100644 --- a/xen/arch/x86/hvm/dm.c +++ b/xen/arch/x86/hvm/dm.c @@ -408,9 +408,16 @@ static int dm_op(domid_t domid, { struct p2m_domain *p2m = p2m_get_hostp2m(d); - while ( read_atomic(&p2m->ioreq.entry_count) && - first_gfn <= p2m->max_mapped_pfn ) + while ( first_gfn <= p2m->max_mapped_pfn ) { + /* + * NB: read_atomic cannot be used in the loop condition because + * clang complains with: "'break' is bound to loop, GCC binds + * it to switch", so move it inside of the loop instead. + */ + if ( !read_atomic(&p2m->ioreq.entry_count) ) + break; + /* Iterate p2m table for 256 gfns each time. */ p2m_finish_type_change(d, _gfn(first_gfn), 256, p2m_ioreq_server, p2m_ram_rw); -- 2.11.0 (Apple Git-81) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |