GNOME Bugzilla – Bug 643325
[patch] Silence several warnings
Last modified: 2011-05-04 18:46:52 UTC
Currently, gjs compilation produces some warnings, most of them because of unused (f)write result or unused variables. With this patch, only xulrunner2 headers warnings remain.
Created attachment 181942 [details] [review] Silence several warnings
Created attachment 182071 [details] [review] Silence several warnings Drop the GJS_NATIVE_CONSTRUCTOR_VARIABLES macro and remove invalid CXXFLAGS
Review of attachment 182071 [details] [review]: I'd like these as separate patches actually; it's easier to see what's going on. ::: util/crash.c @@ +48,2 @@ len = strlen(s); + int w G_GNUC_UNUSED = write(STDERR_FILENO, s, len); No; we should keep repeating the write until it's done, not just ignore the return value. (I typically create a function like "write_all" which does this). @@ +63,2 @@ while ((n = read(fd, buf, sizeof(buf))) > 0) { + w = write(STDERR_FILENO, buf, n); Same here.
Created attachment 182493 [details] [review] Drop incorrect CXXFLAGS
Created attachment 182494 [details] [review] Remove an unused variable
Created attachment 182495 [details] [review] Don't try to free a const char*
Created attachment 182496 [details] [review] Drop the GJS_NATIVE_CONSTRUCTOR_VARIABLES macro
Created attachment 182497 [details] [review] Don't ignore the return values of (f)write
Created attachment 182498 [details] [review] Make gjs_debugger_native_trap a JSFastNative Not really sure if this one needs a conditionnal test. Does it create a warning with xulrunner 1.9.2 ?
Review of attachment 182497 [details] [review]: ::: util/crash.c @@ +46,3 @@ + /* keep writing until success */ + while(write(STDERR_FILENO, s, len) < 0); +} Okay, not quite =) In the case of an error, this will loop infinitely. This part of the Unix API sucks honestly. Rather than have you rediscover how to do it I'll just fix this myself.
Comment on attachment 182496 [details] [review] Drop the GJS_NATIVE_CONSTRUCTOR_VARIABLES macro I committed this but had to revert it, then fixed it a different way.
I think we got all of these committed.