Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc7a7384

Browse files
2.0.2
enabled `-Wshadow` and `-Wold-style-cast`renamed `RC_<>` to `InstanceT<>`cleaned up excessive comment delimiters from `machine.hpp`
1 parentc616e7a commitc7a7384

File tree

23 files changed

+309
-1327
lines changed

23 files changed

+309
-1327
lines changed

‎CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
1818
if(MSVC)
1919
target_compile_options(${PROJECT_NAME}PRIVATE /W4 /WX)
2020
else()
21-
target_compile_options(${PROJECT_NAME}PRIVATE -Wall -Wextra -Werror -pedantic)
21+
target_compile_options(${PROJECT_NAME}PRIVATE -Werror -Wall -Wextra -Wpedantic -Wshadow -Wold-style-cast)
2222
endif()
2323

2424
add_test(NAME${PROJECT_NAME}COMMAND${PROJECT_NAME})

‎development/ffsm2/detail/containers/array.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct StaticArrayT<T, 0> final {
5656
using Item= T;
5757

5858
FFSM2_CONSTEXPR(11)StaticArrayT() =default;
59-
FFSM2_CONSTEXPR(11)StaticArrayT(const Item)noexcept{}
59+
FFSM2_CONSTEXPR(11)StaticArrayT(const Item)noexcept{}
6060
};
6161

6262
////////////////////////////////////////////////////////////////////////////////

‎development/ffsm2/detail/containers/array.inl‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ T&
1010
StaticArrayT<T, NC>::operator[] (const N index)noexcept{
1111
FFSM2_ASSERT(0 <= index && index < CAPACITY);
1212

13-
return _items[(Index)index];
13+
return _items[static_cast<Index>(index)];
1414
}
1515

1616
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -22,7 +22,7 @@ const T&
2222
StaticArrayT<T, NC>::operator[] (const N index)constnoexcept{
2323
FFSM2_ASSERT(0 <= index && index < CAPACITY);
2424

25-
return _items[(Index)index];
25+
return _items[static_cast<Index>(index)];
2626
}
2727

2828
//------------------------------------------------------------------------------
@@ -72,7 +72,7 @@ typename ArrayT<T, NC>::Item&
7272
ArrayT<T, NC>::operator[] (const N index)noexcept {
7373
FFSM2_ASSERT(0 <= index && index < CAPACITY);
7474

75-
return _items[(Index)index];
75+
return _items[static_cast<Index>(index)];
7676
}
7777

7878
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -84,7 +84,7 @@ const typename ArrayT<T, NC>::Item&
8484
ArrayT<T, NC>::operator[] (const N index)constnoexcept {
8585
FFSM2_ASSERT(0 <= index && index < CAPACITY);
8686

87-
return _items[(Index)index];
87+
return _items[static_cast<Index>(index)];
8888
}
8989

9090
//------------------------------------------------------------------------------

