}
#endif /* !SHORT_DBG_HDRS */
+#ifdef LINT2
+ long GC_random(void)
+ {
+ static unsigned seed = 1; /* not thread-safe */
+
+ /* Linear congruential pseudo-random numbers generator. */
+ seed = (seed * 1103515245U + 12345) & GC_RAND_MAX; /* overflow is ok */
+ return (long)seed;
+ }
+#endif
+
#ifdef KEEP_BACK_PTRS
+#ifdef LINT2
+# define RANDOM() GC_random()
+#else
# include <stdlib.h>
+# define GC_RAND_MAX RAND_MAX
# if defined(__GLIBC__) || defined(SOLARIS) \
|| defined(HPUX) || defined(IRIX5) || defined(OSF1)
# else
# define RANDOM() (long)rand()
# endif
+#endif /* !LINT2 */
/* Store back pointer to source in dest, if that appears to be possible. */
/* This is not completely safe, since we may mistakenly conclude that */
size_t i;
word heap_offset = RANDOM();
- if (GC_heapsize > RAND_MAX) {
- heap_offset *= RAND_MAX;
+ if (GC_heapsize > GC_RAND_MAX) {
+ heap_offset *= GC_RAND_MAX;
heap_offset += RANDOM();
}
heap_offset %= GC_heapsize;
GC_INNER void GC_generate_random_backtrace_no_gc(void);
#endif
+#ifdef LINT2
+# define GC_RAND_MAX (~0U >> 1)
+ GC_API_PRIV long GC_random(void);
+#endif
+
GC_EXTERN GC_bool GC_print_back_height;
#ifdef MAKE_BACK_GRAPH
#include "gc_disclaim.h"
+#ifdef LINT2
+# undef rand
+# define rand() (int)GC_random()
+#endif
+
#define my_assert(e) \
if (!(e)) { \
fprintf(stderr, "Assertion failure, line %d: " #e "\n", __LINE__); \
#include <stdio.h>
#include <string.h>
-#ifdef HAVE_CONFIG_H
+#ifdef LINT2
+ /* For GC_random() */
+# include "private/gc_priv.h"
+# undef rand
+# define rand() (int)GC_random()
+#elif defined(HAVE_CONFIG_H)
/* For GC_[P]THREADS */
# include "config.h"
#endif