ignore_wshadow.hpp 953 B

1234567891011121314151617181920212223242526272829303132333435
  1. /* Copyright 2023 Joaquin M Lopez Munoz.
  2. * Distributed under the Boost Software License, Version 1.0.
  3. * (See accompanying file LICENSE_1_0.txt or copy at
  4. * http://www.boost.org/LICENSE_1_0.txt)
  5. *
  6. * See https://www.boost.org/libs/unordered for library home page.
  7. */
  8. #include <boost/config.hpp>
  9. #if defined(BOOST_GCC)
  10. #if !defined(BOOST_UNORDERED_DETAIL_RESTORE_WSHADOW)
  11. /* GCC's -Wshadow triggers at scenarios like this:
  12. *
  13. * struct foo{};
  14. * template<typename Base>
  15. * struct derived:Base
  16. * {
  17. * void f(){int foo;}
  18. * };
  19. *
  20. * derived<foo>x;
  21. * x.f(); // declaration of "foo" in derived::f shadows base type "foo"
  22. *
  23. * This makes shadowing warnings unavoidable in general when a class template
  24. * derives from user-provided classes, as is the case with foa::table_core
  25. * deriving from empty_value.
  26. */
  27. #pragma GCC diagnostic push
  28. #pragma GCC diagnostic ignored "-Wshadow"
  29. #else
  30. #pragma GCC diagnostic pop
  31. #endif
  32. #endif