Make const ptr assign as function call in clang

- This can act as memory barrier in clang to avoid
  read before assign of a const ptr

Signed-off-by: LoveSy <shana@zju.edu.cn>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
YU Jincheng
2021-10-10 02:19:51 +08:00
committed by Denys Vlasenko
parent 04ad683bf9
commit 5156b24553
7 changed files with 38 additions and 12 deletions

View File

@@ -446,7 +446,7 @@ extern struct test_statics *BB_GLOBAL_CONST test_ptr_to_statics;
#define leaving (S.leaving )
#define INIT_S() do { \
ASSIGN_CONST_PTR(test_ptr_to_statics, xzalloc(sizeof(S))); \
XZALLOC_CONST_PTR(&test_ptr_to_statics, sizeof(S)); \
} while (0)
#define DEINIT_S() do { \
free(group_array); \