forked from boostorg/unordered
extended Wshadow supression to foa::table
This commit is contained in:
committed by
Christian Mazakas
parent
2ef47f0813
commit
b3b840df30
@@ -991,41 +991,6 @@ _STL_RESTORE_DEPRECATED_WARNING
|
|||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(BOOST_GCC)
|
|
||||||
/* GCC's -Wshadow triggers at scenarios like this:
|
|
||||||
*
|
|
||||||
* struct foo{};
|
|
||||||
* template<typename Base>
|
|
||||||
* struct derived:Base
|
|
||||||
* {
|
|
||||||
* void f(){int foo;}
|
|
||||||
* };
|
|
||||||
*
|
|
||||||
* derived<foo>x;
|
|
||||||
* x.f(); // declaration of "foo" in derived::f shadows base type "foo"
|
|
||||||
*
|
|
||||||
* This makes shadowing warnings unavoidable in general when a class template
|
|
||||||
* derives from user-provided classes, as is the case with table_core and
|
|
||||||
* empty_value's below.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wshadow"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(BOOST_MSVC)
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable:4714) /* marked as __forceinline not inlined */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(BOOST_MSVC,<=1900)
|
|
||||||
/* VS2015 marks as unreachable generic catch clauses around non-throwing
|
|
||||||
* code.
|
|
||||||
*/
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable:4702)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* We expose the hard-coded max load factor so that tests can use it without
|
/* We expose the hard-coded max load factor so that tests can use it without
|
||||||
* needing to pull it from an instantiated class template such as the table
|
* needing to pull it from an instantiated class template such as the table
|
||||||
* class.
|
* class.
|
||||||
@@ -1084,6 +1049,21 @@ struct try_emplace_args_t{};
|
|||||||
* the element_type itself is moved.
|
* the element_type itself is moved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <boost/unordered/detail/foa/ignore_wshadow.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable:4714) /* marked as __forceinline not inlined */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BOOST_WORKAROUND(BOOST_MSVC,<=1900)
|
||||||
|
/* VS2015 marks as unreachable generic catch clauses around non-throwing
|
||||||
|
* code.
|
||||||
|
*/
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable:4702)
|
||||||
|
#endif
|
||||||
|
|
||||||
template<typename TypePolicy,typename Hash,typename Pred,typename Allocator>
|
template<typename TypePolicy,typename Hash,typename Pred,typename Allocator>
|
||||||
class
|
class
|
||||||
|
|
||||||
@@ -1878,9 +1858,7 @@ private:
|
|||||||
#pragma warning(pop) /* C4714 */
|
#pragma warning(pop) /* C4714 */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(BOOST_GCC)
|
#include <boost/unordered/detail/foa/restore_wshadow.hpp>
|
||||||
#pragma GCC diagnostic pop /* ignored "-Wshadow" */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} /* namespace foa */
|
} /* namespace foa */
|
||||||
} /* namespace detail */
|
} /* namespace detail */
|
||||||
|
35
include/boost/unordered/detail/foa/ignore_wshadow.hpp
Normal file
35
include/boost/unordered/detail/foa/ignore_wshadow.hpp
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
/* Copyright 2023 Joaquin M Lopez Munoz.
|
||||||
|
* Distributed under the Boost Software License, Version 1.0.
|
||||||
|
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
* http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
*
|
||||||
|
* See https://www.boost.org/libs/unordered for library home page.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_GCC)
|
||||||
|
#if !defined(BOOST_UNORDERED_DETAIL_RESTORE_WSHADOW)
|
||||||
|
/* GCC's -Wshadow triggers at scenarios like this:
|
||||||
|
*
|
||||||
|
* struct foo{};
|
||||||
|
* template<typename Base>
|
||||||
|
* struct derived:Base
|
||||||
|
* {
|
||||||
|
* void f(){int foo;}
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* derived<foo>x;
|
||||||
|
* x.f(); // declaration of "foo" in derived::f shadows base type "foo"
|
||||||
|
*
|
||||||
|
* This makes shadowing warnings unavoidable in general when a class template
|
||||||
|
* derives from user-provided classes, as is the case with foa::table_core
|
||||||
|
* deriving from empty_value.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wshadow"
|
||||||
|
#else
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
#endif
|
11
include/boost/unordered/detail/foa/restore_wshadow.hpp
Normal file
11
include/boost/unordered/detail/foa/restore_wshadow.hpp
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
/* Copyright 2023 Joaquin M Lopez Munoz.
|
||||||
|
* Distributed under the Boost Software License, Version 1.0.
|
||||||
|
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
* http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
*
|
||||||
|
* See https://www.boost.org/libs/unordered for library home page.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define BOOST_UNORDERED_DETAIL_RESTORE_WSHADOW
|
||||||
|
#include <boost/unordered/detail/foa/ignore_wshadow.hpp>
|
||||||
|
#undef BOOST_UNORDERED_DETAIL_RESTORE_WSHADOW
|
@@ -205,6 +205,8 @@ union uninitialized_storage
|
|||||||
* boost::unordered_[flat|node]_[map|set].
|
* boost::unordered_[flat|node]_[map|set].
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <boost/unordered/detail/foa/ignore_wshadow.hpp>
|
||||||
|
|
||||||
template<typename TypePolicy,typename Hash,typename Pred,typename Allocator>
|
template<typename TypePolicy,typename Hash,typename Pred,typename Allocator>
|
||||||
class table:table_core<TypePolicy,Hash,Pred,Allocator>
|
class table:table_core<TypePolicy,Hash,Pred,Allocator>
|
||||||
{
|
{
|
||||||
@@ -504,6 +506,8 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#include <boost/unordered/detail/foa/restore_wshadow.hpp>
|
||||||
|
|
||||||
} /* namespace foa */
|
} /* namespace foa */
|
||||||
} /* namespace detail */
|
} /* namespace detail */
|
||||||
} /* namespace unordered */
|
} /* namespace unordered */
|
||||||
|
Reference in New Issue
Block a user