#6074 closed Support Requests (fixed)
warnings-as-errors not usable with Boost.test in release mode
Reported by: | Paul A. Bristow | Owned by: | Gennadiy Rozental |
---|---|---|---|
Milestone: | Boost 1.59.0 | Component: | test |
Version: | Boost Development Trunk | Severity: | Optimization |
Keywords: | boost test warnings-as-errors | Cc: |
Description
Ticket #3598 reported patches for allowing warnings-as-errors to be used.
I note that the current trunk version has (possibly new) warnings in release mode (debug is OK) that prevent warnings-as-errors from being used.
unit_test_parameters.cpp i:\boost-trunk\boost\test\utils\named_params.hpp(73) : error C2220: warning treated as error - no 'object' file generated i:\boost-trunk\boost\test\utils\named_params.hpp(73) : warning C4702: unreachable code
compile-c-c++ i:\boost-trunk\bin.v2\libs\test\build\msvc-10.0\release\asynch-exceptions-on\link-static\threading-multi\decorator.obj decorator.cpp i:\boost-trunk\boost\test\utils\named_params.hpp(77) : error C2220: warning treated as error - no 'object' file generated i:\boost-trunk\boost\test\utils\named_params.hpp(77) : warning C4702: unreachable code
execution_monitor.cpp i:\boost-trunk\boost\test\impl\execution_monitor.ipp(1040) : error C2220: warning treated as error - no 'object' file generated i:\boost-trunk\boost\test\impl\execution_monitor.ipp(1040) : warning C4702: unreachable code
It would be nice if either
1 These can be coded round.
2 The docs could be updated to warn that warnings-as-errors is not supported.
3 Or if there is some other way round this?
Change History (4)
comment:1 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 10 years ago
Hi rogeeff,
I checked out trunk and still see the following warnings when building release in VS2012 (original reporter talked about VS2010):
boost\test\utils\named_params.hpp(75): warning C4702: unreachable code boost\test\utils\named_params.hpp(79): warning C4702: unreachable code boost\test\utils\named_params.hpp(87): warning C4702: unreachable code
I got rid of them by removing the code after throwing exception (not sure if it's OK for other compilers):
Against trunk revision 81197:
line 75: { report_access_to_invalid_parameter(true); /*static T* v = 0; return *v;*/ } line 79: { report_access_to_invalid_parameter(true); /*static typename remove_reference<T>::type* v = 0; return *v;*/ } line 83: { report_access_to_invalid_parameter(true); /*return nil();*/ } line 87: { report_access_to_invalid_parameter(true); /*return nil();*/ } line 91: { report_access_to_invalid_parameter(true); /*return nil();*/ }
Against boost 1.53:
line 74: { report_access_to_invalid_parameter(); /*static T* v = 0; return *v;*/ } line 78: { report_access_to_invalid_parameter(); /*static typename remove_reference<T>::type* v = 0; return *v;*/ } line 82: { report_access_to_invalid_parameter(); /*return nil();*/ } line 86: { report_access_to_invalid_parameter(); /*return nil();*/ } line 90: { report_access_to_invalid_parameter(); /*return nil();*/ }
comment:3 by , 10 years ago
The fix above breaks the build in debug mode :) I fixed both modes by removing function report_access_to_invalid_parameter() and throwing exception directly in 6 occurrences (including line 282/281):
{ throw access_to_invalid_parameter(); }
Fixed in trunk by 81197