[xml] An xmlXPathTypeVal is never equal to XML_NAMESPACE_DECL



Hi,

We're using libxml2 in Chromium, and I just noticed that recent
versions of Clang have started warning about the following code:

/usr/local/google/work/chrome/src/third_party/libxml/src/xpath.c:12269:13:
warning: comparison of constant 18 with expression of type
'xmlXPathTypeVal' is always false
[-Wtautological-constant-out-of-range-compare]
                        if (type == XML_NAMESPACE_DECL)
                            ~~~~ ^  ~~~~~~~~~~~~~~~~~~

In the latest version of xpath.c, the code is still there, but on line 12402.


Looking at the code, 'type' is a variable of type 'xmlXPathTypeVal',
whereas XML_NAMESPACE_DECL is an enumerator in 'xmlElementType'.

Clang warns because the 'xmlXPathTypeVal' type is not wide enough to
hold the value of XML_NAMESPACE_DECL, and therefore the comparison
will never be true.

I've tried to figure out what a good fix would be here, but I don't
know the code well enough. It would be great if someone could advice
on the best way to fix this.

Thanks,
Hans



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