Bug 707130 - Fix GCC 4.6 warnings coming from callgrind macros. r=jorendorff

This commit is contained in:
Igor Bukanov 2011-12-04 23:59:30 +01:00
parent 659a71d040
commit 139ec9d5c0

View File

@ -1489,18 +1489,36 @@ JS_DefineProfilingFunctions(JSContext *cx, JSObject *obj)
#include <valgrind/callgrind.h>
/*
* Wrapper for callgrind macros to stop warnings coming from their expansions.
*/
#if (__GNUC__ >= 5) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
# define WRAP_CALLGRIND(call) \
JS_BEGIN_MACRO \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wunused-but-set-variable\"") \
call; \
_Pragma("GCC diagnostic pop") \
JS_END_MACRO
#else
# define WRAP_CALLGRIND(call) \
JS_BEGIN_MACRO \
call; \
JS_END_MACRO
#endif
JS_FRIEND_API(JSBool)
js_StartCallgrind()
{
CALLGRIND_START_INSTRUMENTATION;
CALLGRIND_ZERO_STATS;
WRAP_CALLGRIND(CALLGRIND_START_INSTRUMENTATION);
WRAP_CALLGRIND(CALLGRIND_ZERO_STATS);
return true;
}
JS_FRIEND_API(JSBool)
js_StopCallgrind()
{
CALLGRIND_STOP_INSTRUMENTATION;
WRAP_CALLGRIND(CALLGRIND_STOP_INSTRUMENTATION);
return true;
}
@ -1508,9 +1526,9 @@ JS_FRIEND_API(JSBool)
js_DumpCallgrind(const char *outfile)
{
if (outfile) {
CALLGRIND_DUMP_STATS_AT(outfile);
WRAP_CALLGRIND(CALLGRIND_DUMP_STATS_AT(outfile));
} else {
CALLGRIND_DUMP_STATS;
WRAP_CALLGRIND(CALLGRIND_DUMP_STATS);
}
return true;