From: Nicholas Nethercote Date: Sun, 27 Mar 2005 01:25:38 +0000 (+0000) Subject: Merge STR and VG__STRING macros into one, VG_STRINGIFY. Also, in X-Git-Tag: svn/VALGRIND_3_0_0~864 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e2e1d2f896002fc3393ea6dcebab797c2910fc69;p=thirdparty%2Fvalgrind.git Merge STR and VG__STRING macros into one, VG_STRINGIFY. Also, in valgrind-listener.c, don't use the VG_ prefix on its equivalent, because it's a local definition. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3454 --- diff --git a/auxprogs/valgrind-listener.c b/auxprogs/valgrind-listener.c index c44010dcef..dd9008167a 100644 --- a/auxprogs/valgrind-listener.c +++ b/auxprogs/valgrind-listener.c @@ -80,12 +80,12 @@ static void my_assert_fail ( const Char* expr, const Char* file, Int line, const } #undef assert -#undef VG__STRING +#undef STRINGIFY -#define VG__STRING(__str) #__str +#define STRINGIFY(__str) #__str #define assert(expr) \ ((void) ((expr) ? 0 : \ - (my_assert_fail (VG__STRING(expr), \ + (my_assert_fail (STRINGIFY(expr), \ __FILE__, __LINE__, \ __PRETTY_FUNCTION__), 0))) diff --git a/coregrind/core.h b/coregrind/core.h index 8108a12dba..b990e612a9 100644 --- a/coregrind/core.h +++ b/coregrind/core.h @@ -792,7 +792,7 @@ extern void VG_(wait_for_threadstate)(Bool (*pred)(void *), void *arg); #define vg_assert(expr) \ ((void) ((expr) ? 0 : \ - (VG_(core_assert_fail) (VG__STRING(expr), \ + (VG_(core_assert_fail) (VG_STRINGIFY(expr), \ __FILE__, __LINE__, \ __PRETTY_FUNCTION__), 0))) __attribute__ ((__noreturn__)) diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c index 81181cf249..e48dab5239 100644 --- a/coregrind/vg_main.c +++ b/coregrind/vg_main.c @@ -1244,7 +1244,7 @@ static void load_tool( const char *toolname, void** handle_out, } // Set redzone size for V's allocator - vg_malloc_redzonep = dlsym(handle, STR(VG_(vg_malloc_redzone_szB))); + vg_malloc_redzonep = dlsym(handle, VG_STRINGIFY(VG_(vg_malloc_redzone_szB))); if ( NULL != vg_malloc_redzonep ) { VG_(vg_malloc_redzone_szB) = *vg_malloc_redzonep; } diff --git a/coregrind/vg_needs.c b/coregrind/vg_needs.c index ada4419c93..688eb0c872 100644 --- a/coregrind/vg_needs.c +++ b/coregrind/vg_needs.c @@ -67,7 +67,7 @@ void VG_(sanity_check_needs) ( void) #define CHECK_NOT(var, value) \ if ((var)==(value)) { \ VG_(printf)("\nTool error: `%s' not initialised\n", \ - VG__STRING(var)); \ + VG_STRINGIFY(var)); \ VG_(tool_panic)("Uninitialised details field\n"); \ } diff --git a/include/tool.h.base b/include/tool.h.base index 4b5d6c64b6..3373277939 100644 --- a/include/tool.h.base +++ b/include/tool.h.base @@ -451,11 +451,16 @@ extern Bool VG_(getcwd_alloc) ( Char** cwd ); /* ------------------------------------------------------------------ */ /* assert.h */ /* Asserts permanently enabled -- no turning off with NDEBUG. Hurrah! */ -#define VG__STRING(__str) #__str + +/* This odd definition lets us stringify VG_(x) function names to + "vgPlain_x". We need to do two macroexpansions to get the VG_ macro + expanded before stringifying. */ +#define VG_STRINGIFY_WRK(x) #x +#define VG_STRINGIFY(x) VG_STRINGIFY_WRK(x) #define tl_assert(expr) \ ((void) ((expr) ? 0 : \ - (VG_(tool_assert_fail) (VG__STRING(expr), \ + (VG_(tool_assert_fail) (VG_STRINGIFY(expr), \ __FILE__, __LINE__, \ __PRETTY_FUNCTION__), 0))) diff --git a/include/tool_asm.h b/include/tool_asm.h index 61f1b0cfce..8b9f52884a 100644 --- a/include/tool_asm.h +++ b/include/tool_asm.h @@ -48,12 +48,6 @@ /* Tool-specific ones. Note that final name still starts with "vg". */ #define TL_(str) VGAPPEND(vgTool_,str) -/* This is specifically for stringifying VG_(x) function names. We - need to do two macroexpansions to get the VG_ macro expanded before - stringifying */ -#define _STR(x) #x -#define STR(x) _STR(x) - #endif /* ndef __TOOL_ASM_H */ /*--------------------------------------------------------------------*/