[Gc] Addition of printf args checking and minor other fixes
ivmai at mail.ru
Thu Jul 16 09:48:08 PDT 2009
GCC has 'format' attribute for checking arguments types for printf-like functions. I employed this feature to verify the correctness of GC_[log/err_]prinf() usage.
I found (and fixed) only one such error at present (only a few configurations were checked (so feedback is welcome...)).
I've also updated the comment for GC_finalize_all() matching the latest committed change of its functionality.
I've also made a number of non-functional changes like typos correction and export refinement of some private symbols (used in test.c only).
The whole patch (against CVS) is not dependent of my previous pending cumulative patches (diff78, diff88_cvs, diff99_cvs, diff100_cvs, diff101_cvs, diff102_cvs).
* alloc.c (GC_stopped_mark): Remove GC_log_printf("") (not needed
anymore and GCC produces a warning for it).
* alloc.c (GC_stopped_mark): Adjust printf argument type
* backgraph.c: Include dbg_mlc.h before ifdef MAKE_BACK_GRAPH (for
the case when the configuration information comes from aconfig
* checksums.c: Ditto (for gc_priv.h and CHECKSUMS, respectively).
* include/gc_allocator.h (GC_ATTR_UNUSED): Use "__unused__"
keyword instead of "unused".
* include/gc_allocator.h: Fix typos in comments.
* thread_local_alloc.c: Ditto.
* include/javaxfc.h (GC_finalize_all): Update comment.
* include/private/gc_priv.h (GC_API_PRIV): New macro (defined as
GC_API and serves only as a marker for the private but exported
symbols used by test.c only).
* include/private/gc_priv.h (GC_abort, GC_arrays, GC_is_marked,
GC_printf, GC_err_printf, GC_log_printf): Replace GC_API decl with
* include/private/gc_priv.h (GC_fo_entries): Don't export it
outside a DLL.
* include/private/gc_priv.h (GC_ATTR_FORMAT_PRINTF): New macro
designated to check the arguments correctness of printf-like
functions (currently works only for GCC v3+).
* include/private/gc_priv.h (GC_printf, GC_err_printf,
GC_log_printf): Use GC_ATTR_FORMAT_PRINTF attribute.
PS. I've also introduced two more GCC attributes for the GC API ('alloc_size' for better support of object size checking built-in mechanism, and 'malloc' for higher level of client code optimizations based on non-aliasing property of malloc-like functions result). I'll post the patch for these features a bit later.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 7132 bytes
Desc: not available
Url : http://napali.hpl.hp.com/pipermail/gc/attachments/20090716/b8f72496/koi8-rQdiff1035Fcvs.obj
More information about the Gc