fix __attribute__((constructor)) position

This commit is contained in:
tqcq 2024-04-29 21:47:20 +08:00
parent 563a1bfcfe
commit 4fcbba126a

View File

@ -61,13 +61,13 @@ private:
#define REGISTER_MODULE_INITIALIZER(name, body) \ #define REGISTER_MODULE_INITIALIZER(name, body) \
namespace { \ namespace { \
static void google_init_module_##name() __attribute__((constructor)) { body; } \ __attribute__((constructor)) static void google_init_module_##name() { body; } \
GoogleInitializer google_initializer_module_##name(#name, google_init_module_##name, NULL); \ GoogleInitializer google_initializer_module_##name(#name, google_init_module_##name, NULL); \
} }
#define REGISTER_MODULE_DESTRUCTOR(name, body) \ #define REGISTER_MODULE_DESTRUCTOR(name, body) \
namespace { \ namespace { \
static void google_destruct_module_##name() __attribute__((constructor)) { body; } \ __attribute__((constructor)) static void google_destruct_module_##name() { body; } \
GoogleInitializer google_destructor_module_##name(#name, NULL, google_destruct_module_##name); \ GoogleInitializer google_destructor_module_##name(#name, NULL, google_destruct_module_##name); \
} }