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
This commit is contained in:
Nicholas Nethercote 2005-03-27 01:25:38 +00:00
parent 8aac9bd8a7
commit e2e1d2f896
6 changed files with 13 additions and 14 deletions

View File

@ -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)))

View File

@ -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__))

View File

@ -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;
}

View File

@ -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"); \
}

View File

@ -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)))

View File

@ -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 */
/*--------------------------------------------------------------------*/