Skip to content

Commit 8fa239c

Browse files
committed
Move constant definitions of non POD object into cpp file.
It save space and fix the ODR violation.
1 parent 2bc5c3d commit 8fa239c

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

features/frameworks/utest/source/utest_types.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,20 @@ const char* utest::v1::stringify(utest::v1::status_t status)
114114
}
115115
return "Unknown Status";
116116
}
117+
118+
119+
const utest::v1::control_t utest::v1::CaseNext(REPEAT_NONE, TIMEOUT_NONE);
120+
121+
const utest::v1::control_t utest::v1::CaseNoRepeat(REPEAT_NONE);
122+
123+
const utest::v1::control_t utest::v1::CaseRepeatAll(REPEAT_ALL);
124+
125+
const utest::v1::control_t utest::v1::CaseRepeatHandler(REPEAT_HANDLER);
126+
127+
const utest::v1::control_t utest::v1::CaseNoTimeout(TIMEOUT_NONE);
128+
129+
const utest::v1::control_t utest::v1::CaseAwait(TIMEOUT_FOREVER);
130+
131+
const utest::v1::control_t utest::v1::CaseRepeat(CaseRepeatAll);
132+
133+
const utest::v1::control_t utest::v1::CaseRepeatHandlerOnly(CaseRepeatHandler);

features/frameworks/utest/utest/utest_types.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,19 +202,19 @@ namespace v1 {
202202
};
203203

204204
/// does not repeat this test case and immediately moves on to the next one without timeout
205-
const control_t CaseNext(REPEAT_NONE, TIMEOUT_NONE);
205+
extern const control_t CaseNext;
206206

207207
/// does not repeat this test case, moves on to the next one
208-
const control_t CaseNoRepeat(REPEAT_NONE);
208+
extern const control_t CaseNoRepeat;
209209
/// repeats the test case handler with calling teardown and setup handlers
210-
const control_t CaseRepeatAll(REPEAT_ALL);
210+
extern const control_t CaseRepeatAll;
211211
/// repeats only the test case handler without calling teardown and setup handlers
212-
const control_t CaseRepeatHandler(REPEAT_HANDLER);
212+
extern const control_t CaseRepeatHandler;
213213

214214
/// No timeout, immediately moves on to the next case, but allows repeats
215-
const control_t CaseNoTimeout(TIMEOUT_NONE);
215+
extern const control_t CaseNoTimeout;
216216
/// Awaits until the callback is validated and never times out. Use with caution!
217-
const control_t CaseAwait(TIMEOUT_FOREVER);
217+
extern const control_t CaseAwait;
218218
/// Alias class for asynchronous timeout control in milliseconds
219219
inline control_t CaseTimeout(uint32_t ms) { return ms; }
220220

@@ -341,8 +341,11 @@ namespace v1 {
341341

342342

343343
// deprecations
344-
__deprecated_message("Use CaseRepeatAll instead.") const control_t CaseRepeat = CaseRepeatAll;
345-
__deprecated_message("Use CaseRepeatHandler instead.") const control_t CaseRepeatHandlerOnly = CaseRepeatHandler;
344+
__deprecated_message("Use CaseRepeatAll instead.")
345+
extern const control_t CaseRepeat;
346+
347+
__deprecated_message("Use CaseRepeatHandler instead.")
348+
extern const control_t CaseRepeatHandlerOnly;
346349

347350
__deprecated_message("Use REASON_NONE instead.") const failure_reason_t FAILURE_NONE = REASON_NONE;
348351
__deprecated_message("Use REASON_UNKNOWN instead.") const failure_reason_t FAILURE_UNKNOWN = REASON_UNKNOWN;

0 commit comments

Comments
 (0)