Code Monkey home page Code Monkey logo

exception's Introduction

exception's People

Contributors

apolukhin avatar beman avatar brycelelbach avatar cspanier avatar danieljames avatar davedeakins avatar dmenendez-gruposantander avatar douggregor avatar ecatmur avatar eldiener avatar fanquake avatar glenfe avatar imikejackson avatar jewillco avatar jhunold avatar jlepola avatar lastique avatar mike-devel avatar oberon00 avatar ownageismagic avatar pdimov avatar robertramey avatar rogeeff avatar sdarwin avatar steveire avatar straszheim avatar swatanabe avatar zajo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

exception's Issues

boost/throw_exception.hpp?

I have this code on GitHub that uses Boost.Beast, and it requires boost/throw_exception.hpp. What version of Boost.Exception has that? I'm trying to use the Boost libraries on GitHub rather than the ones that come with Boost 1.69.0 so I can avoid some clashes between the latest version of Boost.Beast on GitHub and the one in Boost 1.69.0.

boost/exception/info.hpp: Clang warns over `delete this` on non-final non-virtual

In file included from libs\spirit\classic\test\bug_000008.cpp:51:
In file included from .\boost/thread.hpp:24:
In file included from .\boost/thread/future.hpp:34:
In file included from .\boost/thread/exceptional_ptr.hpp:10:
In file included from .\boost/exception_ptr.hpp:9:
In file included from .\boost/exception/detail/exception_ptr.hpp:15:
.\boost/exception/info.hpp(134,21): error: delete called on non-final 'boost::exception_detail::error_info_container_impl' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-abstract-non-virtual-dtor]
                    delete this;
                    ^
1 warning and 1 error generated.
     "clang-cl.exe" -m64 @"bin.v2\libs\spirit\classic\test\bug_000008.test\clang-win-9.0.1\release\address-model-64\threadapi-win32\threading-multi\bug_000008.obj.rsp" 

Reproducible with b2 toolset=clang-win warnings=on warnings-as-errors=on libs/exception/test

enable_error_info concerns

hello
I wonder what's the point of copying exception object "If T derives from boost::[exception]" instead of returning it (to throw later) as is?

[Feature Reques] Fine-grained control over printing

I'm allowing people to add arbitrary tags, however diagnostic_information() is causing some formatting I don't love. However I don't see any good way to create my own version of that function and get the formatting I would like. The closest I've come to seeing a solution is here

https://stackoverflow.com/questions/48191012/how-to-iterate-over-all-error-infos-in-boostexception

Thanks for any help or workarounds and apologies if this isn't where I should submit something like this

info.hpp: warning C4265 given by Visual Studio

This issue is very similar to #23: when enabling warning C4265 as error, the following error is triggered in boost/exception/info.hpp:

info.hpp(157): error C4265: 'boost::exception_detail::error_info_container_impl': class has virtual functions, but destructor is not virtual instances of this class may not be destructed correctly

The issue can be reproduced using https://github.com/ivsgroup/boost_warnings_minimal_demo, but with a few differences:

  • boost 1.73.0
  • use #include <boost/algorithm/hex.hpp>

I can fix this problem locally by adding #pragma warning(disable: 4265) to boost/exception/info.hpp line 25

boostorg/exception failed due to error LNK2019 on MSVC

Environment:
VS 2017 + Windows Server 2016

Issue description:
Boostorg/exception failed to compile when updating Boost version to 68cc708 on MSVC. Could you please take a look?

log_x64_test_32.log

Reproduce steps:

  1. git clone -c core.autocrlf=true --recursive ​https://github.com/boostorg/boost.git D:\Boost\src
  2. open a VS 2017 x64 command prompt and browse to D:\Boost\src
  3. .\bootstrap
  4. .\b2 headers variant=release --build-dir=..\out\x64rel address-model=64
  5. .\b2 variant=release --build-dir=..\out\x64rel address-model=64
  6. .\b2 -j4 variant=release --build-dir=..\out\x64rel libs\exception\test

