Skip to content
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

Open
EugeneZelenko opened this issue Apr 4, 2020 · 16 comments
Open

GCC suggest-override warnings #76

EugeneZelenko opened this issue Apr 4, 2020 · 16 comments

Comments

@EugeneZelenko
Copy link

GCC 7.5 fires suggest-override warnings in Boost 1.72:

include/boost/smart_ptr/bad_weak_ptr.hpp:50:26: error: ‘virtual const char* boost::bad_weak_ptr::what() const’ can be marked override [-Werror=suggest-override]
include/boost/smart_ptr/detail/local_counted_base.hpp:116:18: error: ‘virtual void boost::detail::local_counted_impl::local_cb_destroy()’ can be marked override [-Werror=suggest-override]
include/boost/smart_ptr/detail/local_counted_base.hpp:121:41: error: ‘virtual boost::detail::shared_count boost::detail::local_counted_impl::local_cb_get_shared_count() const’ can be marked override [-Werror=suggest-override]
include/boost/smart_ptr/detail/local_counted_base.hpp:133:18: error: ‘virtual void boost::detail::local_counted_impl_em::local_cb_destroy()’ can be marked override [-Werror=suggest-override]
include/boost/smart_ptr/detail/local_counted_base.hpp:138:41: error: ‘virtual boost::detail::shared_count boost::detail::local_counted_impl_em::local_cb_get_shared_count() const’ can be marked override [-Werror=suggest-override]
include/boost/smart_ptr/detail/sp_counted_impl.hpp:88:18: error: ‘void boost::detail::sp_counted_impl_p::dispose() [with X = boost::iostreams::symmetric_filter >, std::allocator >::impl]’ can be marked override [-Werror=suggest-override]
include/boost/smart_ptr/detail/sp_counted_impl.hpp:96:20: error: ‘void* boost::detail::sp_counted_impl_p::get_deleter(const sp_typeinfo_&) [with X = boost::iostreams::symmetric_filter >, std::allocator >::impl; boost::detail::sp_typeinfo_ = std::type_info]’ can be marked override [-Werror=suggest-override]
include/boost/smart_ptr/detail/sp_counted_impl.hpp:101:20: error: ‘void* boost::detail::sp_counted_impl_p::get_local_deleter(const sp_typeinfo_&) [with X = boost::iostreams::symmetric_filter >, std::allocator >::impl; boost::detail::sp_typeinfo_ = std::type_info]’ can be marked override [-Werror=suggest-override]
include/boost/smart_ptr/detail/sp_counted_impl.hpp:106:20: error: ‘void* boost::detail::sp_counted_impl_p::get_untyped_deleter() [with X = boost::iostreams::symmetric_filter >, std::allocator >::impl]’ can be marked override [-Werror=suggest-override]
@pdimov
Copy link
Member

pdimov commented Apr 5, 2020

I'm not seeing the first warning on Godbolt. https://godbolt.org/z/zxhehJ

@pdimov
Copy link
Member

pdimov commented Apr 5, 2020

Not seeing the second either: https://godbolt.org/z/b5Ouzs

@EugeneZelenko
Copy link
Author

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 :
include/boost/smart_ptr/bad_weak_ptr.hpp:50:26: error: ‘virtual const char* boost::bad_weak_ptr::what() const’ can be marked override [-Werror=suggest-override]
     virtual char const * what() const BOOST_NOEXCEPT_OR_NOTHROW
                          ^~~~
In file included from include/boost/smart_ptr/detail/local_sp_deleter.hpp:20:0,
                 from include/boost/smart_ptr/shared_ptr.hpp:1158,
                 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 :
include/boost/smart_ptr/detail/local_counted_base.hpp:116:18: error: ‘virtual void boost::detail::local_counted_impl::local_cb_destroy()’ can be marked override [-Werror=suggest-override]
     virtual void local_cb_destroy() BOOST_SP_NOEXCEPT
                  ^~~~~~~~~~~~~~~~
