Skip to content

Commit

Permalink
Merge pull request #51 from bluescarni/pr/gcc_warnings
Browse files Browse the repository at this point in the history
Reduce spurious warnings
  • Loading branch information
bluescarni authored Mar 21, 2024
2 parents d08b18a + 8ae0bf5 commit 41fea96
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/gha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@ jobs:
- uses: actions/checkout@v4
- name: Build
run: bash tools/gha_conda_tidy.sh
# NOTE: this seems to be a temporary issue due to changes to the
# kernel config:
# https://github.com/actions/runner-images/issues/9491
# conda_asan:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Build
# run: bash tools/gha_conda_asan.sh
conda_asan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: bash tools/gha_conda_asan.sh
conda_ubsan:
runs-on: ubuntu-latest
steps:
Expand Down
25 changes: 20 additions & 5 deletions include/tanuki/tanuki.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,14 @@ inline constexpr bool is_any_wrap_v = false;
struct value_iface_base {
};

#if defined(__GNUC__) && !defined(__clang__)

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-final-methods"
#pragma GCC diagnostic ignored "-Wsuggest-final-types"

#endif

// Interface containing methods to interact
// with the value in the holder class.
// NOTE: we need to template value_iface on the semantics
Expand Down Expand Up @@ -313,6 +321,12 @@ struct TANUKI_VISIBLE value_iface : public IFace, value_iface_base {
#endif
};

#if defined(__GNUC__) && !defined(__clang__)

#pragma GCC diagnostic pop

#endif

// Concept to detect if a type is default initialisable without throwing.
template <typename T>
concept nothrow_default_initializable
Expand Down Expand Up @@ -354,7 +368,8 @@ concept any_wrap = detail::is_any_wrap_v<T>;

// Concept checking for value types. Must be non-cv qualified destructible objects.
template <typename T>
concept valid_value_type = std::is_object_v<T> && (!std::is_const_v<T>)&&(!std::is_volatile_v<T>)&&std::destructible<T>;
concept valid_value_type
= std::is_object_v<T> && (!std::is_const_v<T>) && (!std::is_volatile_v<T>) && std::destructible<T>;

namespace detail
{
Expand Down Expand Up @@ -873,15 +888,15 @@ struct cfg_ref_type<config<DefaultValueType, RefIFace>> {
#define TANUKI_REF_IFACE_MEMFUN(name) \
template <typename JustWrap = Wrap, typename... MemFunArgs> \
auto name(MemFunArgs &&...args) & noexcept( \
noexcept(iface_ptr(*static_cast<JustWrap *>(this))->name(std::forward<MemFunArgs>(args)...))) \
-> decltype(iface_ptr(*static_cast<JustWrap *>(this))->name(std::forward<MemFunArgs>(args)...)) \
noexcept(iface_ptr(*static_cast<JustWrap *>(this)) -> name(std::forward<MemFunArgs>(args)...))) \
->decltype(iface_ptr(*static_cast<JustWrap *>(this))->name(std::forward<MemFunArgs>(args)...)) \
{ \
return iface_ptr(*static_cast<Wrap *>(this))->name(std::forward<MemFunArgs>(args)...); \
} \
template <typename JustWrap = Wrap, typename... MemFunArgs> \
auto name(MemFunArgs &&...args) const & noexcept( \
noexcept(iface_ptr(*static_cast<const JustWrap *>(this))->name(std::forward<MemFunArgs>(args)...))) \
-> decltype(iface_ptr(*static_cast<const JustWrap *>(this))->name(std::forward<MemFunArgs>(args)...)) \
noexcept(iface_ptr(*static_cast<const JustWrap *>(this)) -> name(std::forward<MemFunArgs>(args)...))) \
->decltype(iface_ptr(*static_cast<const JustWrap *>(this))->name(std::forward<MemFunArgs>(args)...)) \
{ \
return iface_ptr(*static_cast<const Wrap *>(this))->name(std::forward<MemFunArgs>(args)...); \
} \
Expand Down

0 comments on commit 41fea96

Please sign in to comment.