ErrorMessage:
no_exceptions_test.obj : error LNK2019: unresolved external symbol "void __cdecl boost::throw_exception(class std::exception const &,struct boost::source_location const &)" (?throw_exception@boost@@YAXAEBVexception@std@@AEBUsource_location@1@@z) referenced in function main'

std::exception_ptr integration doesn't seem to work correctly when the exception is derived from boost::exception

See https://godbolt.org/z/dofa6bbcc.

This exception type

class my_exception: public std::exception
{
};

can be caught with current_exception and rethrown properly by rethrow_exception:

    try
    {
        throw my_exception();
    }
    catch( ... )
    {
        boost::exception_ptr p = boost::current_exception();

        BOOST_TEST_THROWS( boost::rethrow_exception( p ), my_exception );
    }

However if we add a boost::exception base,

class my_exception2: public std::exception, public boost::exception
{
};

rethrow_exception no longer throws my_exception2:

    try
    {
        throw my_exception2();
    }
    catch( ... )
    {
        boost::exception_ptr p = boost::current_exception();

        BOOST_TEST_THROWS( boost::rethrow_exception( p ), my_exception2 );
        BOOST_TEST_THROWS( boost::rethrow_exception( p ), boost::exception );
    }

even though it does throw something derived from boost::exception:

example.cpp(33): expression 'boost::rethrow_exception( p )' did not throw exception 'my_exception2' in function 'int main()'
1 error detected.

List of non BOOST-prefixed macros

The following macros are missing a BOOST_ prefix, which is against Boost library guidelines:

./boost_1_72_0/boost/exception/all.hpp:#ifndef UUID_316FDA946C0D11DEA9CBAE5255D89593
./boost_1_72_0/boost/exception/all.hpp:#define UUID_316FDA946C0D11DEA9CBAE5255D89593
./boost_1_72_0/boost/exception/current_exception_cast.hpp:#ifndef UUID_7E83C166200811DE885E826156D89593
./boost_1_72_0/boost/exception/current_exception_cast.hpp:#define UUID_7E83C166200811DE885E826156D89593
./boost_1_72_0/boost/exception/detail/clone_current_exception.hpp:#ifndef UUID_81522C0EB56511DFAB613DB0DFD72085
./boost_1_72_0/boost/exception/detail/clone_current_exception.hpp:#define UUID_81522C0EB56511DFAB613DB0DFD72085
./boost_1_72_0/boost/exception/detail/error_info_impl.hpp:#ifndef UUID_CE6983AC753411DDA764247956D89593
./boost_1_72_0/boost/exception/detail/error_info_impl.hpp:#define UUID_CE6983AC753411DDA764247956D89593
./boost_1_72_0/boost/exception/detail/exception_ptr.hpp:#ifndef UUID_618474C2DE1511DEB74A388C56D89593
./boost_1_72_0/boost/exception/detail/exception_ptr.hpp:#define UUID_618474C2DE1511DEB74A388C56D89593
./boost_1_72_0/boost/exception/detail/is_output_streamable.hpp:#ifndef UUID_898984B4076411DD973EDFA055D89593
./boost_1_72_0/boost/exception/detail/is_output_streamable.hpp:#define UUID_898984B4076411DD973EDFA055D89593
./boost_1_72_0/boost/exception/detail/object_hex_dump.hpp:#ifndef UUID_6F463AC838DF11DDA3E6909F56D89593
./boost_1_72_0/boost/exception/detail/object_hex_dump.hpp:#define UUID_6F463AC838DF11DDA3E6909F56D89593
./boost_1_72_0/boost/exception/detail/shared_ptr.hpp:#ifndef UUID_837060E885AF11E68DA91D15E31AC075
./boost_1_72_0/boost/exception/detail/shared_ptr.hpp:#define UUID_837060E885AF11E68DA91D15E31AC075
./boost_1_72_0/boost/exception/detail/type_info.hpp:#ifndef UUID_C3E1741C754311DDB2834CCA55D89593
./boost_1_72_0/boost/exception/detail/type_info.hpp:#define UUID_C3E1741C754311DDB2834CCA55D89593
./boost_1_72_0/boost/exception/diagnostic_information.hpp:#ifndef UUID_0552D49838DD11DD90146B8956D89593
./boost_1_72_0/boost/exception/diagnostic_information.hpp:#define UUID_0552D49838DD11DD90146B8956D89593
./boost_1_72_0/boost/exception/enable_current_exception.hpp:#ifndef UUID_851700A4F7CF11E6B2EE06DD14915323
./boost_1_72_0/boost/exception/enable_current_exception.hpp:#define UUID_851700A4F7CF11E6B2EE06DD14915323
./boost_1_72_0/boost/exception/enable_error_info.hpp:#ifndef UUID_A0F7404AF7CF11E6908227DD14915323
./boost_1_72_0/boost/exception/enable_error_info.hpp:#define UUID_A0F7404AF7CF11E6908227DD14915323
./boost_1_72_0/boost/exception/errinfo_api_function.hpp:#ifndef UUID_DDFBB4546C1211DEA4659E9055D89593
./boost_1_72_0/boost/exception/errinfo_api_function.hpp:#define UUID_DDFBB4546C1211DEA4659E9055D89593
./boost_1_72_0/boost/exception/errinfo_at_line.hpp:#ifndef UUID_E7255CE26C1211DE85800C9155D89593
./boost_1_72_0/boost/exception/errinfo_at_line.hpp:#define UUID_E7255CE26C1211DE85800C9155D89593
./boost_1_72_0/boost/exception/errinfo_errno.hpp:#ifndef UUID_F0EE17BE6C1211DE87FF459155D89593
./boost_1_72_0/boost/exception/errinfo_errno.hpp:#define UUID_F0EE17BE6C1211DE87FF459155D89593
./boost_1_72_0/boost/exception/errinfo_file_handle.hpp:#ifndef UUID_F79E6EE26C1211DEB26E929155D89593
./boost_1_72_0/boost/exception/errinfo_file_handle.hpp:#define UUID_F79E6EE26C1211DEB26E929155D89593
./boost_1_72_0/boost/exception/errinfo_file_name.hpp:#ifndef UUID_FEE5120A6C1211DE94E8BC9155D89593
./boost_1_72_0/boost/exception/errinfo_file_name.hpp:#define UUID_FEE5120A6C1211DE94E8BC9155D89593
./boost_1_72_0/boost/exception/errinfo_file_open_mode.hpp:#ifndef UUID_056F1F266C1311DE8E74299255D89593
./boost_1_72_0/boost/exception/errinfo_file_open_mode.hpp:#define UUID_056F1F266C1311DE8E74299255D89593
./boost_1_72_0/boost/exception/errinfo_nested_exception.hpp:#ifndef UUID_45CC9A82B77511DEB330FC4956D89593
./boost_1_72_0/boost/exception/errinfo_nested_exception.hpp:#define UUID_45CC9A82B77511DEB330FC4956D89593
./boost_1_72_0/boost/exception/errinfo_type_info_name.hpp:#ifndef UUID_0E11109E6C1311DEB7EA649255D89593
./boost_1_72_0/boost/exception/errinfo_type_info_name.hpp:#define UUID_0E11109E6C1311DEB7EA649255D89593
./boost_1_72_0/boost/exception/error_info.hpp:#ifndef UUID_EE7ECCA0433B11E1923E37064924019B
./boost_1_72_0/boost/exception/error_info.hpp:#define UUID_EE7ECCA0433B11E1923E37064924019B
./boost_1_72_0/boost/exception/exception.hpp:#ifndef UUID_274DA366004E11DCB1DDFE2E56D89593
./boost_1_72_0/boost/exception/exception.hpp:#define UUID_274DA366004E11DCB1DDFE2E56D89593
./boost_1_72_0/boost/exception/get_error_info.hpp:#ifndef UUID_1A590226753311DD9E4CCF6156D89593
./boost_1_72_0/boost/exception/get_error_info.hpp:#define UUID_1A590226753311DD9E4CCF6156D89593
./boost_1_72_0/boost/exception/info.hpp:#ifndef UUID_8D22C4CA9CC811DCAA9133D256D89593
./boost_1_72_0/boost/exception/info.hpp:#define UUID_8D22C4CA9CC811DCAA9133D256D89593
./boost_1_72_0/boost/exception/info_tuple.hpp:#ifndef UUID_63EE924290FB11DC87BB856555D89593
./boost_1_72_0/boost/exception/info_tuple.hpp:#define UUID_63EE924290FB11DC87BB856555D89593
./boost_1_72_0/boost/exception/to_string.hpp:#ifndef UUID_7E48761AD92811DC9011477D56D89593
./boost_1_72_0/boost/exception/to_string.hpp:#define UUID_7E48761AD92811DC9011477D56D89593
./boost_1_72_0/boost/exception/to_string_stub.hpp:#ifndef UUID_E788439ED9F011DCB181F25B55D89593
./boost_1_72_0/boost/exception/to_string_stub.hpp:#define UUID_E788439ED9F011DCB181F25B55D89593
./boost_1_72_0/boost/exception_ptr.hpp:#ifndef UUID_FA5836A2CADA11DC8CD47C8555D89593
./boost_1_72_0/boost/exception_ptr.hpp:#define UUID_FA5836A2CADA11DC8CD47C8555D89593
./boost_1_72_0/boost/throw_exception.hpp:#ifndef UUID_AA15E74A856F11E08B8D93F24824019B
./boost_1_72_0/boost/throw_exception.hpp:#define UUID_AA15E74A856F11E08B8D93F24824019B
./boost_1_72_0/libs/exception/test/helper1.hpp:#ifndef UUID_4AEB7924CA2E11DC888A8C9355D89593
./boost_1_72_0/libs/exception/test/helper1.hpp:#define UUID_4AEB7924CA2E11DC888A8C9355D89593
./boost_1_72_0/libs/exception/test/helper2.hpp:#ifndef UUID_BC765EB4CA2A11DCBDC5828355D89593
./boost_1_72_0/libs/exception/test/helper2.hpp:#define UUID_BC765EB4CA2A11DCBDC5828355D89593