include/boost/smart_ptr/detail/local_counted_base.hpp:121:41: error: ‘virtual boost::detail::shared_count boost::detail::local_counted_impl::local_cb_get_shared_count() const’ can be marked override [-Werror=suggest-override]
     virtual boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~
include/boost/smart_ptr/detail/local_counted_base.hpp:133:18: error: ‘virtual void boost::detail::local_counted_impl_em::local_cb_destroy()’ can be marked override [-Werror=suggest-override]
     virtual void local_cb_destroy() BOOST_SP_NOEXCEPT
                  ^~~~~~~~~~~~~~~~
include/boost/smart_ptr/detail/local_counted_base.hpp:138:41: error: ‘virtual boost::detail::shared_count boost::detail::local_counted_impl_em::local_cb_get_shared_count() const’ can be marked override [-Werror=suggest-override]
     virtual boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~

@EugeneZelenko
Copy link
Author

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 :
include/boost/smart_ptr/bad_weak_ptr.hpp:50:26: error: ‘virtual const char* boost::bad_weak_ptr::what() const’ can be marked override [-Werror=suggest-override]
     virtual char const * what() const BOOST_NOEXCEPT_OR_NOTHROW
                          ^~~~
In file included from include/boost/smart_ptr/detail/local_sp_deleter.hpp:20:0,
                 from include/boost/smart_ptr/shared_ptr.hpp:1158,
                 from include/boost/shared_ptr.hpp:17,
                 from include/boost/iostreams/filter/symmetric.hpp:61,
                 from include/boost/iostreams/filter/bzip2.hpp:29,
                 from :
include/boost/smart_ptr/detail/local_counted_base.hpp:116:18: error: ‘virtual void boost::detail::local_counted_impl::local_cb_destroy()’ can be marked override [-Werror=suggest-override]
     virtual void local_cb_destroy() BOOST_SP_NOEXCEPT
                  ^~~~~~~~~~~~~~~~
In file included from include/boost/smart_ptr/detail/shared_count.hpp:30: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 :
include/boost/smart_ptr/detail/sp_counted_impl.hpp: In instantiation of ‘class boost::detail::sp_counted_impl_p >, std::allocator >::impl>’:
include/boost/smart_ptr/detail/shared_count.hpp:145:19:   required from ‘boost::detail::shared_count::shared_count(Y*) [with Y = boost::iostreams::symmetric_filter >, std::allocator >::impl]’
include/boost/smart_ptr/shared_ptr.hpp:285:20:   required from ‘void boost::detail::sp_pointer_construct(boost::shared_ptr*, Y*, boost::detail::shared_count&) [with T = boost::iostreams::symmetric_filter >, std::allocator >::impl; Y = boost::iostreams::symmetric_filter >, std::allocator >::impl]’
include/boost/smart_ptr/shared_ptr.hpp:379:44:   required from ‘boost::shared_ptr::shared_ptr(Y*) [with Y = boost::iostreams::symmetric_filter >, std::allocator >::impl; T = boost::iostreams::symmetric_filter >, std::allocator >::impl]’
include/boost/preprocessor/iteration/detail/local.hpp:37:9:   required from ‘boost::iostreams::symmetric_filter::symmetric_filter(std::streamsize, const T0&) [with T0 = bool; SymmetricFilter = boost::iostreams::detail::bzip2_decompressor_impl >; Alloc = std::allocator; std::streamsize = long int]’
include/boost/iostreams/filter/bzip2.hpp:419:35:   required from ‘boost::iostreams::basic_bzip2_decompressor::basic_bzip2_decompressor(bool, std::streamsize) [with Alloc = std::allocator; std::streamsize = long int]’
:   required from here
include/boost/smart_ptr/detail/sp_counted_impl.hpp:88:18: error: ‘void boost::detail::sp_counted_impl_p::dispose() [with X = boost::iostreams::symmetric_filter >, std::allocator >::impl]’ can be marked override [-Werror=suggest-override]
     virtual void dispose() BOOST_SP_NOEXCEPT
                  ^~~~~~~
