* allchblk.c (GC_allochblk_nth): Rename GC_PRIdPTR to WARN_PRIdPTR.
* alloc.c (GC_collect_or_expand): Likewise.
* include/private/gc_priv.h (GC_PRIdPTR): Likewise.
* pthread_support.c (start_mark_threads, GC_thr_init): Likewise.
* GC_thr_init (GC_delete_thread): Likewise.
* include/private/gc_priv.h (WARN): Add comment about argument format
specifier.
* include/private/gc_priv.h (GC_PRIdPTR): Remove commented out code;
refine comment.
if (++GC_large_alloc_warn_suppressed
>= GC_large_alloc_warn_interval) {
WARN("Repeated allocation of very large block "
- "(appr. size %" GC_PRIdPTR "):\n"
+ "(appr. size %" WARN_PRIdPTR "):\n"
"\tMay lead to memory leak and poor performance.\n",
size_needed);
GC_large_alloc_warn_suppressed = 0;
GC_gcollect_inner();
} else {
# if !defined(AMIGA) || !defined(GC_AMIGA_FASTALLOC)
- WARN("Out of Memory! Heap size: %" GC_PRIdPTR " MiB."
+ WARN("Out of Memory! Heap size: %" WARN_PRIdPTR " MiB."
" Returning NULL!\n", (GC_heapsize - GC_unmapped_bytes) >> 20);
# endif
RESTORE_CANCEL(cancel_state);
# endif
/* Print warning message, e.g. almost out of memory. */
+/* The argument (if any) format specifier should be: */
+/* "%s", "%p" or "%"WARN_PRIdPTR. */
#define WARN(msg, arg) (*GC_current_warn_proc)("GC Warning: " msg, \
(GC_word)(arg))
GC_EXTERN GC_warn_proc GC_current_warn_proc;
-/* Print format type macro for signed_word. Currently used for WARN() */
-/* only. This could be of use on Win64 but commented out since Win64 */
-/* is only a little-endian architecture (for now) and the WARN format */
-/* string is, possibly, processed on the client side, so non-standard */
-/* print type modifiers should be avoided (if possible). */
-#if defined(_MSC_VER) && defined(_WIN64) && !defined(GC_PRIdPTR)
-/* #define GC_PRIdPTR "I64d" */
-#endif
-
-#if !defined(GC_PRIdPTR) && (defined(_LLP64) || defined(__LLP64__) \
- || defined(_WIN64))
-/* #include <inttypes.h> */
-/* #define GC_PRIdPTR PRIdPTR */
-#endif
-
-#ifndef GC_PRIdPTR
+/* Print format type macro for decimal signed_word value passed WARN(). */
+/* This could be redefined for Win64 or LLP64, but typically should */
+/* not be done as the WARN format string is, possibly, processed on the */
+/* client side, so non-standard print type modifiers (like MS "I64d") */
+/* should be avoided here if possible. */
+#ifndef WARN_PRIdPTR
/* Assume sizeof(void *) == sizeof(long) (or a little-endian machine) */
-# define GC_PRIdPTR "ld"
+# define WARN_PRIdPTR "ld"
#endif
/* Get environment entry */
for (i = 0; i < GC_markers - 1; ++i) {
if (0 != REAL_FUNC(pthread_create)(GC_mark_threads + i, &attr,
GC_mark_thread, (void *)(word)i)) {
- WARN("Marker thread creation failed, errno = %" GC_PRIdPTR "\n",
+ WARN("Marker thread creation failed, errno = %" WARN_PRIdPTR "\n",
errno);
/* Don't try to create other marker threads. */
GC_markers = i + 1;
# endif
}
if (GC_nprocs <= 0) {
- WARN("GC_get_nprocs() returned %" GC_PRIdPTR "\n", GC_nprocs);
+ WARN("GC_get_nprocs() returned %" WARN_PRIdPTR "\n", GC_nprocs);
GC_nprocs = 2; /* assume dual-core */
# ifdef PARALLEL_MARK
GC_markers = 1;
GC_thread t = GC_lookup_thread_inner(id);
if (0 == t) {
- WARN("Removing nonexistent thread, id = %" GC_PRIdPTR "\n", id);
+ WARN("Removing nonexistent thread, id = %" WARN_PRIdPTR "\n", id);
} else {
GC_delete_gc_thread(t);
}