UBSAN issues identified in CI PR preflight

Following something seen during a CI PR preflight upgrade in Boost.Algorithm, I decided to apply the same CI PR to my fork of Boost.Exception, and we're seeing the same issues. No analysis has been done on the observed failures.

Build command:

UBSAN_OPTIONS=print_stacktrace=1 /home/travis/build/jeking3/boost-root/b2 . toolset=gcc-8 cxxstd=03,11,14,17,2a cxxflags=-fno-omit-frame-pointer cxxflags=-fsanitize=undefined cxxflags=-fno-sanitize-recover=undefined define=BOOST_NO_STRESS_TEST=1 linkflags=-fsanitize=undefined linkflags=-fno-sanitize-recover=undefined linkflags=-fuse-ld=gold variant=debug -j3

First two errors:

https://travis-ci.org/jeking3/exception/jobs/454168878#L1151

====== BEGIN OUTPUT ======
../../boost/exception/exception.hpp:450:17: runtime error: member call on address 0x000000d37d60 which does not point to an object of type 'exception'
0x000000d37d60: note: object has invalid vptr
 ff 7f 00 00  00 00 00 00 00 00 00 00  08 3c 4a 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              invalid vptr
    #0 0x4496be in boost::exception_detail::clone_impl<err>::~clone_impl() (/home/travis/build/jeking3/boost-root/bin.v2/libs/exception/test/copy_exception_test.test/gcc-8/debug/cxxstd-03-iso/link-static/threadapi-pthread/threading-multi/visibility-hidden/copy_exception_test+0x4496be)
    #1 0x7f0214a6d15e  (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0x6c15e)
    #2 0x42981c in boost::exception_ptr boost::copy_exception<err>(err const&) (/home/travis/build/jeking3/boost-root/bin.v2/libs/exception/test/copy_exception_test.test/gcc-8/debug/cxxstd-03-iso/link-static/threadapi-pthread/threading-multi/visibility-hidden/copy_exception_test+0x42981c)
    #3 0x405eea in simple_test() ../../libs/exception/test/copy_exception_test.cpp:121
    #4 0x4060fc in main ../../libs/exception/test/copy_exception_test.cpp:142
    #5 0x7f0213503f44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21f44)
    #6 0x405768  (/home/travis/build/jeking3/boost-root/bin.v2/libs/exception/test/copy_exception_test.test/gcc-8/debug/cxxstd-03-iso/link-static/threadapi-pthread/threading-multi/visibility-hidden/copy_exception_test+0x405768)
