[Gc] Removal of some private exports

Ivan Maidanski ivmai at mail.ru
Sat Nov 1 00:12:04 PST 2008


Hi!

Now I've changed GC_API_PRIV (introduced in my "diff28") to be defined as "GC_API" always (GC_API_PRIV now serves as a marker for, say, an undocumented (exported) API entries).

The patch does:
- change GC_API_PRIV definition (defined and used in "gc_priv.h" file);
- replace GC_API_PRIV specifier to "extern" for GC_allocate_ml and GC_need_to_lock vars (in "gc_locks.h" file) since they were exported as a part of "undocumented" API and are not used in tests anymore;
- replace GC_API_PRIV specifier to "extern" for GC_fo_entries, GC_make_closure(), GC_debug_invoke_finalizer(), GC_noop() (in "gc_priv.h" file) for same reason;
- change "ABORT(msg)" macro definition to DebugBreak() (instead of abort()) for Win32 SMALL_CONFIG targets (in "gc_priv.h" file);
- tests: add call to GC_INIT() in "test.c" also for THREAD_LOCAL_ALLOC and PARALLEL_MARK cases;
- tests: redefine FAIL macro to "ABORT(...)" (including for WinCE and SMALL_CONFIG targets) in "test.c" file;
- tests: replace GC_noop(x) calls (not exported now) in "test.c" file with calls to the exported GC_noop1() (declared either in "gc.h" or "gc_priv.h").

Bye.

-------------- next part --------------
diff -ru bdwgc/include/private/gc_locks.h updated/bdwgc/include/private/gc_locks.h
--- bdwgc/include/private/gc_locks.h	2008-10-29 12:06:51.000000000 +0300
+++ updated/bdwgc/include/private/gc_locks.h	2008-10-31 13:04:32.000000000 +0300
@@ -52,7 +52,7 @@
 #    include <windows.h>
 #    define NO_THREAD (DWORD)(-1)
      extern DWORD GC_lock_holder;
-     GC_API_PRIV CRITICAL_SECTION GC_allocate_ml;
+     extern CRITICAL_SECTION GC_allocate_ml;
 #    ifdef GC_ASSERTIONS
 #        define UNCOND_LOCK() \
 		{ EnterCriticalSection(&GC_allocate_ml); \
@@ -192,7 +192,7 @@
 # endif /* !THREADS */
 
 #if defined(UNCOND_LOCK) && !defined(LOCK) 
-     GC_API_PRIV GC_bool GC_need_to_lock;
+     extern GC_bool GC_need_to_lock;
      		/* At least two thread running; need to lock.	*/
 #    define LOCK() if (GC_need_to_lock) { UNCOND_LOCK(); }
 #    define UNLOCK() if (GC_need_to_lock) { UNCOND_UNLOCK(); }
diff -ru bdwgc/include/private/gc_priv.h updated/bdwgc/include/private/gc_priv.h
--- bdwgc/include/private/gc_priv.h	2008-10-29 12:17:32.000000000 +0300
+++ updated/bdwgc/include/private/gc_priv.h	2008-11-01 01:34:51.000000000 +0300
@@ -86,11 +86,7 @@
 #endif /* __GNUC__ */
 
 #ifndef GC_API_PRIV
-# ifndef NO_DEBUGGING
-#  define GC_API_PRIV GC_API
-# else
-#  define GC_API_PRIV extern
-# endif
+# define GC_API_PRIV GC_API
 #endif
 
 # ifndef GC_LOCKS_H
@@ -343,7 +339,11 @@
 #   define ABORT(s) PCR_Base_Panic(s)
 # else
 #   ifdef SMALL_CONFIG
-#	define ABORT(msg) abort()
+#	if defined(MSWIN32) || defined(MSWINCE)
+#	    define ABORT(msg) DebugBreak()
+#	else
+#	    define ABORT(msg) abort()
+#	endif
 #   else
 	GC_API_PRIV void GC_abort(const char * msg);
 #       define ABORT(msg) GC_abort(msg)
@@ -1187,7 +1187,7 @@
 
 extern unsigned GC_n_kinds;
 
-GC_API_PRIV word GC_fo_entries;
+extern word GC_fo_entries;
 
 extern word GC_n_heap_sects;	/* Number of separately added heap	*/
 				/* sections.				*/
@@ -1766,9 +1766,8 @@
 			/* finalizers to be run, and we haven't called	*/
 			/* this procedure yet this GC cycle.		*/
 
-GC_API_PRIV void * GC_make_closure(GC_finalization_proc fn, void * data);
-GC_API_PRIV void GC_CALLBACK GC_debug_invoke_finalizer(void * obj,
-							void * data);
+void * GC_make_closure(GC_finalization_proc fn, void * data);
+void GC_CALLBACK GC_debug_invoke_finalizer(void * obj, void * data);
 			/* Auxiliary fns to make finalization work	*/
 			/* correctly with displaced pointers introduced	*/
 			/* by the debugging allocators.			*/
@@ -1925,9 +1924,9 @@
     void GC_noop(void*, ...);
 # else
 #   ifdef __DMC__
-      GC_API_PRIV void GC_noop(...);
+      void GC_noop(...);
 #   else
-      GC_API_PRIV void GC_noop();
+      void GC_noop();
 #   endif
 # endif
 
diff -ru bdwgc/tests/test.c updated/bdwgc/tests/test.c
--- bdwgc/tests/test.c	2008-10-29 13:03:24.000000000 +0300
+++ updated/bdwgc/tests/test.c	2008-10-31 21:26:18.000000000 +0300
@@ -67,7 +67,8 @@
 
 /* Call GC_INIT only on platforms on which we think we really need it,	*/
 /* so that we can test automatic initialization on the rest.		*/
-#if defined(CYGWIN32) || defined (AIX) || defined(DARWIN)
+#if defined(CYGWIN32) || defined (AIX) || defined(DARWIN) \
+	|| defined(THREAD_LOCAL_ALLOC) || defined(PARALLEL_MARK)
 #  define GC_COND_INIT() GC_INIT()
 #else
 #  define GC_COND_INIT()
@@ -123,14 +124,7 @@
 # ifdef PCR
 #   define FAIL (void)abort()
 # else
-#   ifdef MSWINCE
-#     define FAIL DebugBreak()
-#   else
-#     ifdef SMALL_CONFIG
-	GC_API_PRIV void GC_abort(const char * msg);
-#     endif
-#     define FAIL GC_abort("Test failed");
-#   endif
+#   define FAIL ABORT("Test failed")
 # endif
 
 #endif /* !AMIGA_FASTALLOC */
@@ -861,8 +855,8 @@
         FAIL;
     }
     dropped_something = 1;
-    GC_noop(root);	/* Root needs to remain live until	*/
-    			/* dropped_something is set.		*/
+    GC_noop1((word)root);	/* Root needs to remain live until	*/
+				/* dropped_something is set.		*/
     root = mktree(TREE_HEIGHT);
     chktree(root, TREE_HEIGHT);
     for (i = TREE_HEIGHT; i >= 0; i--) {
@@ -962,7 +956,7 @@
         new = (GC_word *)(old[1]);
     }
     GC_gcollect();
-    GC_noop(x);
+    GC_noop1((word)x);
 }
 
 int fail_count = 0;


More information about the Gc mailing list