include/boost/smart_ptr/detail/sp_counted_impl.hpp:96:20: error: ‘void* boost::detail::sp_counted_impl_p::get_deleter(const sp_typeinfo_&) [with X = boost::iostreams::symmetric_filter >, std::allocator >::impl; boost::detail::sp_typeinfo_ = std::type_info]’ can be marked override [-Werror=suggest-override]
     virtual void * get_deleter( sp_typeinfo_ const & ) BOOST_SP_NOEXCEPT
                    ^~~~~~~~~~~
include/boost/smart_ptr/detail/sp_counted_impl.hpp:101:20: error: ‘void* boost::detail::sp_counted_impl_p::get_local_deleter(const sp_typeinfo_&) [with X = boost::iostreams::symmetric_filter >, std::allocator >::impl; boost::detail::sp_typeinfo_ = std::type_info]’ can be marked override [-Werror=suggest-override]
     virtual void * get_local_deleter( sp_typeinfo_ const & ) BOOST_SP_NOEXCEPT
                    ^~~~~~~~~~~~~~~~~
include/boost/smart_ptr/detail/sp_counted_impl.hpp:106:20: error: ‘void* boost::detail::sp_counted_impl_p::get_untyped_deleter() [with X = boost::iostreams::symmetric_filter >, std::allocator >::impl]’ can be marked override [-Werror=suggest-override]
     virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT
                    ^~~~~~~~~~~~~~~~~~~
include/boost/smart_ptr/detail/sp_counted_impl.hpp: In instantiation of ‘class boost::detail::sp_counted_impl_p >, std::allocator >::impl>’:
include/boost/smart_ptr/detail/shared_count.hpp:145:19:   required from ‘boost::detail::shared_count::shared_count(Y*) [with Y = boost::iostreams::symmetric_filter >, std::allocator >::impl]’
include/boost/smart_ptr/shared_ptr.hpp:285:20:   required from ‘void boost::detail::sp_pointer_construct(boost::shared_ptr*, Y*, boost::detail::shared_count&) [with T = boost::iostreams::symmetric_filter >, std::allocator >::impl; Y = boost::iostreams::symmetric_filter >, std::allocator >::impl]’
include/boost/smart_ptr/shared_ptr.hpp:379:44:   required from ‘boost::shared_ptr::shared_ptr(Y*) [with Y = boost::iostreams::symmetric_filter >, std::allocator >::impl; T = boost::iostreams::symmetric_filter >, std::allocator >::impl]’
include/boost/preprocessor/iteration/detail/local.hpp:37:9:   required from ‘boost::iostreams::symmetric_filter::symmetric_filter(std::streamsize, const T0&) [with T0 = boost::iostreams::zlib_params; SymmetricFilter = boost::iostreams::detail::zlib_decompressor_impl >; Alloc = std::allocator; std::streamsize = long int]’
include/boost/iostreams/filter/zlib.hpp:420:31:   required from ‘boost::iostreams::basic_zlib_decompressor::basic_zlib_decompressor(const boost::iostreams::zlib_params&, std::streamsize) [with Alloc = std::allocator; std::streamsize = long int]’
include/boost/iostreams/filter/gzip.hpp:736:21:   required from ‘boost::iostreams::basic_gzip_decompressor::basic_gzip_decompressor(int, std::streamsize) [with Alloc = std::allocator; std::streamsize = long int]’
:   required from here
include/boost/smart_ptr/detail/sp_counted_impl.hpp:88:18: error: ‘void boost::detail::sp_counted_impl_p::dispose() [with X = boost::iostreams::symmetric_filter >, std::allocator >::impl]’ can be marked override [-Werror=suggest-override]
     virtual void dispose() BOOST_SP_NOEXCEPT
                  ^~~~~~~
