Comment #1 on issue 1291 by [email protected]: src/api.cc:4178:26: error:
variable 'result' set but not used [-Werror=unused-but-set-variable]
http://code.google.com/p/v8/issues/detail?id=1291
I'm still seeing plenty of those in other files, using GCC 4.6.0.
Most of them are just unused result values etc. but there are some tricky
ones too:
http://code.google.com/p/v8/source/browse/trunk/src/debug.cc#2951
v8::Handle<v8::Context> context = GetDebugEventContext(isolate);
// Isolate::context() may be NULL when "script collected" event occures.
ASSERT(!context.IsEmpty() || event_ == v8::ScriptCollected);
This one produces an error in the release mode. In the cases like this one,
the fix is usually to change the assignment to a copy constructor use.
And there's also
http://code.google.com/p/v8/source/browse/trunk/src/ia32/cpu-ia32.cc#70
#ifdef VALGRIND_DISCARD_TRANSLATIONS
VALGRIND_DISCARD_TRANSLATIONS(start, size);
#endif
That macro also does some voodoo which produces a similar error.
src/ia32/cpu-ia32.cc: In static member function 'static void
v8::internal::CPU::FlushICache(void*, size_t)':
src/ia32/cpu-ia32.cc:70:3: error: variable '_qzz_res' set but not used
[-Werror=unused-but-set-variable]
cc1plus: all warnings being treated as errors
I'm attaching a patch that removes the unused code (most of which looks
like a good thing to do), although I'm not familliar enough with the code
base to decide which parts were actually there on purpose (for debugging
purposes, perhaps?). This might not address all the occurrences, there may
appear more on different platforms or build configurations. There are many
of them in the unit tests too, I just shut them up with a simple #pragma.
These warnings are quite annoying when too many of them are "false
positives" so you might just as well consider disabling these.
Attachments:
gcc-4.6.0-unused-but-set-warnings.patch 7.2 KB
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev