Message ID | 1395766541-23979-33-git-send-email-julien.grall@linaro.org |
---|---|
State | Deferred, archived |
Headers | show |
On 25/03/14 16:55, Julien Grall wrote: > Don't need to check if shutdown is positive. > > Fix compilation with clang 3.5: > xl_cmdimpl.c:3350:34: error: comparison of unsigned expression >= 0 is always true [-Werror,-Wtautological-compare] > (shutdown_reason >= 0 && > ~~~~~~~~~~~~~~~ ^ ~ Coverity-ID: 1055616 > Signed-off-by: Julien Grall <julien.grall@linaro.org> > Cc: Ian Jackson <ian.jackson@eu.citrix.com> > Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > Cc: Ian Campbell <ian.campbell@citrix.com> > --- > tools/libxl/xl_cmdimpl.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c > index 8389468..e82620d 100644 > --- a/tools/libxl/xl_cmdimpl.c > +++ b/tools/libxl/xl_cmdimpl.c > @@ -3324,8 +3324,7 @@ static void list_domains(int verbose, int context, int claim, int numa, > info[i].blocked ? 'b' : '-', > info[i].paused ? 'p' : '-', > info[i].shutdown ? 's' : '-', > - (shutdown_reason >= 0 && > - shutdown_reason < sizeof(shutdown_reason_letters)-1 > + (shutdown_reason < sizeof(shutdown_reason_letters)-1 > ? shutdown_reason_letters[shutdown_reason] : '?'), > info[i].dying ? 'd' : '-', > ((float)info[i].cpu_time / 1e9));
On Tue, 2014-03-25 at 18:22 +0000, Andrew Cooper wrote: > On 25/03/14 16:55, Julien Grall wrote: > > Don't need to check if shutdown is positive. > > > > Fix compilation with clang 3.5: > > xl_cmdimpl.c:3350:34: error: comparison of unsigned expression >= 0 is always true [-Werror,-Wtautological-compare] > > (shutdown_reason >= 0 && > > ~~~~~~~~~~~~~~~ ^ ~ > > Coverity-ID: 1055616 > > > Signed-off-by: Julien Grall <julien.grall@linaro.org> > > Cc: Ian Jackson <ian.jackson@eu.citrix.com> > > Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Although that construct looks ripe for refactoring for clarity to me. Ian.
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 8389468..e82620d 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -3324,8 +3324,7 @@ static void list_domains(int verbose, int context, int claim, int numa, info[i].blocked ? 'b' : '-', info[i].paused ? 'p' : '-', info[i].shutdown ? 's' : '-', - (shutdown_reason >= 0 && - shutdown_reason < sizeof(shutdown_reason_letters)-1 + (shutdown_reason < sizeof(shutdown_reason_letters)-1 ? shutdown_reason_letters[shutdown_reason] : '?'), info[i].dying ? 'd' : '-', ((float)info[i].cpu_time / 1e9));
Don't need to check if shutdown is positive. Fix compilation with clang 3.5: xl_cmdimpl.c:3350:34: error: comparison of unsigned expression >= 0 is always true [-Werror,-Wtautological-compare] (shutdown_reason >= 0 && ~~~~~~~~~~~~~~~ ^ ~ Signed-off-by: Julien Grall <julien.grall@linaro.org> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Cc: Ian Campbell <ian.campbell@citrix.com> --- tools/libxl/xl_cmdimpl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)