summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-09-26 09:48:39 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-09-26 15:49:18 +0300
commit8c5f0fc6c63a804c00a001dd093c0fa998b01485 (patch)
treec931f04780775547d81dac316e6e7c6f12f1c07a
parente6061ac46dc1ab64cdb747ce55baf6320bc08866 (diff)
downloadbdwgc-8c5f0fc6c63a804c00a001dd093c0fa998b01485.tar.gz
Include stdio.h and stdlib.h only from gc_priv.h
(refactoring) * allchblk.c: Do not include stdio.h directly. * alloc.c: Likewise. * dyn_load.c [(DYNAMIC_LOADING || MSWIN32 || MSWINCE || CYGWIN32) && !PCR]: Likewise. * mach_dep.c [!PLATFORM_MACH_DEP && !SN_TARGET_PSP2]: Likewise. * malloc.c: Likewise. * mallocx.c: Likewise. * mark.c: Likewise. * mark_rts.c: Likewise. * misc.c: Likewise. * new_hblk.c: Likewise. * os_dep.c: Likewise. * reclaim.c: Likewise. * tests/disclaim_bench.c: Likewise. * tests/gctest.c: Likewise. * dbg_mlc.c [KEEP_BACK_PTRS && !LINT2]: Do not include stdlib.h directly. * dyn_load.c [MSWIN32 || MSWINCE || CYGWIN32]: Likewise. * os_dep.c [HAIKU]: Likewise. * pthread_support.c [GC_PTHREADS && !GC_WIN32_THREADS]: Likewise. * tests/disclaim_bench.c: Likewise. * tests/gctest.c [!mips || !SYSTYPE_BSD43]: Likewise. * thread_local_alloc.c: Likewise. * include/private/gc_priv.h: Include stdio.h.
-rw-r--r--allchblk.c2
-rw-r--r--alloc.c1
-rw-r--r--dbg_mlc.c1
-rw-r--r--dyn_load.c3
-rw-r--r--include/private/gc_priv.h2
-rw-r--r--mach_dep.c2
-rw-r--r--malloc.c1
-rw-r--r--mallocx.c1
-rw-r--r--mark.c2
-rw-r--r--mark_rts.c2
-rw-r--r--misc.c1
-rw-r--r--new_hblk.c2
-rw-r--r--os_dep.c2
-rw-r--r--pthread_support.c1
-rw-r--r--reclaim.c2
-rw-r--r--tests/disclaim_bench.c2
-rw-r--r--tests/gctest.c6
-rw-r--r--thread_local_alloc.c2
18 files changed, 2 insertions, 33 deletions
diff --git a/allchblk.c b/allchblk.c
index d8bb7dbc..81c5af89 100644
--- a/allchblk.c
+++ b/allchblk.c
@@ -17,8 +17,6 @@
#include "private/gc_priv.h"
-#include <stdio.h>
-
#ifdef GC_USE_ENTIRE_HEAP
int GC_use_entire_heap = TRUE;
#else
diff --git a/alloc.c b/alloc.c
index 0dd64b8c..79a402eb 100644
--- a/alloc.c
+++ b/alloc.c
@@ -18,7 +18,6 @@
#include "private/gc_priv.h"
-#include <stdio.h>
#if !defined(MACOS) && !defined(MSWINCE)
# include <signal.h>
# if !defined(GC_NO_TYPES) && !defined(SN_TARGET_PSP2) \
diff --git a/dbg_mlc.c b/dbg_mlc.c
index 2fd1966e..4a1d774b 100644
--- a/dbg_mlc.c
+++ b/dbg_mlc.c
@@ -67,7 +67,6 @@
# define RANDOM() (long)GC_rand()
#else
-# include <stdlib.h>
# undef GC_RAND_MAX
# define GC_RAND_MAX RAND_MAX
diff --git a/dyn_load.c b/dyn_load.c
index e3976cf5..95c90ea8 100644
--- a/dyn_load.c
+++ b/dyn_load.c
@@ -68,7 +68,6 @@ STATIC GC_has_static_roots_func GC_has_static_roots = 0;
# error Additional SVR4 variants might not be too hard to add.
#endif
-#include <stdio.h>
#ifdef SOLARISDL
# include <sys/elf.h>
# include <dlfcn.h>
@@ -937,8 +936,6 @@ GC_INNER void GC_register_dynamic_libraries(void)
# if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
-# include <stdlib.h>
-
/* We traverse the entire address space and register all segments */
/* that could possibly have been written to. */
STATIC void GC_cond_add_roots(char *base, char * limit)
diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h
index 6d7d9c25..903d8b59 100644
--- a/include/private/gc_priv.h
+++ b/include/private/gc_priv.h
@@ -835,6 +835,8 @@ EXTERN_C_END
#include <setjmp.h>
+#include <stdio.h>
+
#if __STDC_VERSION__ >= 201112L
# include <assert.h> /* for static_assert */
#endif
diff --git a/mach_dep.c b/mach_dep.c
index f1761a1c..de0d67ad 100644
--- a/mach_dep.c
+++ b/mach_dep.c
@@ -17,8 +17,6 @@
#if !defined(PLATFORM_MACH_DEP) && !defined(SN_TARGET_PSP2)
-#include <stdio.h>
-
#ifdef AMIGA
# ifndef __GNUC__
# include <dos.h>
diff --git a/malloc.c b/malloc.c
index 65434f2d..de47776c 100644
--- a/malloc.c
+++ b/malloc.c
@@ -17,7 +17,6 @@
#include "private/gc_priv.h"
#include "gc/gc_inline.h" /* for GC_malloc_kind */
-#include <stdio.h>
#include <string.h>
/* Allocate reclaim list for the kind. Returns TRUE on success. */
diff --git a/mallocx.c b/mallocx.c
index eb54b859..bccab7cf 100644
--- a/mallocx.c
+++ b/mallocx.c
@@ -25,7 +25,6 @@
* executables. We should probably break this up further.
*/
-#include <stdio.h>
#include <string.h>
#ifndef MSWINCE
diff --git a/mark.c b/mark.c
index f54a63ef..06b69461 100644
--- a/mark.c
+++ b/mark.c
@@ -27,8 +27,6 @@
#include "private/gc_pmark.h"
-#include <stdio.h>
-
#if defined(MSWIN32) && defined(__GNUC__)
# include <excpt.h>
#endif
diff --git a/mark_rts.c b/mark_rts.c
index c999b7c6..d4bd6fb7 100644
--- a/mark_rts.c
+++ b/mark_rts.c
@@ -15,8 +15,6 @@
#include "private/gc_priv.h"
-#include <stdio.h>
-
/* Data structure for list of root sets. */
/* We keep a hash table, so that we can filter out duplicate additions. */
/* Under Win32, we need to do a better job of filtering overlaps, so */
diff --git a/misc.c b/misc.c
index 03e67a93..1fd76946 100644
--- a/misc.c
+++ b/misc.c
@@ -16,7 +16,6 @@
#include "private/gc_pmark.h"
-#include <stdio.h>
#include <limits.h>
#include <stdarg.h>
diff --git a/new_hblk.c b/new_hblk.c
index 41216699..83f5627d 100644
--- a/new_hblk.c
+++ b/new_hblk.c
@@ -21,8 +21,6 @@
* void GC_new_hblk(size, kind)
*/
-#include <stdio.h>
-
#ifndef SMALL_CONFIG
/* Build a free list for size 2 (words) cleared objects inside */
/* hblk h. Set the last link to be ofl. Return a pointer to the */
diff --git a/os_dep.c b/os_dep.c
index 242c0755..8e2d98eb 100644
--- a/os_dep.c
+++ b/os_dep.c
@@ -26,7 +26,6 @@
# endif
#endif
-#include <stdio.h>
#if defined(MSWINCE) || defined(SN_TARGET_PS3)
# define SIGSEGV 0 /* value is irrelevant */
#else
@@ -2549,7 +2548,6 @@ void * os2_alloc(size_t bytes)
#endif
#if defined(HAIKU)
-# include <stdlib.h>
ptr_t GC_haiku_get_mem(size_t bytes)
{
void* mem;
diff --git a/pthread_support.c b/pthread_support.c
index a45368a8..a344cc18 100644
--- a/pthread_support.c
+++ b/pthread_support.c
@@ -30,7 +30,6 @@
#if defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS)
-# include <stdlib.h>
# include <pthread.h>
# include <sched.h>
# include <time.h>
diff --git a/reclaim.c b/reclaim.c
index d3118a38..77d877ca 100644
--- a/reclaim.c
+++ b/reclaim.c
@@ -21,8 +21,6 @@
# include "gc/gc_disclaim.h"
#endif
-#include <stdio.h>
-
GC_INNER signed_word GC_bytes_found = 0;
/* Number of bytes of memory reclaimed */
/* minus the number of bytes originally */
diff --git a/tests/disclaim_bench.c b/tests/disclaim_bench.c
index 58f447e6..8525063d 100644
--- a/tests/disclaim_bench.c
+++ b/tests/disclaim_bench.c
@@ -12,8 +12,6 @@
*
*/
-#include <stdlib.h>
-#include <stdio.h>
#include <string.h>
#ifdef HAVE_CONFIG_H
diff --git a/tests/gctest.c b/tests/gctest.c
index 2b2b86a2..aefbaf93 100644
--- a/tests/gctest.c
+++ b/tests/gctest.c
@@ -47,12 +47,6 @@
/* In the single-threaded case, the number of times to rerun it. */
#endif
-# if defined(mips) && defined(SYSTYPE_BSD43)
- /* MIPS RISCOS 4 */
-# else
-# include <stdlib.h>
-# endif
-# include <stdio.h>
# if defined(_WIN32_WCE) && !defined(__GNUC__)
# include <winbase.h>
/* # define assert ASSERT */
diff --git a/thread_local_alloc.c b/thread_local_alloc.c
index bb2c2b4e..f127b105 100644
--- a/thread_local_alloc.c
+++ b/thread_local_alloc.c
@@ -22,8 +22,6 @@
#include "private/thread_local_alloc.h"
-#include <stdlib.h>
-
#if defined(USE_COMPILER_TLS)
__thread GC_ATTR_TLS_FAST
#elif defined(USE_WIN32_COMPILER_TLS)