EXIT STATUS: 1
====== END OUTPUT ======

https://travis-ci.org/jeking3/exception/jobs/454168878#L1248

====== BEGIN OUTPUT ======
../../boost/exception/exception.hpp:492:13: runtime error: member call on address 0x00000235c100 which does not point to an object of type 'exception'
0x00000235c100: note: object has invalid vptr
 fd 7f 00 00  00 00 00 00 00 00 00 00  28 24 43 00 00 00 00 00  40 c1 35 02 00 00 00 00  78 13 43 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              invalid vptr
    #0 0x41d3c2 in boost::wrapexcept<test_exception>::~wrapexcept() ../../boost/exception/exception.hpp:492
    #1 0x7fd7d9cd415e  (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0x6c15e)
    #2 0x404671 in main ../../libs/exception/test/errinfos_test.cpp:49
    #3 0x7fd7d8988f44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21f44)
    #4 0x4032c8  (/home/travis/build/jeking3/boost-root/bin.v2/libs/exception/test/errinfos_test.test/gcc-8/debug/cxxstd-03-iso/link-static/visibility-hidden/errinfos_test+0x4032c8)
EXIT STATUS: 1
====== END OUTPUT ======

For reference this started from a discussion here:

boostorg/algorithm#52

Unreal Engine 5 build error

https://github.com/boostorg/exception/blob/develop/include/boost/exception/detail/exception_ptr.hpp#L29

All lines with GNUC ifdef like this fails with error:

boost\exception\exception.hpp(22): error C4668: '__GNUC__' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
boost\exception\exception.hpp(22): error C4668: '__GNUC_MINOR__' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'

Possible fix - boostorg/smart_ptr#98
Such change should be implemented with all occurences of __GNUC__

Probably this repo is also affected.
https://github.com/boostorg/throw_exception

missing boost/config.hpp includes

