]> granicus.if.org Git - gc/commitdiff
Eliminate 'static GC_sysinfo definition has incomplete type' Clang warning
authorIvan Maidanski <ivmai@mail.ru>
Sat, 14 Sep 2019 09:00:38 +0000 (12:00 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Sat, 14 Sep 2019 09:00:38 +0000 (12:00 +0300)
Tentative definition of variable with internal linkage has incomplete
non-array type 'struct _SYSTEM_INFO'.

The warning observed only in single-threaded shared builds by Clang.

* include/private/gc_priv.h [MSWIN32 || MSWINCE || CYGWIN32]
(WIN32_LEAN_AND_MEAN, NOSERVICE): Define macro.
* include/private/gc_priv.h [MSWIN32 || MSWINCE || CYGWIN32]: Include
windows.h (wrapped into EXTERN_C_END/BEGIN) before GC_sysinfo
declaration.
* include/private/gc_priv.h [MSWIN32 || MSWINCE || CYGWIN32]
(_SYSTEM_INFO): Do not declare.
* include/private/gc_priv.h [MSWIN32 || MSWINCE || CYGWIN32]
(GC_sysinfo): Change type from struct _SYSTEM_INFO to SYSTEM_INFO.

include/private/gc_priv.h

index fdf59a2c3773c93e60682a714c31930da04bae73..32f80fb6ad97d91cd4a6ae7ffdb04f0200fa54e4 100644 (file)
@@ -1565,8 +1565,14 @@ GC_EXTERN size_t GC_page_size;
 #endif
 
 #if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
-  struct _SYSTEM_INFO;
-  GC_EXTERN struct _SYSTEM_INFO GC_sysinfo;
+# ifndef WIN32_LEAN_AND_MEAN
+#   define WIN32_LEAN_AND_MEAN 1
+# endif
+# define NOSERVICE
+  EXTERN_C_END
+# include <windows.h>
+  EXTERN_C_BEGIN
+  GC_EXTERN SYSTEM_INFO GC_sysinfo;
   GC_INNER GC_bool GC_is_heap_base(void *p);
 #endif