Skip to content

Commit

Permalink
fix -Wmaybe-uninitialized warnings via missing [[noreturn]] a…
Browse files Browse the repository at this point in the history
…nnotation
  • Loading branch information
wjakob committed Feb 12, 2024
1 parent 7614f47 commit ba0ed85
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
10 changes: 0 additions & 10 deletions include/nanobind/nb_cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -423,17 +423,7 @@ T cast(const detail::api<Derived> &value, bool convert = true) {
: (uint8_t) 0, nullptr))
detail::raise_cast_error();

// GCC misses that from_python will return or ensure orderly initialization
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif

return caster.operator detail::cast_t<T>();

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
}
}

Expand Down
2 changes: 1 addition & 1 deletion include/nanobind/nb_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ NB_CORE void fail(const char *fmt, ...) noexcept;
NB_CORE void raise_next_overload_if_null(void *p);

/// Raise nanobind::cast_error
NB_CORE void raise_cast_error();
[[noreturn]] NB_CORE void raise_cast_error();

// ========================================================================

Expand Down

0 comments on commit ba0ed85

Please sign in to comment.