-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GCC suggest-override warnings #76
Comments
I'm not seeing the first warning on Godbolt. https://godbolt.org/z/zxhehJ |
Not seeing the second either: https://godbolt.org/z/b5Ouzs |
Complete compilation log for problems in first two places: In file included from include/boost/smart_ptr/detail/shared_count.hpp:28:0, from include/boost/smart_ptr/shared_ptr.hpp:28, from include/boost/shared_ptr.hpp:17, from include/boost/python/converter/shared_ptr_to_python.hpp:12, from include/boost/python/converter/arg_to_python.hpp:15, from include/boost/python/call.hpp:15, from include/boost/python/object_core.hpp:14, from include/boost/python/object.hpp:9, from include/boost/python/import.hpp:8, from |
Complete compilation log for problems in first and last place: In file included from include/boost/smart_ptr/detail/shared_count.hpp:28:0, from include/boost/smart_ptr/shared_ptr.hpp:28, from include/boost/shared_ptr.hpp:17, from include/boost/iostreams/filter/symmetric.hpp:61, from include/boost/iostreams/filter/bzip2.hpp:29, from |
Is there a program that I can compile that reproduces the warnings? |
Somehow I was not able to reproduce it on godbold. However I looked on first occurrence and warning looks reasonable for me: class bad_weak_ptr: public std::exception { public: virtual char const * what() const BOOST_NOEXCEPT_OR_NOTHROW { return "tr1::bad_weak_ptr"; } };
Same is true for |
Clang-tidy modernize-use-override should also complain about such cases. |
Godbolt probably includes Boost headers with -isystem. |
Related: boostorg/config#253 |
Complete list of warnings when Boost is built with ./boost/smart_ptr/bad_weak_ptr.hpp:50:26: warning: ‘virtual const char* boost::bad_weak_ptr::what() const’ can be marked override [-Wsuggest-override] ./boost/smart_ptr/detail/local_counted_base.hpp:116:18: warning: ‘virtual void boost::detail::local_counted_impl::local_cb_destroy()’ can be marked override [-Wsuggest-override] ./boost/smart_ptr/detail/local_counted_base.hpp:121:41: warning: ‘virtual boost::detail::shared_count boost::detail::local_counted_impl::local_cb_get_shared_count() const’ can be marked override [-Wsuggest-override] ./boost/smart_ptr/detail/local_counted_base.hpp:133:18: warning: ‘virtual void boost::detail::local_counted_impl_em::local_cb_destroy()’ can be marked override [-Wsuggest-override] ./boost/smart_ptr/detail/local_counted_base.hpp:138:41: warning: ‘virtual boost::detail::shared_count boost::detail::local_counted_impl_em::local_cb_get_shared_count() const’ can be marked override [-Wsuggest-override] ./boost/smart_ptr/detail/shared_count.hpp:634:67: warning: potential null pointer dereference [-Wnull-dereference] ./boost/smart_ptr/detail/sp_counted_impl.hpp:101:20: warning: ‘void* boost::detail::sp_counted_impl_p::get_local_deleter(const sp_typeinfo_&) [with X = boost::basic_wrap_stringstream; boost::detail::sp_typeinfo_ = std::type_info]’ can be marked override [-Wsuggest-override] ./boost/smart_ptr/detail/sp_counted_impl.hpp:106:20: warning: ‘void* boost::detail::sp_counted_impl_p::get_untyped_deleter() [with X = boost::basic_wrap_stringstream]’ can be marked override [-Wsuggest-override] ./boost/smart_ptr/detail/sp_counted_impl.hpp:171:18: warning: ‘void boost::detail::sp_counted_impl_pd::dispose() [with P = boost::log::v2_mt_posix::{anonymous}::default_console_sink_factory*; D = boost::detail::sp_ms_deleter >]’ can be marked override [-Wsuggest-override] ./boost/smart_ptr/detail/sp_counted_impl.hpp:176:20: warning: ‘void* boost::detail::sp_counted_impl_pd::get_deleter(const sp_typeinfo_&) [with P = boost::log::v2_mt_posix::{anonymous}::default_console_sink_factory*; D = boost::detail::sp_ms_deleter >; boost::detail::sp_typeinfo_ = std::type_info]’ can be marked override [-Wsuggest-override] ./boost/smart_ptr/detail/sp_counted_impl.hpp:181:20: warning: ‘void* boost::detail::sp_counted_impl_pd::get_local_deleter(const sp_typeinfo_&) [with P = boost::log::v2_mt_posix::{anonymous}::default_console_sink_factory*; D = boost::detail::sp_ms_deleter >; boost::detail::sp_typeinfo_ = std::type_info]’ can be marked override [-Wsuggest-override] ./boost/smart_ptr/detail/sp_counted_impl.hpp:186:20: warning: ‘void* boost::detail::sp_counted_impl_pd::get_untyped_deleter() [with P = boost::log::v2_mt_posix::{anonymous}::default_console_sink_factory*; D = boost::detail::sp_ms_deleter >]’ can be marked override [-Wsuggest-override] ./boost/smart_ptr/detail/sp_counted_impl.hpp:88:18: warning: ‘void boost::detail::sp_counted_impl_p::dispose() [with X = boost::basic_wrap_stringstream]’ can be marked override [-Wsuggest-override] ./boost/smart_ptr/detail/sp_counted_impl.hpp:96:20: warning: ‘void* boost::detail::sp_counted_impl_p::get_deleter(const sp_typeinfo_&) [with X = boost::basic_wrap_stringstream; boost::detail::sp_typeinfo_ = std::type_info]’ can be marked override [-Wsuggest-override] |
This one is interesting.
|
Waiting on boostorg/config#329 |
Building what library cases the -Wnull-dereference warning? |
This is excerpt from build log file: gcc.compile.c++ bin.v2/libs/log/build/gcc-7.5.0/release/threadapi-pthread/threading-multi/visibility-hidden/text_file_backend.o "gcc-7.5.0/bin/g++" -fvisibility-inlines-hidden -fPIC -m64 -pthread -O3 -finline-functions -Wno-inline -Wall -fvisibility=hidden -fPIC -isystem /usr/include/x86_64-linux-gnu -DBOOST_NO_AUTO_PTR -Wextra -Wdangling-else -Wdisabled-optimization -Wduplicated-branches -Wduplicated-cond -Wcast-align -Wcast-qual -Wlogical-op -Wnull-dereference -Wrestrict -Wshift-negative-value -Wshift-overflow -Wsuggest-override -fno-strict-aliasing -ftemplate-depth-1024 -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_DYN_LINK=1 -DBOOST_CHRONO_DYN_LINK=1 -DBOOST_DATE_TIME_DYN_LINK=1 -DBOOST_FILESYSTEM_DYN_LINK=1 -DBOOST_HAS_ICU=1 -DBOOST_LOG_BUILDING_THE_LIB=1 -DBOOST_LOG_DLL -DBOOST_LOG_HAS_PTHREAD_MUTEX_ROBUST -DBOOST_LOG_USE_AVX2 -DBOOST_LOG_USE_NATIVE_SYSLOG -DBOOST_LOG_USE_SSSE3 -DBOOST_LOG_WITHOUT_DEBUG_OUTPUT -DBOOST_LOG_WITHOUT_EVENT_LOG -DBOOST_SPIRIT_USE_PHOENIX_V3=1 -DBOOST_THREAD_BUILD_DLL=1 -DBOOST_THREAD_DONT_USE_CHRONO=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_USE_DLL=1 -DDATE_TIME_INLINE -DNDEBUG -D_XOPEN_SOURCE=600 -D__STDC_CONSTANT_MACROS -I"." -I"libs/log/src" -c -o "bin.v2/libs/log/build/gcc-7.5.0/release/threadapi-pthread/threading-multi/visibility-hidden/text_file_backend.o" "libs/log/src/text_file_backend.cpp" ... In file included from ./boost/smart_ptr/shared_ptr.hpp:28:0, from ./boost/smart_ptr/make_shared_object.hpp:17, from libs/log/src/text_file_backend.cpp:35: ./boost/smart_ptr/detail/shared_count.hpp: In function ‘boost::shared_ptr boost::log::v2_mt_posix::sinks::file::aux::make_collector(const boost::filesystem::path&, uintmax_t, uintmax_t, uintmax_t)’: ./boost/smart_ptr/detail/shared_count.hpp:634:67: warning: potential null pointer dereference [-Wnull-dereference] inline shared_count::shared_count( weak_count const & r ): pi_( r.pi_ ) ~~^~~ |
The override warnings should be fixed in develop. |
Thank you for help! Please also delete |
GCC 7.5 fires suggest-override warnings in Boost 1.72:
The text was updated successfully, but these errors were encountered: