mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Silence unused-value warnings with various Valgrind macros in clang, and add a silencing instance to jsgc.cpp. No bug, rs=jorendorff, a=philor
This commit is contained in:
parent
8338fabe0c
commit
896dcba95d
@ -1490,36 +1490,18 @@ 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()
|
||||
{
|
||||
WRAP_CALLGRIND(CALLGRIND_START_INSTRUMENTATION);
|
||||
WRAP_CALLGRIND(CALLGRIND_ZERO_STATS);
|
||||
JS_SILENCE_UNUSED_VALUE_IN_EXPR(CALLGRIND_START_INSTRUMENTATION);
|
||||
JS_SILENCE_UNUSED_VALUE_IN_EXPR(CALLGRIND_ZERO_STATS);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_FRIEND_API(JSBool)
|
||||
js_StopCallgrind()
|
||||
{
|
||||
WRAP_CALLGRIND(CALLGRIND_STOP_INSTRUMENTATION);
|
||||
JS_SILENCE_UNUSED_VALUE_IN_EXPR(CALLGRIND_STOP_INSTRUMENTATION);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1527,9 +1509,9 @@ JS_FRIEND_API(JSBool)
|
||||
js_DumpCallgrind(const char *outfile)
|
||||
{
|
||||
if (outfile) {
|
||||
WRAP_CALLGRIND(CALLGRIND_DUMP_STATS_AT(outfile));
|
||||
JS_SILENCE_UNUSED_VALUE_IN_EXPR(CALLGRIND_DUMP_STATS_AT(outfile));
|
||||
} else {
|
||||
WRAP_CALLGRIND(CALLGRIND_DUMP_STATS);
|
||||
JS_SILENCE_UNUSED_VALUE_IN_EXPR(CALLGRIND_DUMP_STATS);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -1010,7 +1010,7 @@ MarkWordConservatively(JSTracer *trc, jsuword w)
|
||||
* original word. See bug 572678.
|
||||
*/
|
||||
#ifdef JS_VALGRIND
|
||||
VALGRIND_MAKE_MEM_DEFINED(&w, sizeof(w));
|
||||
JS_SILENCE_UNUSED_VALUE_IN_EXPR(VALGRIND_MAKE_MEM_DEFINED(&w, sizeof(w)));
|
||||
#endif
|
||||
|
||||
MarkIfGCThingWord(trc, w);
|
||||
|
@ -440,4 +440,28 @@ typedef size_t jsbitmap;
|
||||
#define JS_CLEAR_BIT(_map,_bit) ((_map)[(_bit)>>JS_BITS_PER_WORD_LOG2] &= \
|
||||
~((jsbitmap)1<<((_bit)&(JS_BITS_PER_WORD-1))))
|
||||
|
||||
/* Wrapper for various macros to stop warnings coming from their expansions. */
|
||||
#if defined(__clang__)
|
||||
# define JS_SILENCE_UNUSED_VALUE_IN_EXPR(expr) \
|
||||
JS_BEGIN_MACRO \
|
||||
_Pragma("clang diagnostic push") \
|
||||
_Pragma("clang diagnostic ignored \"-Wunused-value\"") \
|
||||
expr; \
|
||||
_Pragma("clang diagnostic pop") \
|
||||
JS_END_MACRO
|
||||
#elif (__GNUC__ >= 5) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
|
||||
# define JS_SILENCE_UNUSED_VALUE_IN_EXPR(expr) \
|
||||
JS_BEGIN_MACRO \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wunused-but-set-variable\"") \
|
||||
expr; \
|
||||
_Pragma("GCC diagnostic pop") \
|
||||
JS_END_MACRO
|
||||
#else
|
||||
# define JS_SILENCE_UNUSED_VALUE_IN_EXPR(expr) \
|
||||
JS_BEGIN_MACRO \
|
||||
expr; \
|
||||
JS_END_MACRO
|
||||
#endif
|
||||
|
||||
#endif /* jsutil_h___ */
|
||||
|
Loading…
Reference in New Issue
Block a user