Skip to content

Commit 2c082b6

Browse files
masahir0yshuahkh
authored andcommitted
selftests: harness: rename __constructor_order for clarification
Now, __constructor_order is boolean; 1 for forward-order systems, 0 for backward-order systems while parsing __LIST_APPEND(). Change it into a bool variable, and rename it for clarification. Signed-off-by: Masahiro Yamada <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 2a6b6c9 commit 2c082b6

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

tools/testing/selftests/kselftest_harness.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@
818818
item->prev = item; \
819819
return; \
820820
} \
821-
if (__constructor_order == _CONSTRUCTOR_ORDER_FORWARD) { \
821+
if (__constructor_order_forward) { \
822822
item->next = NULL; \
823823
item->prev = head->prev; \
824824
item->prev->next = item; \
@@ -882,9 +882,7 @@ struct __test_xfail {
882882
}
883883

884884
static struct __fixture_metadata *__fixture_list = &_fixture_global;
885-
static int __constructor_order;
886-
887-
#define _CONSTRUCTOR_ORDER_FORWARD 1
885+
static bool __constructor_order_forward;
888886

889887
static inline void __register_fixture(struct __fixture_metadata *f)
890888
{
@@ -935,7 +933,7 @@ static inline bool __test_passed(struct __test_metadata *metadata)
935933
* list so tests are run in source declaration order.
936934
* https://gcc.gnu.org/onlinedocs/gccint/Initialization.html
937935
* However, it seems not all toolchains do this correctly, so use
938-
* __constructor_order to detect which direction is called first
936+
* __constructor_order_foward to detect which direction is called first
939937
* and adjust list building logic to get things running in the right
940938
* direction.
941939
*/
@@ -1330,7 +1328,7 @@ static int test_harness_run(int argc, char **argv)
13301328

13311329
static void __attribute__((constructor)) __constructor_order_first(void)
13321330
{
1333-
__constructor_order = _CONSTRUCTOR_ORDER_FORWARD;
1331+
__constructor_order_forward = true;
13341332
}
13351333

13361334
#endif /* __KSELFTEST_HARNESS_H */

0 commit comments

Comments
 (0)