|
From: Nicholas N. <nj...@ca...> - 2004-08-09 09:14:36
|
Hi, I moved the function VALGRIND_INTERNAL_PRINT() into vg_messages.c in a recent commit, out of vg_include.h. I just found that's no good, because vg_libpthread.c uses it, and gets linker errors when it tries. A better solution would be rewrite it as a macro, and put it in valgrind.h, so that vg_libpthread.c (and vg_replace_malloc.c) can see it. But then, VALGRIND_PRINTF is already in valgrind.h, and it's essentially identical to VALGRIND_INTERNAL_PRINTF. So: - Do we need both VALGRIND_PRINTF and VALGRIND_INTERNAL_PRINTF? I don't think so. Also: - Why is VALGRIND_PRINTF wrapped in a "#ifndef NVALGRIND" conditional? Surely it should be covered by the #ifndef NVALGRIND conditional on VALGRIND_MAGIC_SEQUENCE? I don't think this #ifndef is necessary. (Nb: All this applies to VALGRIND_PRINTF_BACKTRACE too.) Thanks. N |
|
From: Nicholas N. <nj...@ca...> - 2004-08-09 09:27:00
|
On Mon, 9 Aug 2004, Nicholas Nethercote wrote: > I moved the function VALGRIND_INTERNAL_PRINT() into vg_messages.c in a recent > commit, out of vg_include.h. I just found that's no good, because > vg_libpthread.c uses it, and gets linker errors when it tries. > > A better solution would be rewrite it as a macro, and put it in valgrind.h, > so that vg_libpthread.c (and vg_replace_malloc.c) can see it. > > But then, VALGRIND_PRINTF is already in valgrind.h, and it's essentially > identical to VALGRIND_INTERNAL_PRINTF. > > So: > > - Do we need both VALGRIND_PRINTF and VALGRIND_INTERNAL_PRINTF? I don't > think so. > > Also: > > - Why is VALGRIND_PRINTF wrapped in a "#ifndef NVALGRIND" conditional? > Surely it should be covered by the #ifndef NVALGRIND conditional on > VALGRIND_MAGIC_SEQUENCE? I don't think this #ifndef is necessary. Urgh, now I see there's a difference between the _PRINTF_ and _INTERNAL_PRINTF_ versions -- the first arg to VG_(vmessage)() is different, so the output formatting is different. Also, I see why they were defined as functions rather than macros -- so va_list could be used. I also guess that #ifndef was used because they are functions rather than macros. Hmm, I may well have to put the _INTERNAL_ functions back into vg_include.h, ie. undo my original change. N |