lmi
[Top][All Lists]
Advanced

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

Re: [lmi] xmlwrapp '-Wconversion' warnings


From: Vadim Zeitlin
Subject: Re: [lmi] xmlwrapp '-Wconversion' warnings
Date: Sun, 24 Mar 2019 19:46:56 +0100

On Sat, 23 Mar 2019 11:07:10 +0000 Greg Chicares <address@hidden> wrote:

GC> On 2019-03-22 00:23, Greg Chicares wrote:
GC> > Enabling '-Wnull-dereference' for lmi builds
GC> 
GC> Later, building with a x86_64-w64-mingw32 toolchain, I saw:
GC> 
GC> x86_64-w64-mingw32-g++ -c -I /opt/lmi/src/lmi -I 
/opt/lmi/third_party/include -I /opt/lmi/third_party/src -I 
/opt/lmi/local/include -I /opt/lmi/local/include/libxml2 -DLIBXML_USE_DLL 
-std=c++17 -Werror -Wconversion /opt/lmi/src/lmi/xml_xslt_wrapp.cpp 
-oxml_xslt_wrapp.o 2>&1 |less -S
GC> 
GC> In file included from /opt/lmi/src/lmi/xml_xslt_wrapp.cpp:31:
GC> /opt/lmi/third_party/src/libxml/event_parser.cxx: In member function 'bool 
xml::event_parser::parse
GC> _chunk(const char*, xml::event_parser::size_type)':
GC> /opt/lmi/third_party/src/libxml/event_parser.cxx:403:51: error: conversion 
from 'xml::event_parser::size_type' {aka 'long long unsigned int'} to 'int' may 
change value [-Werror=conversion]
GC>      xmlParseChunk(pimpl_->parser_context_, chunk, length, 0);
GC>                                                    ^~~~~~
GC> In file included from /opt/lmi/src/lmi/xml_xslt_wrapp.cpp:33:
GC> /opt/lmi/third_party/src/libxml/node.cxx: In constructor 
'xml::node::node(xml::node::cdata)':
GC> /opt/lmi/third_party/src/libxml/node.cxx:324:109: error: conversion from 
'size_t' {aka 'long long unsigned int'} to 'int' may change value 
[-Werror=conversion]
GC>      if ( (pimpl_->xmlnode_ = xmlNewCDataBlock(0, reinterpret_cast<const 
xmlChar*>(cdata_info.t), std::strlen(cdata_info.t))) == 0)
GC>                                                                             
                      ~~~~~~~~~~~^~~~~~~~~~~~~~
GC> In file included from /opt/lmi/src/lmi/xml_xslt_wrapp.cpp:39:
GC> /opt/lmi/third_party/src/libxml/tree_parser.cxx: In member function 'void 
xml::tree_parser::init(const char*, xml::tree_parser::size_type, 
xml::error_handler*)':
GC> /opt/lmi/third_party/src/libxml/tree_parser.cxx:202:50: error: conversion 
from 'xml::tree_parser::size_type' {aka 'long long unsigned int'} to 'int' may 
change value [-Werror=conversion]
GC>      if ( (ctxt = xmlCreateMemoryParserCtxt(data, size)) == 0)
GC>                                                   ^~~~

 Thanks for reporting these warnings. I've actually already seen them, as
they appear in any 64-bit build, including native Linux one, but I hadn't
fixed them yet because I wanted to not only fix them, but to ensure that
they stay fixed by enabling -Wconversion for xmlwrapp CI builds and also
adding -Werror to make sure any such new warnings don't go unnoticed. And,
finally, and most importantly, I also wanted to add builds using MinGW, as
currently only native Linux gcc/clang are tested.

 Prompted by your message, I've finally (adding MinGW builds took much
longer than I thought it would, for all sorts of not very interesting
reasons) done all this during the last couple of days and the remaining
changes are in

        https://github.com/vslavik/xmlwrapp/pull/57
        https://github.com/vslavik/xmlwrapp/pull/58

Once these PRs are approved, I'm also going to try enabling more warning
options, including the previously mentioned -Wswitch-enum, for xmlwrapp
builds, ensuring that it stays warning-free.

 Thanks again,
VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]