RESOLVED FIXED 24550
Compiler warning for XMLTokenizerLibxml2.cpp
https://bugs.webkit.org/show_bug.cgi?id=24550
Summary Compiler warning for XMLTokenizerLibxml2.cpp
Craig Schlenter
Reported 2009-03-12 10:32:23 PDT
gcc 4.3.3 throws out warnings about the return value of vasprintf being unused. An example of the compilation failure is seen here in chromium where -Werror makes the compilation fail http://code.google.com/p/chromium/issues/detail?id=7742#c23 I'll attach a patch which I unfortunately can't test as I can't get webkit svn to build at the moment.
Attachments
patch to fix compiler warning (1.08 KB, patch)
2009-03-12 10:34 PDT, Craig Schlenter
dglazkov: review+
Craig Schlenter
Comment 1 2009-03-12 10:34:11 PDT
Created attachment 28532 [details] patch to fix compiler warning untested patch to fix compiler warning
Darin Adler
Comment 2 2009-03-12 13:06:17 PDT
Comment on attachment 28532 [details] patch to fix compiler warning Is this really the only unused result warning in WebCore? If not, then why are we fixing this one case?
Craig Schlenter
Comment 3 2009-03-12 21:42:25 PDT
I've asked the original reporter for more feedback in the chromium issue tracker to see if there are other warnings/errors. I had originally assumed that one of the webkit merges introduced this problem but the vasprintf seems to have been there for ages according to svn blame so I need to dig a bit more to see why it's only showing up now as the reporter was compiling successfully before. I unfortunately don't have the same compiler as the reporter btw. but I'll see if I can coax my machine (Fedora 9) into using a newer compiler and investigate this properly. In this particular case btw., if the vasprintf call fails the invalid buffer returned by vasprintf will be freed a couple of lines further on which will probably result in a crash although arguably if that is failing not much else is likely to work either. Thank you.
Craig Schlenter
Comment 4 2009-03-13 12:17:12 PDT
I think I know why the chromium reporter sees this and I don't even after upgrading my fedora 9 system to gcc 4.4.0 and glibc-2.9.90 ... it seems as if ubuntu 8.10 has some default compiler flag settings that include FORTIFY_SOURCE that is activated at -O2 and higher: https://wiki.ubuntu.com/CompilerFlags I'll fiddle with getting my machine into equivalent shape tomorrow and track down the related errors/warnings ....
Craig Schlenter
Comment 5 2009-03-15 07:51:42 PDT
After compiling with -D_FORTIFY_SOURCE=2 this seems to be the only warn_unused_result. GCC-4.4.0 has shown up some other issues (a missing include and possibly some strict aliasing issues) but I'll file separate bugs for those. Thank you.
Dimitri Glazkov (Google)
Comment 6 2009-03-30 15:24:05 PDT
Comment on attachment 28532 [details] patch to fix compiler warning Sounds good.
Dmitry Titov
Comment 7 2009-03-31 13:24:21 PDT
Landed: http://trac.webkit.org/changeset/42139 Please add the link to the bug into ChangeLog description next time.
Note You need to log in before you can comment on or make changes to this bug.