]> granicus.if.org Git - gc/commitdiff
Fix 'const object must be initialized' MS VC error for debug_header_size
authorIvan Maidanski <ivmai@mail.ru>
Wed, 26 Jun 2019 13:26:28 +0000 (16:26 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 26 Jun 2019 13:26:28 +0000 (16:26 +0300)
(fix of commit 85e3083ff)

* include/gc_mark.h (GC_debug_header_size): Do not use "const" keyword
unless GC_BUILD; update comment.

include/gc_mark.h

index acc3f083a5e19d43c6978490a664a1a931ae49da..6ff8ceecf91e32332b12d1a45650e9318def68b4 100644 (file)
@@ -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.                        */