From b60d97f428645f6efaa93bb1feb57044da146ab8 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Thu, 21 Sep 2023 11:08:49 +0800 Subject: [PATCH] gconstructor.h: Ensure [c|d]tor prototypes are present for MSVC This way, the generated GResource code won't choke if no prototypes are found when being built by clang-cl, which also goes the _MSC_VER >= 1500 route. Fixes clang-cl build of generated GResources code when building the appstream git checkout, which supported Windows recently, as the build there demands '-Werror,-Wmissing-prototypes'. Part-of: --- glib/gconstructor.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/glib/gconstructor.h b/glib/gconstructor.h index 29509e4a4..9d2554c5f 100644 --- a/glib/gconstructor.h +++ b/glib/gconstructor.h @@ -95,6 +95,7 @@ #define G_MSVC_CTOR(_func,_sym_prefix) \ static void _func(void); \ extern int (* _array ## _func)(void); \ + int _func ## _wrapper(void); \ int _func ## _wrapper(void) { _func(); g_slist_find (NULL, _array ## _func); return 0; } \ __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \ __pragma(section(".CRT$XCU",read)) \ @@ -103,6 +104,7 @@ #define G_MSVC_DTOR(_func,_sym_prefix) \ static void _func(void); \ extern int (* _array ## _func)(void); \ + int _func ## _constructor(void); \ int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL, _array ## _func); return 0; } \ __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \ __pragma(section(".CRT$XCU",read)) \