Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/cata_compiler_support.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once

// Added due to clang 21.1 issue https://github.com/llvm/llvm-project/issues/154493
#if defined(__clang__) && __clang_major__ == 21 && __clang_minor__ <= 1
# define LAMBDA_NORETURN_CLANG21x1 __attribute__( ( noreturn ) )
#else
# define LAMBDA_NORETURN_CLANG21x1
#endif

// Added for MSVC optimizations
// ref: https://github.com/CleverRaven/Cataclysm-DDA/pull/75376
#ifndef CATA_FORCEINLINE
# ifdef _MSC_VER
# define CATA_FORCEINLINE __forceinline
# else
# define CATA_FORCEINLINE inline __attribute__( ( always_inline ) )
# endif
#endif // CATA_FORCEINLINE
13 changes: 0 additions & 13 deletions src/cata_inline.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/coordinates.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <utility>
#include <vector>

#include "cata_inline.h"
#include "cata_compiler_support.h"
#include "coords_fwd.h" // IWYU pragma: export
#include "cuboid_rectangle.h"
#include "debug.h"
Expand Down
4 changes: 3 additions & 1 deletion src/item_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "avatar.h"
#include "bodypart.h"
#include "cata_compiler_support.h"
#include "cata_utility.h"
#include "enums.h"
#include "flag.h"
Expand Down Expand Up @@ -37,7 +38,8 @@ static std::function< bool( const item & )> can_contain_filter( std::string_view
std::string_view filter, Unit max, std::vector<std::pair<std::string, Unit>> units,
std::function<item( itype *, Unit u )> set_function )
{
auto const error = [hint, filter]( char const *, size_t /* offset */ ) {
// TODO: LAMBDA_NORETURN_CLANG21x1 can be replaced with [[noreturn]] once we switch to C++23 on all compilers
auto const error = [hint, filter]( char const *, size_t /* offset */ ) LAMBDA_NORETURN_CLANG21x1 {
throw math::runtime_error( _( string_format( hint, filter ) ) );
};
// Start at max. On convert failure: results are empty and user knows it is unusable.
Expand Down
7 changes: 5 additions & 2 deletions src/math_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <vector>

#include "cata_assert.h"
#include "cata_compiler_support.h"
#include "cata_utility.h"
#include "condition.h"
#include "coordinates.h"
Expand Down Expand Up @@ -838,7 +839,8 @@ void math_exp::math_exp_impl::new_func()
{
output.emplace( std::in_place_type_t<func_jmath>(), std::move( params ), v );
},
[]( auto /* v */ )
// TODO: LAMBDA_NORETURN_CLANG21x1 can be replaced with [[noreturn]] once we switch to C++23 on all compilers
[]( auto /* v */ ) LAMBDA_NORETURN_CLANG21x1
{
throw math::internal_error( "Internal func error. That's all we know." );
},
Expand Down Expand Up @@ -975,7 +977,8 @@ void math_exp::math_exp_impl::new_oper()
type = math_type_t::assign;
output.emplace( std::in_place_type_t<ass_oper>(), lhs, mhs, rhs, v->f );
},
[]( auto /* v */ )
// TODO: LAMBDA_NORETURN_CLANG21x1 can be replaced with [[noreturn]] once we switch to C++23 on all compilers
[]( auto /* v */ ) LAMBDA_NORETURN_CLANG21x1
{
// we should never get here due to paren validation
throw math::internal_error( "Internal oper error. That's all we know." );
Expand Down
4 changes: 3 additions & 1 deletion src/math_parser_diag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include "bodypart.h"
#include "calendar.h"
#include "cata_compiler_support.h"
#include "cata_utility.h"
#include "character.h"
#include "character_id.h"
Expand Down Expand Up @@ -101,7 +102,8 @@ constexpr std::string_view _str_type_of()
template <typename T>
T _read_from_string( std::string_view s, const std::vector<std::pair<std::string, T>> &units )
{
auto const error = [s]( char const * suffix, size_t /* offset */ ) {
// TODO: LAMBDA_NORETURN_CLANG21x1 can be replaced with [[noreturn]] once we switch to C++23 on all compilers
auto const error = [s]( char const * suffix, size_t /* offset */ ) LAMBDA_NORETURN_CLANG21x1 {
throw math::runtime_error( R"(Failed to convert "%s" to a %s value: %s)", s,
_str_type_of<T>(), suffix );
};
Expand Down
4 changes: 3 additions & 1 deletion src/recipe_dictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "bodypart.h"
#include "calendar.h"
#include "cata_algo.h"
#include "cata_compiler_support.h"
#include "cata_utility.h"
#include "crafting_gui.h"
#include "debug.h"
Expand Down Expand Up @@ -215,7 +216,8 @@ template<typename Unit>
static Unit can_contain_filter( std::string_view hint, std::string_view txt, Unit max,
std::vector<std::pair<std::string, Unit>> units )
{
auto const error = [hint, txt]( char const *, size_t /* offset */ ) {
// TODO: LAMBDA_NORETURN_CLANG21x1 can be replaced with [[noreturn]] once we switch to C++23 on all compilers
auto const error = [hint, txt]( char const *, size_t /* offset */ ) LAMBDA_NORETURN_CLANG21x1 {
throw math::runtime_error( _( string_format( hint, txt ) ) );
};
// Start at max. On convert failure: results are empty and user knows it is unusable.
Expand Down
Loading