From: Ivan Maidanski Date: Wed, 26 Jun 2019 13:26:28 +0000 (+0300) Subject: Fix 'const object must be initialized' MS VC error for debug_header_size X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=82b55dd5906f8b28a20810cbec9f4b623d15cca3;p=gc Fix 'const object must be initialized' MS VC error for debug_header_size (fix of commit 85e3083ff) * include/gc_mark.h (GC_debug_header_size): Do not use "const" keyword unless GC_BUILD; update comment. --- diff --git a/include/gc_mark.h b/include/gc_mark.h index acc3f083..6ff8ceec 100644 --- a/include/gc_mark.h +++ b/include/gc_mark.h @@ -161,8 +161,14 @@ GC_API GC_ATTR_CONST size_t GC_CALL GC_get_debug_header_size(void); ((void *)((char *)(p) + GC_get_debug_header_size())) /* The same but defined as a variable. Exists only for the backward */ -/* compatibility. */ -GC_API GC_ATTR_DEPRECATED const size_t GC_debug_header_size; +/* compatibility. Some compilers do not accept "const" together with */ +/* deprecated or dllimport attributes, so the symbol is exported as */ +/* a non-constant one. */ +GC_API GC_ATTR_DEPRECATED +# ifdef GC_BUILD + const +# endif + size_t GC_debug_header_size; /* And some routines to support creation of new "kinds", e.g. with */ /* custom mark procedures, by language runtimes. */