Skip to content

Commit 7f83e13

Browse files
committed
Fix clang 21 warnings
error: function 'operator()' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
1 parent d16ab19 commit 7f83e13

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/item_search.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static std::function< bool( const item & )> can_contain_filter( std::string_view
3737
std::string_view filter, Unit max, std::vector<std::pair<std::string, Unit>> units,
3838
std::function<item( itype *, Unit u )> set_function )
3939
{
40-
auto const error = [hint, filter]( char const *, size_t /* offset */ ) {
40+
auto const error = [hint, filter]( char const *, size_t /* offset */ ) __attribute__((noreturn)) {
4141
throw math::runtime_error( _( string_format( hint, filter ) ) );
4242
};
4343
// Start at max. On convert failure: results are empty and user knows it is unusable.

src/math_parser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ void math_exp::math_exp_impl::new_func()
838838
{
839839
output.emplace( std::in_place_type_t<func_jmath>(), std::move( params ), v );
840840
},
841-
[]( auto /* v */ )
841+
[]( auto /* v */ ) __attribute__((noreturn))
842842
{
843843
throw math::internal_error( "Internal func error. That's all we know." );
844844
},
@@ -975,7 +975,7 @@ void math_exp::math_exp_impl::new_oper()
975975
type = math_type_t::assign;
976976
output.emplace( std::in_place_type_t<ass_oper>(), lhs, mhs, rhs, v->f );
977977
},
978-
[]( auto /* v */ )
978+
[]( auto /* v */ ) __attribute__((noreturn))
979979
{
980980
// we should never get here due to paren validation
981981
throw math::internal_error( "Internal oper error. That's all we know." );

src/math_parser_diag.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ constexpr std::string_view _str_type_of()
101101
template <typename T>
102102
T _read_from_string( std::string_view s, const std::vector<std::pair<std::string, T>> &units )
103103
{
104-
auto const error = [s]( char const * suffix, size_t /* offset */ ) {
104+
auto const error = [s]( char const * suffix, size_t /* offset */ ) __attribute__((noreturn)) {
105105
throw math::runtime_error( R"(Failed to convert "%s" to a %s value: %s)", s,
106106
_str_type_of<T>(), suffix );
107107
};

src/recipe_dictionary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ template<typename Unit>
215215
static Unit can_contain_filter( std::string_view hint, std::string_view txt, Unit max,
216216
std::vector<std::pair<std::string, Unit>> units )
217217
{
218-
auto const error = [hint, txt]( char const *, size_t /* offset */ ) {
218+
auto const error = [hint, txt]( char const *, size_t /* offset */ ) __attribute__((noreturn)) {
219219
throw math::runtime_error( _( string_format( hint, txt ) ) );
220220
};
221221
// Start at max. On convert failure: results are empty and user knows it is unusable.

0 commit comments

Comments
 (0)