kewlnamehuh / pugixml

Automatically exported from code.google.com/p/pugixml
0 stars 0 forks source link

Unsuppressable warning under GCC causing build failure with -Werror #217

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using PugiXML in header-only mode, and this is causing a warning which I 
can not suppress (despite wrapping the #includes in #pragmas to disable the 
warning -- which successfully disables all the other warnings).

This warning also only occurs when I compile in release mode (LTO etc is 
probably causing more aggressive optimizations which in turn result in this 
warning being issued).

Here is the relevant warning and command line:

C:\Code\pugixml-trunk\src/pugixml.cpp: In function 
'pugi::impl::strconv_escape(wchar_t*, pugi::impl::gap&)':
C:\Code\pugixml-trunk\src/pugixml.cpp:1684:7: error: assuming signed overflow 
does not occur when simplifying range test [-Werror=strict-overflow]
       if (static_cast<unsigned int>(ch - '0') <= 9)
       ^
cc1plus.exe: all warnings being treated as errors

    "g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pedantic -Werror -g -mthreads -m64 -ansi -Wpedantic -Wextra -Weffc++ -Wshadow -Wconversion -Winit-self -Wmissing-include-dirs -Wstrict-aliasing -Wstrict-overflow=5 -Wno-effc++ -Wold-style-cast -Wnon-virtual-dtor -Woverloaded-virtual -Winvalid-pch -Wno-multichar -flto -std=c++11 -DASMJIT_API= -DBOOST_FILESYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_USE_WINDOWS_H -DNDEBUG -DPUGIXML_HEADER_ONLY -DPUGIXML_WCHAR_MODE -DSTRICT -DSTRICT_TYPED_ITEMIDS -DUNICODE -DWINVER=_WIN32_WINNT_VISTA -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D_WIN32_WINNT=_WIN32_WINNT_VISTA  -I"C:\Code\asmjit-trunk\asmjit\src" -I"C:\Code\boost-trunk" -I"C:\Code\pugixml-trunk\src" -I"C:\Code\udis86-trunk" -I"include\memory" -c -o "bin\tests\find_pattern.test\gcc-mingw-4.8.2\release\address-model-64\architecture-x86\debug-symbols-on\threading-multi\find_pattern.o" "tests\find_pattern.cpp"

I've worked around it temporarily by patching my local copy of the source code, 
but this is breaking my build so an upstream resolution would be preferable.

Thanks. :)

Original issue reported on code.google.com by raptorfactor@raptorfactor.com on 25 Nov 2013 at 11:16

GoogleCodeExporter commented 9 years ago
r956 should fix this warning.

I do not get any other warnings with the flags you provided (although I'm using 
gcc on linux instead of mingw) - what other warnings did you have to disable? 

Original comment by arseny.k...@gmail.com on 26 Nov 2013 at 4:36

GoogleCodeExporter commented 9 years ago
Wow a very fast fix! Thanks! You're awesome.

As for other warnings, there aren't any. Sorry for being confusing, I meant 
that I have pair of headers (a push header and a pop header) which suppress all 
warnings in 3rd party code. I didn't specifically check for other warnings in 
PugiXML, but I just did, and it compiles cleanly! (Now I'm even more impressed!)

I confirmed that your fix works for me btw.

Thanks again!

Original comment by raptorfactor@raptorfactor.com on 26 Nov 2013 at 6:24