include/boost/smart_ptr/detail/sp_counted_impl.hpp:96:20: error: ‘void* boost::detail::sp_counted_impl_p::get_deleter(const sp_typeinfo_&) [with X = boost::iostreams::symmetric_filter >, std::allocator >::impl; boost::detail::sp_typeinfo_ = std::type_info]’ can be marked override [-Werror=suggest-override]
     virtual void * get_deleter( sp_typeinfo_ const & ) BOOST_SP_NOEXCEPT
                    ^~~~~~~~~~~
include/boost/smart_ptr/detail/sp_counted_impl.hpp:101:20: error: ‘void* boost::detail::sp_counted_impl_p::get_local_deleter(const sp_typeinfo_&) [with X = boost::iostreams::symmetric_filter >, std::allocator >::impl; boost::detail::sp_typeinfo_ = std::type_info]’ can be marked override [-Werror=suggest-override]
     virtual void * get_local_deleter( sp_typeinfo_ const & ) BOOST_SP_NOEXCEPT
                    ^~~~~~~~~~~~~~~~~
include/boost/smart_ptr/detail/sp_counted_impl.hpp:106:20: error: ‘void* boost::detail::sp_counted_impl_p::get_untyped_deleter() [with X = boost::iostreams::symmetric_filter >, std::allocator >::impl]’ can be marked override [-Werror=suggest-override]
     virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT
                    ^~~~~~~~~~~~~~~~~~~
include/boost/smart_ptr/detail/sp_counted_impl.hpp: In instantiation of ‘class boost::detail::sp_counted_impl_p, std::allocator >, char, std::char_traits, std::allocator, boost::iostreams::input>::chain_impl>’:
include/boost/smart_ptr/detail/shared_count.hpp:145:19:   required from ‘boost::detail::shared_count::shared_count(Y*) [with Y = boost::iostreams::detail::chain_base, std::allocator >, char, std::char_traits, std::allocator, boost::iostreams::input>::chain_impl]’
include/boost/smart_ptr/shared_ptr.hpp:285:20:   required from ‘void boost::detail::sp_pointer_construct(boost::shared_ptr*, Y*, boost::detail::shared_count&) [with T = boost::iostreams::detail::chain_base, std::allocator >, char, std::char_traits, std::allocator, boost::iostreams::input>::chain_impl; Y = boost::iostreams::detail::chain_base, std::allocator >, char, std::char_traits, std::allocator, boost::iostreams::input>::chain_impl]’
include/boost/smart_ptr/shared_ptr.hpp:379:44:   required from ‘boost::shared_ptr::shared_ptr(Y*) [with Y = boost::iostreams::detail::chain_base, std::allocator >, char, std::char_traits, std::allocator, boost::iostreams::input>::chain_impl; T = boost::iostreams::detail::chain_base, std::allocator >, char, std::char_traits, std::allocator, boost::iostreams::input>::chain_impl]’
include/boost/iostreams/chain.hpp:131:41:   required from ‘boost::iostreams::detail::chain_base::chain_base() [with Self = boost::iostreams::chain, std::allocator >; Ch = char; Tr = std::char_traits; Alloc = std::allocator; Mode = boost::iostreams::input]’
include/boost/iostreams/chain.hpp:431:1:   required from ‘boost::iostreams::chain::chain() [with Mode = boost::iostreams::input; Ch = char; Tr = std::char_traits; Alloc = std::allocator]’
include/boost/iostreams/detail/streambuf/chainbuf.hpp:53:16:   required from ‘boost::iostreams::detail::chainbuf::chainbuf() [with Chain = boost::iostreams::chain, std::allocator >; Mode = boost::iostreams::input; Access = boost::iostreams::public_]’
include/boost/iostreams/filtering_streambuf.hpp:60:1:   required from ‘boost::iostreams::filtering_streambuf::filtering_streambuf() [with Mode = boost::iostreams::input; Ch = char; Tr = std::char_traits; Alloc = std::allocator; Access = boost::iostreams::public_]’
:   required from here
include/boost/smart_ptr/detail/sp_counted_impl.hpp:88:18: error: ‘void boost::detail::sp_counted_impl_p::dispose() [with X = boost::iostreams::detail::chain_base, std::allocator >, char, std::char_traits, std::allocator, boost::iostreams::input>::chain_impl]’ can be marked override [-Werror=suggest-override]
     virtual void dispose() BOOST_SP_NOEXCEPT
                  ^~~~~~~
