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_test.c [LINT2]: Do not include gc_priv.h; include
config.h instead.
* tests/disclaim_test.c [LINT2] (GC_API_PRIV): Define.
* tests/disclaim_test.c [LINT2] (GC_random): Declare the function
(instead of including gc_priv.h to get the prototype).
#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 */
+
#ifdef LINT2
# undef rand
# define rand() (int)GC_random()
#include <stdio.h>
#include <string.h>
-#ifdef LINT2
- /* For GC_random() */
-# include "private/gc_priv.h"
-# undef rand
-# define rand() (int)GC_random()
-#elif defined(HAVE_CONFIG_H)
+#ifdef HAVE_CONFIG_H
/* For GC_[P]THREADS */
# include "config.h"
#endif
#undef GC_NO_THREAD_REDIRECTS
#include "gc_disclaim.h"
+#ifdef LINT2
+ /* Avoid include gc_priv.h. */
+# ifndef GC_API_PRIV
+# define GC_API_PRIV GC_API
+# endif
+ GC_API_PRIV long GC_random(void);
+# undef rand
+# define rand() (int)GC_random()
+#endif /* LINT2 */
+
#define my_assert(e) \
if (!(e)) { \
fflush(stdout); \