From: Ivan Maidanski Date: Wed, 1 Feb 2012 19:58:59 +0000 (+0400) Subject: Tag deprecated variables in GC API with the corresponding attribute X-Git-Tag: gc7_3alpha2~141 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bd87d7b64b5ed762c48ecf4c182142324c880f3c;p=gc Tag deprecated variables in GC API with the corresponding attribute * include/gc.h (GC_gc_no, GC_parallel, GC_oom_fn, GC_on_heap_resize, GC_find_leak, GC_all_interior_pointers, GC_finalize_on_demand, GC_java_finalization, GC_finalizer_notifier, GC_dont_gc, GC_dont_expand, GC_use_entire_heap, GC_full_freq, GC_non_gc_bytes, GC_no_dls, GC_free_space_divisor, GC_max_retries, GC_get_max_retries, GC_stackbottom, GC_dont_precollect, GC_time_limit): Add GC_ATTR_DEPRECATED attribute. * include/gc_config_macros.h (GC_ATTR_DEPRECATED): Add new attribute for tagging deprecated symbols (support GCC v4+ and MS VC v12+). --- diff --git a/include/gc.h b/include/gc.h index 8befce8d..8d7c0b56 100644 --- a/include/gc.h +++ b/include/gc.h @@ -72,7 +72,8 @@ GC_API unsigned GC_CALL GC_get_version(void); /* Public read-only variables */ /* The supplied getter functions are preferred for new code. */ -GC_API GC_word GC_gc_no;/* Counter incremented per collection. */ +GC_API GC_ATTR_DEPRECATED GC_word GC_gc_no; + /* Counter incremented per collection. */ /* Includes empty GCs at startup. */ GC_API GC_word GC_CALL GC_get_gc_no(void); /* GC_get_gc_no() is unsynchronized, so */ @@ -80,7 +81,7 @@ GC_API GC_word GC_CALL GC_get_gc_no(void); /* avoid data races on multiprocessors. */ #ifdef GC_THREADS - GC_API int GC_parallel; + GC_API GC_ATTR_DEPRECATED int GC_parallel; /* GC is parallelized for performance on */ /* multiprocessors. Currently set only */ /* implicitly if collector is built with */ @@ -104,7 +105,7 @@ GC_API GC_word GC_CALL GC_get_gc_no(void); /* The supplied setter and getter functions are preferred for new code. */ typedef void * (GC_CALLBACK * GC_oom_func)(size_t /* bytes_requested */); -GC_API GC_oom_func GC_oom_fn; +GC_API GC_ATTR_DEPRECATED GC_oom_func GC_oom_fn; /* When there is insufficient memory to satisfy */ /* an allocation request, we return */ /* (*GC_oom_fn)(size). By default this just */ @@ -118,7 +119,7 @@ GC_API void GC_CALL GC_set_oom_fn(GC_oom_func); GC_API GC_oom_func GC_CALL GC_get_oom_fn(void); typedef void (GC_CALLBACK * GC_on_heap_resize_proc)(GC_word /* new_size */); -GC_API GC_on_heap_resize_proc GC_on_heap_resize; +GC_API GC_ATTR_DEPRECATED GC_on_heap_resize_proc GC_on_heap_resize; /* Invoked when the heap grows or shrinks. */ /* Called with the world stopped (and the */ /* allocation lock held). May be 0. */ @@ -127,7 +128,7 @@ GC_API GC_on_heap_resize_proc GC_CALL GC_get_on_heap_resize(void); /* Both the supplied setter and the getter */ /* acquire the GC lock (to avoid data races). */ -GC_API int GC_find_leak; +GC_API GC_ATTR_DEPRECATED int GC_find_leak; /* Do not actually garbage collect, but simply */ /* report inaccessible memory that was not */ /* deallocated with GC_free. Initial value */ @@ -138,7 +139,7 @@ GC_API int GC_find_leak; GC_API void GC_CALL GC_set_find_leak(int); GC_API int GC_CALL GC_get_find_leak(void); -GC_API int GC_all_interior_pointers; +GC_API GC_ATTR_DEPRECATED int GC_all_interior_pointers; /* Arrange for pointers to object interiors to */ /* be recognized as valid. Typically should */ /* not be changed after GC initialization (in */ @@ -154,7 +155,7 @@ GC_API int GC_all_interior_pointers; GC_API void GC_CALL GC_set_all_interior_pointers(int); GC_API int GC_CALL GC_get_all_interior_pointers(void); -GC_API int GC_finalize_on_demand; +GC_API GC_ATTR_DEPRECATED int GC_finalize_on_demand; /* If nonzero, finalizers will only be run in */ /* response to an explicit GC_invoke_finalizers */ /* call. The default is determined by whether */ @@ -164,7 +165,7 @@ GC_API int GC_finalize_on_demand; GC_API void GC_CALL GC_set_finalize_on_demand(int); GC_API int GC_CALL GC_get_finalize_on_demand(void); -GC_API int GC_java_finalization; +GC_API GC_ATTR_DEPRECATED int GC_java_finalization; /* Mark objects reachable from finalizable */ /* objects in a separate post-pass. This makes */ /* it a bit safer to use non-topologically- */ @@ -177,7 +178,7 @@ GC_API void GC_CALL GC_set_java_finalization(int); GC_API int GC_CALL GC_get_java_finalization(void); typedef void (GC_CALLBACK * GC_finalizer_notifier_proc)(void); -GC_API GC_finalizer_notifier_proc GC_finalizer_notifier; +GC_API GC_ATTR_DEPRECATED GC_finalizer_notifier_proc GC_finalizer_notifier; /* Invoked by the collector when there are */ /* objects to be finalized. Invoked at most */ /* once per GC cycle. Never invoked unless */ @@ -190,7 +191,8 @@ GC_API GC_finalizer_notifier_proc GC_finalizer_notifier; GC_API void GC_CALL GC_set_finalizer_notifier(GC_finalizer_notifier_proc); GC_API GC_finalizer_notifier_proc GC_CALL GC_get_finalizer_notifier(void); -GC_API int GC_dont_gc; /* != 0 ==> Don't collect. In versions 6.2a1+, */ +GC_API GC_ATTR_DEPRECATED int GC_dont_gc; + /* != 0 ==> Don't collect. In versions 6.2a1+, */ /* this overrides explicit GC_gcollect() calls. */ /* Used as a counter, so that nested enabling */ /* and disabling work correctly. Should */ @@ -200,14 +202,14 @@ GC_API int GC_dont_gc; /* != 0 ==> Don't collect. In versions 6.2a1+, */ /* GC is disabled, GC_is_disabled() is */ /* preferred for new code. */ -GC_API int GC_dont_expand; - /* Don't expand the heap unless explicitly */ +GC_API GC_ATTR_DEPRECATED int GC_dont_expand; + /* Do not expand the heap unless explicitly */ /* requested or forced to. The setter and */ /* getter are unsynchronized. */ GC_API void GC_CALL GC_set_dont_expand(int); GC_API int GC_CALL GC_get_dont_expand(void); -GC_API int GC_use_entire_heap; +GC_API GC_ATTR_DEPRECATED int GC_use_entire_heap; /* Causes the non-incremental collector to use the */ /* entire heap before collecting. This was the only */ /* option for GC versions < 5.0. This sometimes */ @@ -218,7 +220,8 @@ GC_API int GC_use_entire_heap; /* frequencies, and hence fewer instructions executed */ /* in the collector. */ -GC_API int GC_full_freq; /* Number of partial collections between */ +GC_API GC_ATTR_DEPRECATED int GC_full_freq; + /* Number of partial collections between */ /* full collections. Matters only if */ /* GC_incremental is set. */ /* Full collections are also triggered if */ @@ -234,7 +237,7 @@ GC_API int GC_full_freq; /* Number of partial collections between */ GC_API void GC_CALL GC_set_full_freq(int); GC_API int GC_CALL GC_get_full_freq(void); -GC_API GC_word GC_non_gc_bytes; +GC_API GC_ATTR_DEPRECATED GC_word GC_non_gc_bytes; /* Bytes not considered candidates for */ /* collection. Used only to control scheduling */ /* of collections. Updated by */ @@ -247,7 +250,7 @@ GC_API GC_word GC_non_gc_bytes; GC_API void GC_CALL GC_set_non_gc_bytes(GC_word); GC_API GC_word GC_CALL GC_get_non_gc_bytes(void); -GC_API int GC_no_dls; +GC_API GC_ATTR_DEPRECATED int GC_no_dls; /* Don't register dynamic library data segments. */ /* Wizards only. Should be used only if the */ /* application explicitly registers all roots. */ @@ -259,7 +262,7 @@ GC_API int GC_no_dls; GC_API void GC_CALL GC_set_no_dls(int); GC_API int GC_CALL GC_get_no_dls(void); -GC_API GC_word GC_free_space_divisor; +GC_API GC_ATTR_DEPRECATED GC_word GC_free_space_divisor; /* We try to make sure that we allocate at */ /* least N/GC_free_space_divisor bytes between */ /* collections, where N is twice the number */ @@ -279,7 +282,7 @@ GC_API GC_word GC_free_space_divisor; GC_API void GC_CALL GC_set_free_space_divisor(GC_word); GC_API GC_word GC_CALL GC_get_free_space_divisor(void); -GC_API GC_word GC_max_retries; +GC_API GC_ATTR_DEPRECATED GC_word GC_max_retries; /* The maximum number of GCs attempted before */ /* reporting out of memory after heap */ /* expansion fails. Initially 0. */ @@ -291,7 +294,8 @@ GC_API void GC_CALL GC_set_max_retries(GC_word); GC_API GC_word GC_CALL GC_get_max_retries(void); -GC_API char *GC_stackbottom; /* Cool end of user stack. */ +GC_API GC_ATTR_DEPRECATED char *GC_stackbottom; + /* Cool end of user stack. */ /* May be set in the client prior to */ /* calling any GC_ routines. This */ /* avoids some overhead, and */ @@ -306,7 +310,8 @@ GC_API char *GC_stackbottom; /* Cool end of user stack. */ /* GC_call_with_gc_active() and */ /* GC_register_my_thread() instead. */ -GC_API int GC_dont_precollect; /* Don't collect as part of GC */ +GC_API GC_ATTR_DEPRECATED int GC_dont_precollect; + /* Do not collect as part of GC */ /* initialization. Should be set only */ /* if the client wants a chance to */ /* manually initialize the root set */ @@ -319,7 +324,7 @@ GC_API int GC_dont_precollect; /* Don't collect as part of GC */ GC_API void GC_CALL GC_set_dont_precollect(int); GC_API int GC_CALL GC_get_dont_precollect(void); -GC_API unsigned long GC_time_limit; +GC_API GC_ATTR_DEPRECATED unsigned long GC_time_limit; /* If incremental collection is enabled, */ /* We try to terminate collections */ /* after this many milliseconds. Not a */ diff --git a/include/gc_config_macros.h b/include/gc_config_macros.h index 0aab03b1..2139600a 100644 --- a/include/gc_config_macros.h +++ b/include/gc_config_macros.h @@ -243,6 +243,19 @@ # endif #endif +#ifndef GC_ATTR_DEPRECATED +# ifdef GC_BUILD +# undef GC_ATTR_DEPRECATED +# define GC_ATTR_DEPRECATED /* empty */ +# elif defined(__GNUC__) && __GNUC__ >= 4 +# define GC_ATTR_DEPRECATED __attribute__((__deprecated__)) +# elif defined(_MSC_VER) && _MSC_VER >= 12 +# define GC_ATTR_DEPRECATED __declspec(deprecated) +# else +# define GC_ATTR_DEPRECATED /* empty */ +# endif +#endif + #if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION >= 720 # define GC_ADD_CALLER # define GC_RETURN_ADDR (GC_word)__return_address