Closed
Bug 392055
Opened 17 years ago
Closed 17 years ago
NS_ENSURE_SUCCESS should print out the error code
Categories
(Core :: General, defect)
Core
General
Tracking
()
RESOLVED
FIXED
mozilla1.9beta1
People
(Reporter: sdwilsh, Assigned: sdwilsh)
References
Details
Attachments
(2 files, 5 obsolete files)
2.61 KB,
patch
|
benjamin
:
review+
bzbarsky
:
superreview+
damons
:
approval1.9+
|
Details | Diff | Splinter Review |
1.95 KB,
patch
|
benjamin
:
review+
benjamin
:
approval1.9+
|
Details | Diff | Splinter Review |
As per discussion on irc.
Assignee | ||
Comment 1•17 years ago
|
||
Attachment #276503 -
Flags: superreview?(bzbarsky)
Attachment #276503 -
Flags: review?(benjamin)
Assignee | ||
Comment 2•17 years ago
|
||
Comment on attachment 276503 [details] [diff] [review] v1.0 oops - s/%X/%#X/g
Updated•17 years ago
|
Attachment #276503 -
Flags: superreview?(bzbarsky) → superreview+
Assignee | ||
Comment 3•17 years ago
|
||
oh fun, NSPR's doesn't support the %#X, so we'll have to manually add it.
Comment 4•17 years ago
|
||
Comment on attachment 276503 [details] [diff] [review] v1.0 1) You need to do this only #ifdef DEBUG... 2) I don't like hardcoding a random dyndns.org address into our codebase... can you file a mozilla IT bug to get the nserror script hosted somewhere in the mozilla.org domain, or else leave out the URL?)
Attachment #276503 -
Flags: review?(benjamin) → review-
Assignee | ||
Comment 5•17 years ago
|
||
* No more http link (revist in a followup?) * Just does |if (NS_FAILED(res)) return ret;| in non-debug builds. * uses |const char[]| instead of |const char *|
Attachment #276503 -
Attachment is obsolete: true
Attachment #276975 -
Flags: review?(benjamin)
Assignee | ||
Comment 6•17 years ago
|
||
This one actually compiles. Sorry about that...
Attachment #276975 -
Attachment is obsolete: true
Attachment #277001 -
Flags: review?(benjamin)
Attachment #276975 -
Flags: review?(benjamin)
Assignee | ||
Updated•17 years ago
|
Target Milestone: --- → mozilla1.9 M8
Updated•17 years ago
|
Attachment #277001 -
Flags: review?(benjamin) → review+
Assignee | ||
Comment 7•17 years ago
|
||
bz isn't around for a while - any suggestions for an sr?
Assignee | ||
Updated•17 years ago
|
Target Milestone: mozilla1.9 M8 → mozilla1.9 M9
Assignee | ||
Updated•17 years ago
|
Attachment #277001 -
Flags: superreview?(bzbarsky)
Comment 8•17 years ago
|
||
Comment on attachment 277001 [details] [diff] [review] v1.2 >Index: xpcom/glue/nsDebug.h >+ nsresult __rv = res; Add a comment before the macro def that says that you're doing this to avoid evaluating |res| more than once, ok? >+ char *msg = PR_smprintf(format, __rv, __rv); \ Only need one __rv there; the format only has one placeholder. With those two nits picked, sr+a=bzbarsky
Attachment #277001 -
Flags: superreview?(bzbarsky)
Attachment #277001 -
Flags: superreview+
Attachment #277001 -
Flags: approval1.9+
Assignee | ||
Comment 10•17 years ago
|
||
Checking in xpcom/glue/nsDebug.h; new revision: 1.27; previous revision: 1.26
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Flags: in-testsuite-
Flags: in-litmus-
Resolution: --- → FIXED
Assignee | ||
Comment 11•17 years ago
|
||
Bustage fix on linux Checking in embedding/browser/gtk/tests/Makefile.in; new revision: 1.38; previous revision: 1.37
Comment 12•17 years ago
|
||
Won't this blow up terribly if the expression |res| happens to contain a % symbol?
Assignee | ||
Comment 13•17 years ago
|
||
In theory, yeah, but I'm not sure that would ever compile. res and ret should be nsresults for things to compile nicely.
Comment 14•17 years ago
|
||
There are examples of function-call expressions inside NS_ENSURE_SUCCESS in our tree...
Comment 15•17 years ago
|
||
Backed this out at Shawn's request because of bustage.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 16•17 years ago
|
||
Really not sure what is up with this - I figured my fix would have solved the issue :/ /tools/gcc-4.1.1/bin/g++ -fno-rtti -fno-exceptions -Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-long-long -pedantic -fshort-wchar -pthread -pipe -DDEBUG -D_DEBUG -DDEBUG_cltbld -DTRACING -g -fno-inline -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -o TestGtkEmbed TestGtkEmbed.o -lpthread -L../../../../dist/bin -L../../../../dist/lib -lX11 ../../../../dist/lib/libxpcomglue.a -ldl -lm -L/lib -lgtk-x11-2.0 -latk-1.0 -lgdk-x11-2.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgmodule-2.0 -ldl -lgobject-2.0 -lglib-2.0 ../../../../dist/lib/libxpcomglue.a(nsINIParser.o): In function `nsINIParser::Init(nsILocalFile*)': /builds/tinderbox/Fx-Trunk-Memtest/Linux_2.6.18-8.el5_Depend/mozilla/obj/xpcom/glue/standalone/nsINIParser.cpp:89: undefined reference to `PR_smprintf' /builds/tinderbox/Fx-Trunk-Memtest/Linux_2.6.18-8.el5_Depend/mozilla/obj/xpcom/glue/standalone/nsINIParser.cpp:89: undefined reference to `PR_smprintf_free' collect2: ld returned 1 exit status gmake[5]: *** [TestGtkEmbed] Error 1 gmake[5]: Leaving directory `/builds/tinderbox/Fx-Trunk-Memtest/Linux_2.6.18-8.el5_Depend/mozilla/obj/embedding/browser/gtk/tests'
Assignee | ||
Comment 17•17 years ago
|
||
OK, I *think* this works...just a bit difficult to test since I don't have linux... We could also change those NS_ENSURE_SUCCESS's to something else, or doing a #define to disable the debug version in that file...
Attachment #282052 -
Attachment is obsolete: true
Attachment #282110 -
Flags: superreview?(bzbarsky)
Attachment #282110 -
Flags: review?(benjamin)
Comment 18•17 years ago
|
||
If the idea of libxpcomglue is that it doesn't depend on NSPR, then it'd be good if it could #define something to turn this enhanced behaviour off. Or, maybe there's already something everyone else defines that xpcomglue doesn't that you could check for.
Comment 19•17 years ago
|
||
Hmm. Jesse's question about '%'. Worries me. Can we address that somehow?
Assignee | ||
Comment 20•17 years ago
|
||
Nothing really comes to mind as a quick way to deal with it :/
Assignee | ||
Comment 21•17 years ago
|
||
Of course right after I say that I came up with something Not sure if it'd work, but we could rephrase the expression to something like "Ox#### was returned (NS_ENSURE_SUCCESS(#res, #ret))" Clearly, that string sucks, but it demonstrates the point.
Comment 22•17 years ago
|
||
Comment on attachment 282110 [details] [diff] [review] v1.4 Yeah, we need to deal better with the standalone glue case. When linking with the standalone glue you don't want to link with NSPR (because the whole point is that you don't know where mozilla/NSPR are yet). So the NSPR gunk here should be disabled if XPCOM_GLUE_AVOID_NSPR is defined (which comes from nsISupportsImpl.h currently).
Attachment #282110 -
Flags: superreview?(bzbarsky)
Attachment #282110 -
Flags: review?(benjamin)
Attachment #282110 -
Flags: review-
Assignee | ||
Comment 23•17 years ago
|
||
Suggestions on what to do then?
Comment 24•17 years ago
|
||
So if XPCOM_GLUE_AVOID_NSPR we'll use the simpler NS_WARNING, and if !DEBUG the NS_WARNING evaluates do an empty do/while.
Attachment #282110 -
Attachment is obsolete: true
Attachment #282359 -
Flags: review?(benjamin)
Updated•17 years ago
|
Attachment #282359 -
Flags: review?(benjamin) → review+
Updated•17 years ago
|
Attachment #282359 -
Flags: superreview?(bzbarsky)
Comment 25•17 years ago
|
||
Comment on attachment 282359 [details] [diff] [review] Address % in res, add XPCOM_GLUE_AVOID_NSPR check sr=bzbarsky
Attachment #282359 -
Flags: superreview?(bzbarsky) → superreview+
Updated•17 years ago
|
Attachment #282359 -
Flags: approval1.9?
Updated•17 years ago
|
Attachment #282359 -
Flags: approval1.9? → approval1.9+
Comment 26•17 years ago
|
||
Checking in nsDebug.h; /cvsroot/mozilla/xpcom/glue/nsDebug.h,v <-- nsDebug.h new revision: 1.29; previous revision: 1.28 done
Status: REOPENED → RESOLVED
Closed: 17 years ago → 17 years ago
Resolution: --- → FIXED
Comment 27•17 years ago
|
||
Updated•17 years ago
|
Attachment #282755 -
Flags: review+
Attachment #282755 -
Flags: approval1.9+
Comment 28•17 years ago
|
||
Checking in glue/nsISupportsImpl.h; /cvsroot/mozilla/xpcom/glue/nsISupportsImpl.h,v <-- nsISupportsImpl.h new revision: 3.52; previous revision: 3.51 done Checking in base/nscore.h; /cvsroot/mozilla/xpcom/base/nscore.h,v <-- nscore.h new revision: 1.103; previous revision: 1.102 done
Comment 29•16 years ago
|
||
Comment on attachment 282359 [details] [diff] [review] Address % in res, add XPCOM_GLUE_AVOID_NSPR check >+#define NS_ENSURE_SUCCESS_BODY(res, ret) \ >+ char *msg = PR_smprintf("NS_ENSURE_SUCCESS(%s, %s) failed with " \ >+ "result 0x%X", #res, #ret, __rv); \ So, this references __rv, instead of passing it as a macro argument...
You need to log in
before you can comment on or make changes to this bug.
Description
•