include/boost/smart_ptr/detail/sp_counted_impl.hpp:96:20: error: ‘void* boost::detail::sp_counted_impl_p::get_deleter(const sp_typeinfo_&) [with X = boost::iostreams::detail::chain_base, std::allocator >, char, std::char_traits, std::allocator, boost::iostreams::input>::chain_impl; boost::detail::sp_typeinfo_ = std::type_info]’ can be marked override [-Werror=suggest-override]
     virtual void * get_deleter( sp_typeinfo_ const & ) BOOST_SP_NOEXCEPT
                    ^~~~~~~~~~~
include/boost/smart_ptr/detail/sp_counted_impl.hpp:101:20: error: ‘void* boost::detail::sp_counted_impl_p::get_local_deleter(const sp_typeinfo_&) [with X = boost::iostreams::detail::chain_base, std::allocator >, char, std::char_traits, std::allocator, boost::iostreams::input>::chain_impl; boost::detail::sp_typeinfo_ = std::type_info]’ can be marked override [-Werror=suggest-override]
     virtual void * get_local_deleter( sp_typeinfo_ const & ) BOOST_SP_NOEXCEPT
                    ^~~~~~~~~~~~~~~~~
include/boost/smart_ptr/detail/sp_counted_impl.hpp:106:20: error: ‘void* boost::detail::sp_counted_impl_p::get_untyped_deleter() [with X = boost::iostreams::detail::chain_base, std::allocator >, char, std::char_traits, std::allocator, boost::iostreams::input>::chain_impl]’ can be marked override [-Werror=suggest-override]
     virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT
                    ^~~~~~~~~~~~~~~~~~~

@pdimov
Copy link
Member

pdimov commented Apr 5, 2020

Is there a program that I can compile that reproduces the warnings?

@EugeneZelenko
Copy link
Author

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";
    }
};

what() is virtual in base class.

Same is true for local_cb_destroy() and local_cb_get_shared_count() in local_counted_impl and local_counted_base

@EugeneZelenko
Copy link
Author

Clang-tidy modernize-use-override should also complain about such cases.

@pdimov
Copy link
Member

pdimov commented Apr 5, 2020

Godbolt probably includes Boost headers with -isystem.

@glenfe glenfe self-assigned this Apr 8, 2020
@EugeneZelenko
Copy link
Author

Related: boostorg/config#253

@EugeneZelenko
Copy link
Author

Complete list of warnings when Boost is built with -Wsuggest-overrideadded to cxxflags. Duplicated warnings from same location is omitted:

./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]

@pdimov
Copy link
Member

pdimov commented Apr 12, 2020

This one is interesting.

./boost/smart_ptr/detail/shared_count.hpp:634:67: warning: potential null pointer dereference [-Wnull-dereference]

@glenfe
Copy link
Member

glenfe commented Apr 13, 2020

Waiting on boostorg/config#329

@pdimov
Copy link
Member

pdimov commented Apr 13, 2020

Building what library cases the -Wnull-dereference warning?

@EugeneZelenko
Copy link
Author

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_ )
                                                                 ~~^~~

@pdimov
Copy link
Member

pdimov commented Apr 14, 2020

The override warnings should be fixed in develop.

@EugeneZelenko
Copy link
Author

Thank you for help! Please also delete virtual in overridden methods to keep Clang-tidy's modernize-use-override happy.

@glenfe glenfe removed their assignment Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants