Skip to content

Commit 4dd9b30

Browse files
committed
minor refactor
1 parent 20a1fcb commit 4dd9b30

File tree

14 files changed

+192
-111
lines changed

14 files changed

+192
-111
lines changed

docs/pages/intro.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,12 @@ probably worth a read just for context, though.
262262

263263
@section intro_getting_started Getting started
264264

265-
@subsubsection intro_getting_started_prerequisites Prerequisites
265+
@subsection intro_getting_started_prerequisites Prerequisites
266266

267267
- Using the generator: Python 3.9 or higher
268268
- Using the C++ library and/or generated code: C++17 or later
269269

270-
@subsubsection intro_getting_started_generator Installing soagen
270+
@subsection intro_getting_started_generator Installing soagen
271271

272272
[`soagen`] is a command-line application written in Python. Install it using `pip`:
273273

examples/entities.hpp

+5-8
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ SOAGEN_ENABLE_WARNINGS;
2828

2929
SOAGEN_PUSH_WARNINGS;
3030
SOAGEN_DISABLE_SPAM_WARNINGS;
31-
#if SOAGEN_CLANG >= 16
32-
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
33-
#endif
3431
#if SOAGEN_MSVC
3532
#pragma inline_recursion(on)
3633
#endif
@@ -622,7 +619,7 @@ namespace soagen::examples
622619
column_traits<2>::rvalue_type pos = {},
623620
column_traits<3>::rvalue_type orient = { 1, 0, 0, 0 }) //
624621
noexcept(table_traits::rvalue_push_back_is_nothrow<table_type&>)
625-
SOAGEN_REQUIRES(table_traits::rvalue_type_list_is_distinct) //
622+
SOAGEN_REQUIRES(table_traits::rvalue_type_list_is_distinct) //
626623
{
627624
table_.emplace_back(static_cast<column_traits<0>::rvalue_forward_type>(id),
628625
static_cast<column_traits<1>::rvalue_forward_type>(name),
@@ -640,7 +637,7 @@ namespace soagen::examples
640637
SOAGEN_CPP20_CONSTEXPR
641638
entities& emplace_back(Id&& id, Name&& name = "", Pos&& pos = {}, Orient&& orient = { 1, 0, 0, 0 }) //
642639
noexcept(table_traits::emplace_back_is_nothrow<table_type&, Id&&, Name&&, Pos&&, Orient&&>)
643-
SOAGEN_REQUIRES(table_traits::row_constructible_from<Id&&, Name&&, Pos&&, Orient&&>) //
640+
SOAGEN_REQUIRES(table_traits::row_constructible_from<Id&&, Name&&, Pos&&, Orient&&>) //
644641
{
645642
table_.emplace_back(static_cast<Id&&>(id),
646643
static_cast<Name&&>(name),
@@ -653,7 +650,7 @@ namespace soagen::examples
653650
template <typename Tuple SOAGEN_ENABLE_IF(
654651
(table_traits::row_constructible_from<Tuple&&> && table_traits::row_constructible_from<Tuple&&>))>
655652
SOAGEN_CPP20_CONSTEXPR
656-
entities& emplace_back(Tuple&& tuple_) //
653+
entities& emplace_back(Tuple&& tuple_) //
657654
noexcept(table_traits::emplace_back_is_nothrow<table_type&, Tuple&&>) SOAGEN_REQUIRES(
658655
table_traits::row_constructible_from<Tuple&&>&& table_traits::row_constructible_from<Tuple&&>) //
659656
{
@@ -680,7 +677,7 @@ namespace soagen::examples
680677
column_traits<2>::param_type pos = {},
681678
column_traits<3>::param_type orient = { 1, 0, 0, 0 }) //
682679
noexcept(table_traits::insert_is_nothrow<table_type&>)
683-
SOAGEN_REQUIRES(table_traits::all_move_constructible&& table_traits::all_move_assignable) //
680+
SOAGEN_REQUIRES(table_traits::all_move_constructible&& table_traits::all_move_assignable) //
684681
{
685682
table_.emplace(index_,
686683
static_cast<column_traits<0>::param_forward_type>(id),
@@ -726,7 +723,7 @@ namespace soagen::examples
726723
column_traits<2>::param_type pos = {},
727724
column_traits<3>::param_type orient = { 1, 0, 0, 0 }) //
728725
noexcept(table_traits::insert_is_nothrow<table_type&>)
729-
SOAGEN_REQUIRES(table_traits::all_move_constructible&& table_traits::all_move_assignable) //
726+
SOAGEN_REQUIRES(table_traits::all_move_constructible&& table_traits::all_move_assignable) //
730727
{
731728
table_.emplace(static_cast<size_type>(iter_),
732729
static_cast<column_traits<0>::param_forward_type>(id),

examples/shapes.hpp

+9-12
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ SOAGEN_ENABLE_WARNINGS;
2727

2828
SOAGEN_PUSH_WARNINGS;
2929
SOAGEN_DISABLE_SPAM_WARNINGS;
30-
#if SOAGEN_CLANG >= 16
31-
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
32-
#endif
3330
#if SOAGEN_MSVC
3431
#pragma inline_recursion(on)
3532
#endif
@@ -772,7 +769,7 @@ namespace soagen::examples
772769
template <typename Tuple SOAGEN_ENABLE_IF(
773770
(table_traits::row_constructible_from<Tuple&&> && table_traits::row_constructible_from<Tuple&&>))>
774771
SOAGEN_CPP20_CONSTEXPR
775-
boxes& emplace_back(Tuple&& tuple_) //
772+
boxes& emplace_back(Tuple&& tuple_) //
776773
noexcept(table_traits::emplace_back_is_nothrow<table_type&, Tuple&&>) SOAGEN_REQUIRES(
777774
table_traits::row_constructible_from<Tuple&&>&& table_traits::row_constructible_from<Tuple&&>) //
778775
{
@@ -800,7 +797,7 @@ namespace soagen::examples
800797
column_traits<3>::param_type extents_x = 0.5,
801798
column_traits<4>::param_type extents_y = 0.5,
802799
column_traits<5>::param_type extents_z = 0.5,
803-
column_traits<6>::param_type mass = default_mass) //
800+
column_traits<6>::param_type mass = default_mass) //
804801
noexcept(table_traits::insert_is_nothrow<table_type&>)
805802
SOAGEN_REQUIRES(table_traits::all_move_constructible&& table_traits::all_move_assignable) //
806803
{
@@ -829,7 +826,7 @@ namespace soagen::examples
829826
column_traits<3>::param_type extents_x = 0.5,
830827
column_traits<4>::param_type extents_y = 0.5,
831828
column_traits<5>::param_type extents_z = 0.5,
832-
column_traits<6>::param_type mass = default_mass) //
829+
column_traits<6>::param_type mass = default_mass) //
833830
noexcept(table_traits::insert_is_nothrow<table_type&>)
834831
SOAGEN_REQUIRES(table_traits::all_move_constructible&& table_traits::all_move_assignable) //
835832
{
@@ -860,7 +857,7 @@ namespace soagen::examples
860857
column_traits<5>::param_type extents_z = 0.5,
861858
column_traits<6>::param_type mass = default_mass) //
862859
noexcept(table_traits::insert_is_nothrow<table_type&>)
863-
SOAGEN_REQUIRES(table_traits::all_move_constructible&& table_traits::all_move_assignable) //
860+
SOAGEN_REQUIRES(table_traits::all_move_constructible&& table_traits::all_move_assignable) //
864861
{
865862
table_.emplace(static_cast<size_type>(iter_),
866863
static_cast<column_traits<0>::param_forward_type>(center_x),
@@ -2121,7 +2118,7 @@ namespace soagen::examples
21212118
column_traits<3>::rvalue_type radius = 0.5,
21222119
column_traits<4>::rvalue_type mass = default_mass) //
21232120
noexcept(table_traits::rvalue_push_back_is_nothrow<table_type&>)
2124-
SOAGEN_REQUIRES(table_traits::rvalue_type_list_is_distinct) //
2121+
SOAGEN_REQUIRES(table_traits::rvalue_type_list_is_distinct) //
21252122
{
21262123
table_.emplace_back(static_cast<column_traits<0>::rvalue_forward_type>(center_x),
21272124
static_cast<column_traits<1>::rvalue_forward_type>(center_y),
@@ -2161,7 +2158,7 @@ namespace soagen::examples
21612158
template <typename Tuple SOAGEN_ENABLE_IF(
21622159
(table_traits::row_constructible_from<Tuple&&> && table_traits::row_constructible_from<Tuple&&>))>
21632160
SOAGEN_CPP20_CONSTEXPR
2164-
spheres& emplace_back(Tuple&& tuple_) //
2161+
spheres& emplace_back(Tuple&& tuple_) //
21652162
noexcept(table_traits::emplace_back_is_nothrow<table_type&, Tuple&&>) SOAGEN_REQUIRES(
21662163
table_traits::row_constructible_from<Tuple&&>&& table_traits::row_constructible_from<Tuple&&>) //
21672164
{
@@ -2187,7 +2184,7 @@ namespace soagen::examples
21872184
column_traits<1>::param_type center_y,
21882185
column_traits<2>::param_type center_z,
21892186
column_traits<3>::param_type radius = 0.5,
2190-
column_traits<4>::param_type mass = default_mass) //
2187+
column_traits<4>::param_type mass = default_mass) //
21912188
noexcept(table_traits::insert_is_nothrow<table_type&>)
21922189
SOAGEN_REQUIRES(table_traits::all_move_constructible&& table_traits::all_move_assignable) //
21932190
{
@@ -2212,7 +2209,7 @@ namespace soagen::examples
22122209
column_traits<1>::param_type center_y,
22132210
column_traits<2>::param_type center_z,
22142211
column_traits<3>::param_type radius = 0.5,
2215-
column_traits<4>::param_type mass = default_mass) //
2212+
column_traits<4>::param_type mass = default_mass) //
22162213
noexcept(table_traits::insert_is_nothrow<table_type&>)
22172214
SOAGEN_REQUIRES(table_traits::all_move_constructible&& table_traits::all_move_assignable) //
22182215
{
@@ -2239,7 +2236,7 @@ namespace soagen::examples
22392236
column_traits<3>::param_type radius = 0.5,
22402237
column_traits<4>::param_type mass = default_mass) //
22412238
noexcept(table_traits::insert_is_nothrow<table_type&>)
2242-
SOAGEN_REQUIRES(table_traits::all_move_constructible&& table_traits::all_move_assignable) //
2239+
SOAGEN_REQUIRES(table_traits::all_move_constructible&& table_traits::all_move_assignable) //
22432240
{
22442241
table_.emplace(static_cast<size_type>(iter_),
22452242
static_cast<column_traits<0>::param_forward_type>(center_x),

src/soagen/header_file.py

-3
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ def write(self, o: Writer):
133133
rf'''
134134
SOAGEN_PUSH_WARNINGS;
135135
SOAGEN_DISABLE_SPAM_WARNINGS;
136-
#if SOAGEN_CLANG >= 16
137-
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
138-
#endif
139136
#if SOAGEN_MSVC
140137
#pragma inline_recursion(on)
141138
#endif

src/soagen/hpp/core.hpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ SOAGEN_ENABLE_WARNINGS;
5454
}; \
5555
\
5656
template <typename T, template <typename> typename Transformation = soagen::identity_type> \
57-
struct named_member_##Name \
57+
struct named_ref_##Name \
5858
{ \
5959
Transformation<T> Name; \
6060
\
6161
protected: \
6262
SOAGEN_PURE_INLINE_GETTER \
63-
constexpr decltype(auto) get_named_member() const noexcept \
63+
constexpr decltype(auto) get_ref() const noexcept \
6464
{ \
6565
if constexpr (std::is_reference_v<Transformation<T>>) \
6666
return static_cast<Transformation<T>>(Name); \
@@ -78,23 +78,23 @@ SOAGEN_ENABLE_WARNINGS;
7878
\
7979
template <> \
8080
struct column_ref<Table&, Column> \
81-
: named_member_##Name<std::add_lvalue_reference_t<soagen::value_type<Table, static_cast<size_t>(Column)>>> \
81+
: named_ref_##Name<std::add_lvalue_reference_t<soagen::value_type<Table, static_cast<size_t>(Column)>>> \
8282
{}; \
8383
\
8484
template <> \
8585
struct column_ref<Table&&, Column> \
86-
: named_member_##Name<std::add_rvalue_reference_t<soagen::value_type<Table, static_cast<size_t>(Column)>>> \
86+
: named_ref_##Name<std::add_rvalue_reference_t<soagen::value_type<Table, static_cast<size_t>(Column)>>> \
8787
{}; \
8888
\
8989
template <> \
9090
struct column_ref<const Table&, Column> \
91-
: named_member_##Name<std::add_lvalue_reference_t< \
91+
: named_ref_##Name<std::add_lvalue_reference_t< \
9292
std::add_const_t<soagen::value_type<Table, static_cast<size_t>(Column)>>>> \
9393
{}; \
9494
\
9595
template <> \
9696
struct column_ref<const Table&&, Column> \
97-
: named_member_##Name<std::add_rvalue_reference_t< \
97+
: named_ref_##Name<std::add_rvalue_reference_t< \
9898
std::add_const_t<soagen::value_type<Table, static_cast<size_t>(Column)>>>> \
9999
{}
100100
#endif

src/soagen/hpp/generated/preprocessor.hpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,13 @@
648648
#else
649649
#define SOAGEN_DISABLE_SPAM_WARNINGS_CLANG_13 static_assert(true)
650650
#endif
651+
#if SOAGEN_CLANG >= 16
652+
#define SOAGEN_DISABLE_SPAM_WARNINGS_CLANG_16 \
653+
_Pragma("clang diagnostic ignored \"-Wunsafe-buffer-usage\"") \
654+
static_assert(true)
655+
#else
656+
#define SOAGEN_DISABLE_SPAM_WARNINGS_CLANG_16 static_assert(true)
657+
#endif
651658
#define SOAGEN_DISABLE_SPAM_WARNINGS \
652659
_Pragma("clang diagnostic ignored \"-Wc++98-compat-pedantic\"") \
653660
_Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \
@@ -666,11 +673,12 @@
666673
SOAGEN_DISABLE_SPAM_WARNINGS_CLANG_8; \
667674
SOAGEN_DISABLE_SPAM_WARNINGS_CLANG_9; \
668675
SOAGEN_DISABLE_SPAM_WARNINGS_CLANG_13; \
676+
SOAGEN_DISABLE_SPAM_WARNINGS_CLANG_16; \
669677
static_assert(true)
670678
#elif SOAGEN_MSVC
671679
#define SOAGEN_DISABLE_SPAM_WARNINGS \
672-
__pragma(warning(disable : 4127)) /* conditional expr is constant */ \
673-
__pragma(warning(disable : 4324)) /* structure was padded due to alignment specifier */ \
680+
__pragma(warning(disable : 4127)) /* conditional expr is constant */ \
681+
__pragma(warning(disable : 4324)) /* structure was padded due to alignment specifier */ \
674682
__pragma(warning(disable : 4348)) \
675683
__pragma(warning(disable : 4464)) /* relative include path contains '..' */ \
676684
__pragma(warning(disable : 4505)) /* unreferenced local function removed */ \

src/soagen/hpp/header_start.hpp

-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
//# push the current warning state
1313
SOAGEN_PUSH_WARNINGS;
1414
SOAGEN_DISABLE_SPAM_WARNINGS;
15-
#if SOAGEN_CLANG >= 16
16-
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
17-
#endif
1815

1916
//# disable windows.h min/max macro crimes
2017
#if SOAGEN_MSVC_LIKE

src/soagen/hpp/row.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ namespace soagen
112112
static_assert(static_cast<size_t>(Column) < table_traits_type<remove_cvref<Table>>::column_count,
113113
"column index out of range");
114114

115-
return detail::column_ref<Table, static_cast<size_t>(Column)>::get_named_member();
115+
return detail::column_ref<Table, static_cast<size_t>(Column)>::get_ref();
116116
}
117117

118118
// tuple protocol:
@@ -123,7 +123,7 @@ namespace soagen
123123
{
124124
static_assert(Member < sizeof...(Columns), "member index out of range");
125125

126-
return type_at_index<Member, detail::column_ref<Table, Columns>...>::get_named_member();
126+
return type_at_index<Member, detail::column_ref<Table, Columns>...>::get_ref();
127127
}
128128

129129
/// @name Equality

0 commit comments

Comments
 (0)