[Gc] small bugs

Marco Maggi marco.maggi-ipsu at poste.it
Mon Aug 25 23:07:51 PDT 2008


Ciao,

I am using GC 7.1 released tarball.

* In "gc.h" the definitions:

| #   define GC_PRE_INCR3(x, n, type_of_result) \
|          ((type_of_result)GC_pre_incr(&(x), (n)*sizeof(*x))
| #   define GC_POST_INCR2(x, type_of_result) \
|          ((type_of_result)GC_post_incr(&(x), sizeof(*x))

lack the ending ")".

* In "gc.h" the definitions:

| #ifdef GC_DEBUG
| #   define GC_POST_INCR2(x, type_of_result) \
| 	((type_of_result)GC_post_incr(&(x), sizeof(*x)))
| #   ifdef __GNUC__
| #       define GC_POST_INCR(x, n) \
| 	    GC_POST_INCR3(x, typeof(x))
| #   endif
| #else	/* !GC_DEBUG */
| #   define GC_POST_INCR2(x, n, type_of_result) ((x)++)
| #   define GC_POST_INCR(x, n) ((x)++)
| #endif

are  not correct: both  GC_POST_INCR2 and  GC_POST_INCR3 are
mentioned; GC_POST_INCR makes no use of "n".

I would do:

| #ifdef GC_DEBUG
| #   define GC_POST_INCR3(x, n, type_of_result) \
| 	((type_of_result)GC_post_incr(&(x), (n)*sizeof(*x)))
| #   ifdef __GNUC__
| #       define GC_POST_INCR(x, n) \
| 	    GC_POST_INCR3(x, n, typeof(x))
| #   endif
| #else	/* !GC_DEBUG */
| #   define GC_POST_INCR3(x, n, type_of_result) \
|        ((x) += (n), (x) - (n))
| #   define GC_POST_INCR(x, n) ((x) += (n), (x) - (n))
| #endif

By the  way, IMHO "type_of_result" should be  used even when
"GC_DEBUG" is undefined.

* In "gc.h":

| void * GC_malloc_many(size_t lb);

and  some other  functions are  missing a  GC_API qualifier,
does this mean that they are not for public use?

* The  tutorial  on the  web  mentions a  "gc_local_alloc.h"
  header file  that I  do not see  in GC  7.1 (I only  see a
  "include/private/thread_local_alloc.h").

* The tutorial  on the web  mentions a "--enable-full_debug"
  configuration option,  but I see  only "--enable-gc-debug"
  in the output of "configure --help".

-- 
Marco Maggi

"Now feel the funk blast!"
Rage Against the Machine - "Calm like a bomb"





More information about the Gc mailing list