‎development/ffsm2/detail/containers/bit_array.inl‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ bool
3333
BitArrayT<NCapacity>::get(const TIndex index)constnoexcept {
3434
FFSM2_ASSERT(index < CAPACITY);
3535

36-
const Index unit =(Index)index /8;
37-
const Index bit =(Index)index %8;
36+
const Index unit =static_cast<Index>(index) /8;
37+
const Index bit =static_cast<Index>(index) %8;
3838
constuint8_t mask =1 << bit;
3939

4040
return (_storage[unit] & mask) !=0;
@@ -49,8 +49,8 @@ void
4949
BitArrayT<NCapacity>::set(const TIndex index)noexcept {
5050
FFSM2_ASSERT(index < CAPACITY);
5151

52-
const Index unit =(Index)index /8;
53-
const Index bit =(Index)index %8;
52+
const Index unit =static_cast<Index>(index) /8;
53+
const Index bit =static_cast<Index>(index) %8;
5454
constuint8_t mask =1 << bit;
5555

5656
_storage[unit] |= mask;
@@ -65,8 +65,8 @@ void
6565
BitArrayT<NCapacity>::clear(const TIndex index)noexcept {
6666
FFSM2_ASSERT(index < CAPACITY);
6767

68-
const Index unit =(Index)index /8;
69-
const Index bit =(Index)index %8;
68+
const Index unit =static_cast<Index>(index) /8;
69+
const Index bit =static_cast<Index>(index) %8;
7070
constuint8_t mask =1 << bit;
7171

7272
_storage[unit] &= ~mask;

‎development/ffsm2/detail/containers/task_list.hpp‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace detail {
88
#pragma pack(push, 1)
99

1010
structTaskBase {
11-
FFSM2_CONSTEXPR(11)TaskBase()noexcept{}
11+
FFSM2_CONSTEXPR(11)TaskBase()noexcept{}
1212

1313
FFSM2_CONSTEXPR(11)TaskBase(const StateID origin_,
1414
const StateID destination_)noexcept
@@ -53,27 +53,27 @@ struct TaskT final
5353

5454
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5555

56-
FFSM2_CONSTEXPR(14)TaskT()noexcept{
56+
FFSM2_CONSTEXPR(14)TaskT()noexcept{
5757
new (&storage) Payload{};
5858
}
5959

6060
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6161

62-
FFSM2_CONSTEXPR(14)TaskT(const StateIDorigin,
63-
const StateIDdestination,
62+
FFSM2_CONSTEXPR(14)TaskT(const StateIDorigin_,
63+
const StateIDdestination_,
6464
const Payload& payload)noexcept
65-
: TaskBase{origin, destination}
65+
: TaskBase{origin_, destination_}
6666
, payloadSet{true}
6767
{
6868
new (&storage) Payload{payload};
6969
}
7070

7171
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7272

73-
FFSM2_CONSTEXPR(14)TaskT(const StateIDorigin,
74-
const StateIDdestination,
73+
FFSM2_CONSTEXPR(14)TaskT(const StateIDorigin_,
74+
const StateIDdestination_,
7575
Payload&& payload)noexcept
76-
: TaskBase{origin, destination}
76+
: TaskBase{origin_, destination_}
7777
, payloadSet{true}
7878
{
7979
new (&storage) Payload{move(payload)};

‎development/ffsm2/detail/features/common.hpp‎

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ enum class StatusEvent : uint8_t {
4343
static
4444
inline
4545
constchar*
46-
stateName(const std::type_index stateType)noexcept{
46+
stateName(const std::type_index stateType)noexcept{
4747
constchar*const raw = stateType.name();
4848

4949
#if defined(_MSC_VER)
@@ -72,7 +72,7 @@ stateName(const std::type_index stateType) noexcept {
7272
static
7373
FFSM2_CONSTEXPR(14)
7474
constchar*
75-
methodName(const Method method)noexcept{
75+
methodName(const Method method)noexcept{
7676
switch (method) {
7777
case Method::ENTRY_GUARD:return"entryGuard";
7878
case Method::ENTER:return"enter";
@@ -135,17 +135,17 @@ struct alignas(4) TransitionBase {
135135

136136
FFSM2_CONSTEXPR(11)
137137
bool
138-
operator == (const TransitionBase& other)constnoexcept{
138+
operator == (const TransitionBase& other)constnoexcept{
139139
return origin == other.origin &&
140140
destination == other.destination &&
141141
method == other.method;
142142
}
143143

144-
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
144+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
145145

146146
FFSM2_CONSTEXPR(11)
147147
bool
148-
operator != (const TransitionBase& other)constnoexcept{
148+
operator != (const TransitionBase& other)constnoexcept{
149149
return origin != other.origin ||
150150
destination != other.destination ||
151151
method != other.method;
@@ -155,15 +155,15 @@ struct alignas(4) TransitionBase {
155155

156156
FFSM2_CONSTEXPR(11)
157157
explicit
158-
operatorbool()constnoexcept{
158+
operatorbool()constnoexcept{
159159
return destination != INVALID_STATE_ID;
160160
}
161161

162162
//----------------------------------------------------------------------
163163

164164
FFSM2_CONSTEXPR(14)
165165
void
166-
clear()noexcept{
166+
clear()noexcept{
167167
destination= INVALID_STATE_ID;
168168
}
169169

@@ -194,16 +194,16 @@ struct alignas(4) TransitionT final
194194
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
195195

196196
FFSM2_CONSTEXPR(14)
197-
TransitionT()noexcept{
197+
TransitionT()noexcept{
198198
new (&storage) Payload{};
199199
}
200200

201201
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
202202

203203
FFSM2_CONSTEXPR(14)
204-
TransitionT(const StateIDdestination,
204+
TransitionT(const StateIDdestination_,
205205
const Payload& payload)noexcept
206-
: TransitionBase{destination}
206+
: TransitionBase{destination_}
207207
, payloadSet{true}
208208
{
209209
new (&storage) Payload{payload};
@@ -212,9 +212,9 @@ struct alignas(4) TransitionT final
212212
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
213213

214214
FFSM2_CONSTEXPR(14)
215-
TransitionT(const StateIDdestination,
215+
TransitionT(const StateIDdestination_,
216216
Payload&& payload)noexcept
217-
: TransitionBase{destination}
217+
: TransitionBase{destination_}
218218
, payloadSet{true}
219219
{
220220
new (&storage) Payload{move(payload)};
@@ -223,10 +223,10 @@ struct alignas(4) TransitionT final
223223
//----------------------------------------------------------------------
224224

225225
FFSM2_CONSTEXPR(14)
226-
TransitionT(const StateIDorigin,
227-
const StateIDdestination,
226+
TransitionT(const StateIDorigin_,
227+
const StateIDdestination_,
228228
const Payload& payload)noexcept
229-
: TransitionBase{origin, destination}
229+
: TransitionBase{origin_, destination_}
230230
, payloadSet{true}
231231
{
232232
new (&storage) Payload{payload};
@@ -235,10 +235,10 @@ struct alignas(4) TransitionT final
235235
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
236236

237237
FFSM2_CONSTEXPR(14)
238-
TransitionT(const StateIDorigin,
239-
const StateIDdestination,
238+
TransitionT(const StateIDorigin_,
239+
const StateIDdestination_,
240240
Payload&& payload)noexcept
241-
: TransitionBase{origin, destination}
241+
: TransitionBase{origin_, destination_}
242242
, payloadSet{true}
243243
{
244244
new (&storage) Payload{move(payload)};
@@ -248,7 +248,7 @@ struct alignas(4) TransitionT final
248248

249249
FFSM2_CONSTEXPR(11)
250250
bool
251-
operator == (const TransitionT& other)constnoexcept{
251+
operator == (const TransitionT& other)constnoexcept{
252252
return TransitionBase::operator == (other) &&
253253
(payloadSet == other.payloadSet);
254254
// (!payloadSet && !other.payloadSet || payload == other.payload);
@@ -258,7 +258,7 @@ struct alignas(4) TransitionT final
258258

259259
FFSM2_CONSTEXPR(11)
260260
bool
261-
operator != (const TransitionT& other)constnoexcept{
261+
operator != (const TransitionT& other)constnoexcept{
262262
return TransitionBase::operator != (other) ||
263263
(payloadSet != other.payloadSet);
264264
// (payloadSet |= other.payloadSet || payload != other.payload);
@@ -268,7 +268,7 @@ struct alignas(4) TransitionT final
268268

269269
FFSM2_CONSTEXPR(11)
270270
const Payload*
271-
payload()constnoexcept{
271+
payload()constnoexcept{
272272
return payloadSet ?
273273
reinterpret_cast<const Payload*>(&storage) :nullptr;
274274
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp