I'm not sure I'd feel good about changing the Pugi code and being sure that we 
haven't subtly broken anything in the process. It clearly works fine now, using 
an idiom that may be questionable but is not uncommon (especially for old C 
programmers).

It seems to me that the expedient solution is just to disable the particular 
warning (-Wno-placement-new), perhaps just on that file, until a new PugiXML is 
available from upstream that no longer gets the warning (or until somebody 
suggests a better library for XML parsing).


> On Feb 3, 2016, at 9:20 AM, Richard Shaw <[email protected]> wrote:
> 
> I asked for help on the Fedora devel mailing list and got this, HTH!
> 
> On 02/03/2016 05:59 PM, Richard Shaw wrote:
> 
> > In member function 'void OpenImageIO::v1_6::pugi::xml_document::create()':
> > /builddir/build/BUILD/oiio-Release-1.6.9/src/include/OpenImageIO/pugixml.cpp:5143:58:
> > error: placement new constructing an object of type
> > 'OpenImageIO::v1_6::pugi::impl::xml_document_struct' and size '44' in a
> > region of type 'char [1]' and size '1' [-Werror=placement-new]
> >    _root = new (page->data) impl::xml_document_struct(page);
> 
> It's the use of char data[1] as a flexible array member.  I'm not sure
> if this is valid C++.  Warning about it is certainly appropriate.
> 
> You should remove the data member, use sizeof(xml_memory_page) instead
> of offsetof(xml_memory_page, data), and replace page->data with
> reinterpret_cast<char *>(page) + sizeof (impl::xml_memory_page), or
> ideally, have xml_memory_page::construct() return both pointers.
> 
> You probably should check for wraparound in the size computations as
> well, to avoid allocating less memory than requested.
> 
> --- end ---
> 
> Thanks,
> Richard
> _______________________________________________
> Oiio-dev mailing list
> [email protected]
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

--
Larry Gritz
[email protected]


_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to