Some of the exception headers examine boost control macros without first including config.hpp. Thus, they are not self-contained, and that creates difficulty building them as clang modules or c++ header units (specifically they think the macros are undefined, which might mismatch the rest of the build, leading to conflicts). Here are the ones I found problematic (I think there are others, particularly WRT BOOST_EXCEPTION_ENABLE_WARNINGS, but that doesn't bite in this case.

diff --git a/third-party/tp2/boost/1.77.0/boost_1_77_0/boost/exception/current_exception_cast.hpp b/third-party/tp2/boost/1.77.0/boost_1_77_0/boost/exception/current_exception_cast.hpp
--- a/third-party/tp2/boost/1.77.0/boost_1_77_0/boost/exception/current_exception_cast.hpp
+++ b/third-party/tp2/boost/1.77.0/boost_1_77_0/boost/exception/current_exception_cast.hpp
@@ -6,6 +6,8 @@
 #ifndef BOOST_EXCEPTION_7E83C166200811DE885E826156D89593
 #define BOOST_EXCEPTION_7E83C166200811DE885E826156D89593
 
+#include <boost/config.hpp>
+
 #ifndef BOOST_EXCEPTION_ENABLE_WARNINGS
 #if __GNUC__*100+__GNUC_MINOR__>301
 #pragma GCC system_header
diff --git a/third-party/tp2/boost/1.77.0/boost_1_77_0/boost/exception/detail/is_output_streamable.hpp b/third-party/tp2/boost/1.77.0/boost_1_77_0/boost/exception/detail/is_output_streamable.hpp
--- a/third-party/tp2/boost/1.77.0/boost_1_77_0/boost/exception/detail/is_output_streamable.hpp
+++ b/third-party/tp2/boost/1.77.0/boost_1_77_0/boost/exception/detail/is_output_streamable.hpp
@@ -6,6 +6,7 @@
 #ifndef BOOST_EXCEPTION_898984B4076411DD973EDFA055D89593
 #define BOOST_EXCEPTION_898984B4076411DD973EDFA055D89593
 
+#include <boost/config.hpp>
 #include <ostream>
 
 #ifndef BOOST_EXCEPTION_ENABLE_WARNINGS
diff --git a/third-party/tp2/boost/1.77.0/boost_1_77_0/boost/exception/detail/shared_ptr.hpp b/third-party/tp2/boost/1.77.0/boost_1_77_0/boost/exception/detail/shared_ptr.hpp
--- a/third-party/tp2/boost/1.77.0/boost_1_77_0/boost/exception/detail/shared_ptr.hpp
+++ b/third-party/tp2/boost/1.77.0/boost_1_77_0/boost/exception/detail/shared_ptr.hpp
@@ -6,6 +6,8 @@
 #ifndef BOOST_EXCEPTION_837060E885AF11E68DA91D15E31AC075
 #define BOOST_EXCEPTION_837060E885AF11E68DA91D15E31AC075
 
+#include <boost/config.hpp>
+
 #ifdef BOOST_EXCEPTION_MINI_BOOST
 #include  <memory>
 namespace boost { namespace exception_detail { using std::shared_ptr; } }

Macro vanished, but still documented

I got a compile error with an updated boost version about an undefined macro, namely BOOST_THROW_EXCEPTION_CURRENT_FUNCTION. I could resolve it by replacing it by BOOST_CURRENT_FUNCTION. However, it is still documented in Configuration Macros. So is this a documentation error or has it been removed accidentally?

to_string( original_exception_type const & x ) doesn't add "\n"

unlike generalized version to_string( error_info<Tag,T> const & x )

I have my own custom extension to library that besides other features (such as customizing output for error_info_name according to end user dictionary, optionally choosing what types from error_info_map to include/exclude from generated diagnostic info string etc.) fix this annoyance for me but thought you might want to look into this

valgrind issues identified in CI PR preflight

Build command:

VALGRIND_OPTS=--error-exitcode=1 /home/travis/build/jeking3/boost-root/b2 . toolset=clang-6.0 cxxstd=03,11,14,17,2a define=BOOST_NO_STRESS_TEST=1 testing.launcher=valgrind variant=debug -j3

This error appears to occurs in the same test 5 times, once for each language level that was run, so I copied in the first occurrence:

https://travis-ci.org/jeking3/exception/jobs/454168879#L1188

====== BEGIN OUTPUT ======
==7746== Memcheck, a memory error detector
==7746== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==7746== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==7746== Command: ../../bin.v2/libs/exception/test/to_string_stub_test.test/clang-linux-6.0/debug/cxxstd-03-iso/link-static/visibility-hidden/to_string_stub_test
==7746== 
==7746== Use of uninitialised value of size 8
==7746==    at 0x4EE2D0E: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==7746==    by 0x4EE3714: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<unsigned long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, unsigned long) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==7746==    by 0x4EEF154: std::ostream& std::ostream::_M_insert<unsigned long>(unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==7746==    by 0x40429D: std::string boost::exception_detail::object_hex_dump<boost::to_string_tester>(boost::to_string_tester const&, unsigned long) (object_hex_dump.hpp:40)
==7746==    by 0x403FA1: std::string boost::exception_detail::string_stub_dump<boost::to_string_tester>(boost::to_string_tester const&) (to_string_stub.hpp:86)
==7746==    by 0x404070: std::string boost::exception_detail::to_string_dispatcher<false>::convert<boost::to_string_tester, std::string (*)(boost::to_string_tester const&)>(boost::to_string_tester const&, std::string (*)(boost::to_string_tester const&)) (in /home/travis/build/jeking3/boost-root/bin.v2/libs/exception/test/to_string_stub_test.test/clang-linux-6.0/debug/cxxstd-03-iso/link-static/visibility-hidden/to_string_stub_test)
==7746==    by 0x403F63: std::string boost::exception_detail::to_string_dispatch::dispatch<boost::to_string_tester, std::string (*)(boost::to_string_tester const&)>(boost::to_string_tester const&, std::string (*)(boost::to_string_tester const&)) (in /home/travis/build/jeking3/boost-root/bin.v2/libs/exception/test/to_string_stub_test.test/clang-linux-6.0/debug/cxxstd-03-iso/link-static/visibility-hidden/to_string_stub_test)
==7746==    by 0x402265: std::string boost::to_string_stub<boost::to_string_tester>(boost::to_string_tester const&) (in /home/travis/build/jeking3/boost-root/bin.v2/libs/exception/test/to_string_stub_test.test/clang-linux-6.0/debug/cxxstd-03-iso/link-static/visibility-hidden/to_string_stub_test)
==7746==    by 0x401C26: main (to_string_stub_test.cpp:96)
==7746== 
==7746== Conditional jump or move depends on uninitialised value(s)
==7746==    at 0x4EE2D15: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==7746==    by 0x4EE3714: std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_int<unsigned long>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, unsigned long) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==7746==    by 0x4EEF154: std::ostream& std::ostream::_M_insert<unsigned long>(unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==7746==    by 0x40429D: std::string boost::exception_detail::object_hex_dump<boost::to_string_tester>(boost::to_string_tester const&, unsigned long) (object_hex_dump.hpp:40)
==7746==    by 0x403FA1: std::string boost::exception_detail::string_stub_dump<boost::to_string_tester>(boost::to_string_tester const&) (to_string_stub.hpp:86)
==7746==    by 0x404070: std::string boost::exception_detail::to_string_dispatcher<false>::convert<boost::to_string_tester, std::string (*)(boost::to_string_tester const&)>(boost::to_string_tester const&, std::string (*)(boost::to_string_tester const&)) (in /home/travis/build/jeking3/boost-root/bin.v2/libs/exception/test/to_string_stub_test.test/clang-linux-6.0/debug/cxxstd-03-iso/link-static/visibility-hidden/to_string_stub_test)
==7746==    by 0x403F63: std::string boost::exception_detail::to_string_dispatch::dispatch<boost::to_string_tester, std::string (*)(boost::to_string_tester const&)>(boost::to_string_tester const&, std::string (*)(boost::to_string_tester const&)) (in /home/travis/build/jeking3/boost-root/bin.v2/libs/exception/test/to_string_stub_test.test/clang-linux-6.0/debug/cxxstd-03-iso/link-static/visibility-hidden/to_string_stub_test)
==7746==    by 0x402265: std::string boost::to_string_stub<boost::to_string_tester>(boost::to_string_tester const&) (in /home/travis/build/jeking3/boost-root/bin.v2/libs/exception/test/to_string_stub_test.test/clang-linux-6.0/debug/cxxstd-03-iso/link-static/visibility-hidden/to_string_stub_test)
==7746==    by 0x401C26: main (to_string_stub_test.cpp:96)
==7746== 
No errors detected.
==7746== 
==7746== HEAP SUMMARY:
==7746==     in use at exit: 72,704 bytes in 1 blocks
==7746==   total heap usage: 20 allocs, 19 frees, 75,987 bytes allocated
==7746== 
==7746== LEAK SUMMARY:
==7746==    definitely lost: 0 bytes in 0 blocks
==7746==    indirectly lost: 0 bytes in 0 blocks
==7746==      possibly lost: 0 bytes in 0 blocks
==7746==    still reachable: 72,704 bytes in 1 blocks
==7746==         suppressed: 0 bytes in 0 blocks
==7746== Rerun with --leak-check=full to see details of leaked memory
==7746== 
==7746== For counts of detected and suppressed errors, rerun with: -v
==7746== Use --track-origins=yes to see where uninitialised values come from
==7746== ERROR SUMMARY: 4 errors from 2 contexts (suppressed: 0 from 0)
EXIT STATUS: 1
====== END OUTPUT ======

feature request: throw_exception customization point

what about introducing end user customization point facility? at the moment one can specialize throw_exception template using any specific type but providing specialization for the entire class hierarchy looks somewhat problematic

boost::get_error_info() fails to lookup info for boost::stacktrace tag

Summary

On macOS Catalina when throwing a boost::enable_error_info annotated exception from a shared library, then catching it from the main executable, and built with default symbol visibility to “hidden”, get_error_info() from main exe fails to locate exception details.

Steps to reproduce

See reproducer at https://github.com/daverigby/boost_error_info_visibility

Analysis

Thanks to @pdimov on #boost cpplang slack, we identified that a number of symbols in exception / stacktrace need BOOST_SYMBOL_VISIBLE applying. In my local Boost 1.75 world adding to the forward-decl and defns of all of the following was required to make the test pass:

  • boost::error_info
  • boost::error_info_base
  • Tag template param for boost::error_info
  • "T" tempalate param for boost_error_info (which is boost_stacktrace and template params in my case):
    • boost::stacktrace::frame
    • boost::basic_stacktrace

exception.hpp: warning C4265 given by Visual Studio

This has been reported before (https://svn.boost.org/trac10/ticket/13227), but I am not sure that tracker is still active. The problem is still relevant with boost 1.65.1 and 1.70.

Quoting:

MSVC falsely report a missing virtual destructor inside exception.hpp Would it be possible to add a "pragma warning (disable:4265)" in this file ? This will not happen with the default settings of Visual Studio : it happens when trying to raise the warning level (/we4265 : treat "misssing virtual destructor" as an error)

The above link has reproduction steps, in particular, https://github.com/ivsgroup/boost_warnings_minimal_demo

boost::exception should be nothrow-copy-constructible

clang-tidy's cert-err60-cpp check has alerted me to CERT Coding Standard rule ERR60-CPP that exception types should be nothrow-copy-constructible.

At present, a boost::exception fails this clang-tidy check and std::is_nothrow_copy_constructible_v agrees…

#include <type_traits>

#include <boost/exception/all.hpp>

static_assert( ::std::is_nothrow_copy_constructible_v< ::boost::exception > );
> clang++ -std=c++17 -stdlib=libc++ -fsyntax-only -isystem include -isystem /opt/include a.cpp
a.cpp:5:1: error: static_assert failed due to requirement '::std::is_nothrow_copy_constructible_v< ::boost::exception>'
static_assert( ::std::is_nothrow_copy_constructible_v< ::boost::exception > );
^              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
> g++ -std=c++17 -fsyntax-only -isystem include -isystem /opt/include a.cpp 
a.cpp:5:16: error: static assertion failed
 static_assert( ::std::is_nothrow_copy_constructible_v< ::boost::exception > );

This comment in the code gives the impression that we might reasonably hope exception might be nothrow-copy-constructible and that it could be marked as such with some of Boost.Config's BOOST_NOEXCEPT macros.

Is this possible?

If a boost::exception is sometimes/always not nothrow-copy-constructible, it would be good to highlight this issue in the docs so that people are aware if/when their use of Boost.Exception violates a CERT rule.

Thanks for your work on this library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.