Re: [PATCH] virkeyfile: fix compilation error with clang

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 10, 2019 at 03:14:40PM +0100, Christophe de Dinechin wrote:
> 
> 
> > On 10 Dec 2019, at 15:11, Pavel Hrdina <phrdina@xxxxxxxxxx> wrote:
> > 
> > Clang complains about condition being always true:
> > 
> > src/util/virkeyfile.c:113:23: error: result of comparison of constant 128 with expression of type 'const char' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
> >    while (!IS_EOF && IS_ASCII(CUR) && CUR != ']')
> >                      ^~~~~~~~~~~~~
> > src/util/virkeyfile.c:80:26: note: expanded from macro 'IS_ASCII'
> >                     ~~~ ^ ~~~
> > 
> > Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
> > ---
> > src/util/virkeyfile.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/src/util/virkeyfile.c b/src/util/virkeyfile.c
> > index 816bfae96d..ee29bd7aa6 100644
> > --- a/src/util/virkeyfile.c
> > +++ b/src/util/virkeyfile.c
> > @@ -77,7 +77,7 @@ struct _virKeyFileParserCtxt {
> > #define IS_EOF (ctxt->cur >= ctxt->end)
> > #define IS_EOL(c) (((c) == '\n') || ((c) == '\r'))
> > #define IS_BLANK(c) (((c) == ' ') || ((c) == '\t'))
> > -#define IS_ASCII(c) ((c) < 128)
> > +#define IS_ASCII(c) (((unsigned char) c) < 128)
> 
> Probably want parentheses around c.

Right, I'll fix it before pushing.

> 
> 
> > #define CUR (*ctxt->cur)
> > #define NEXT if (!IS_EOF) ctxt->cur++;
> > 
> > -- 
> > 2.23.0
> > 
> > --
> > libvir-list mailing list
> > libvir-list@xxxxxxxxxx
> > https://www.redhat.com/mailman/listinfo/libvir-list
> 
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux