[xml] An xmlXPathTypeVal is never equal to XML_NAMESPACE_DECL


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

warning: comparison of constant 18 with expression of type
'xmlXPathTypeVal' is always false
                        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.


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