In member function ‘virtual nsresult nsXPConnect::Traverse(void*, nsCycleCollectionTraversalCallback&)’:
js/src/xpconnect/src/nsXPConnect.cpp:725: warning: ‘clazz’ may be used uninitialized in this function
js/src/xpconnect/src/nsXPConnect.cpp:724: warning: ‘obj’ may be used uninitialized in this function
Created attachment 365323 [details] [diff] [review]
Comment on attachment 365323 [details] [diff] [review]
r+sr=me if you take out the duplicated shadowing definitions many lines lower.
Pfff, looks like a bogus warning to me.
If the patch still needs check-in, it requires approval now.
Created attachment 557558 [details] [diff] [review]
Patch v1 to fix warning
Oh, nice. This thing has been annoying me for a while.
Comment on attachment 557558 [details] [diff] [review]
Patch v1 to fix warning
Paraphrasing comment 2:
r=me if you take out the duplicated shadowing definitions many lines lower.
Can you please clarify which lines you are talking about? There are lots of warning in the code and this is the only warning I see in nsXPConnect.cpp file.
I think he means that these lines can be removed:
797 JSObject *obj = static_cast<JSObject*>(p);
798 js::Class *clazz = obj->getClass();
They are assigned identical values on lines 749 and 750, under identical guards as the initial assignment.
That function really needs to be split up or something.
Created attachment 557769 [details] [diff] [review]
Also removing some obsolete assignment as suggested by mrbkap.
Comment on attachment 557769 [details] [diff] [review]
Do you need somebody to land this for you, Atul?
Andrew, Yes I need some one to land this patch into trunk. Currently, I don't even have access to try server let alone the mozilla-central :)
Okay, I'll land this patch. In the future, you should set the commit message of patches that you upload. You can do this like so:
hg qref -m "Bug 481282 - fix uninitialized variable warning in nsXPConnect::Traverse. r=mrbkap"
The message gives the bug number, a description of what the patch does, then the person who reviewed it. You can see many more examples of commit messages at https://tbpl.mozilla.org/
Not a big deal, but it makes things a little easier for people who commit patches for you. Thanks again for the patch!
Thanks a lot Andres. I have already started adding commit messages and all my latest patched do have commit messages in the patch.