]> granicus.if.org Git - gc/commitdiff
Fix mixed include of GC public header and gc_priv.h in disclaim bench/test
authorIvan Maidanski <ivmai@mail.ru>
Thu, 30 Mar 2017 19:06:09 +0000 (22:06 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 7 Apr 2017 15:38:10 +0000 (18:38 +0300)
Include gc_priv.h should be avoided in tests (if possible) or, at
least, this include should not precede include of the public GC
headers (because, e.g., gc_priv.h define GC_BUILD which influences
declspec of the GC public symbols in case of a shared library).

* tests/disclaim_bench.c: Move include gc_priv.h to be after
gc_disclaim.h; add comment.
* tests/disclaim_bench.c [HAVE_CONFIG_H]: Include "config.h" (before
include gc_disclaim.h).

tests/disclaim_bench.c

index a2fc397276a0a435f99d99460e2037ce8cd7e70d..df10f9868358d6f592e27c33f463e0b6114cd6a5 100644 (file)
 #include <stdio.h>
 #include <string.h>
 
-#include "private/gc_priv.h"
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
 #include "gc_disclaim.h"
 
+/* Include gc_priv.h is done after including GC public headers, so      */
+/* that GC_BUILD has no effect on the public prototypes.                */
+#include "private/gc_priv.h" /* for CLOCK_TYPE and GC_random */
+
 #define my_assert(e) \
     if (!(e)) { \
         fprintf(stderr, "Assertion failure, line %d: " #e "\n", __LINE__); \