GNOME Bugzilla – Bug 748110
vtdec: fix build error with clang
Last modified: 2015-04-26 17:21:01 UTC
There is a build error when vtdec is compiled with clang. ... Making all in sys /Applications/Xcode.app/Contents/Developer/usr/bin/make -C applemedia OBJC libgstapplemedia_la-plugin.lo plugin.m:89:7: error: comparison of function 'VTCompressionSessionCreate' not equal to a null pointer is always true [-Werror,-Wtautological-pointer-compare] if (VTCompressionSessionCreate != NULL) { ^~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~ plugin.m:89:7: note: prefix with the address-of operator to silence this warning if (VTCompressionSessionCreate != NULL) { ^ & 1 error generated. make[3]: *** [libgstapplemedia_la-plugin.lo] Error 1 make[2]: *** [applemedia] Error 2 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2
Created attachment 301904 [details] [review] vtdec: fix build error with clang This commit fixes a simple build error by clang with by clang with [-Werror,-Wtautological-pointer-compare] options.
It's not necessary to subscribe random people to bugs, especially as I'm already getting mails about all bugs anyway.
And I think this warning is also wrong, with and without & this should be handled the same AFAIK. If you reference a function symbol by name, it's automatically a pointer to that function.
Created attachment 301905 [details] [review] vtdec: fix build error with clang Previous patch is not valid because it includes unnecessary modification that is not associate with this patch. So, could you please review this patch? Thanks.
Thank you for your advice. I am not familiar with this world yet. And I will keep in mind it next time. I also agree with your opinion about function reference by name. But the compiler still makes a build error at the point. Could you please give me some ideas for the error to be fixed?
I think it should be reported to clang as it's IMHO a bug in their code, but also we should just put a & there to silence the warning as the code should be equivalent.
OK. I will report this bug to clang dev team. And could we apply this patch to master until the bug is fixed in clang side?
This is intentional clang behavior. It's similar to the convention they have for assignments in parentheses, where you get warnings for: if (foo = bar) // change to if ((foo = bar)) to suppress if ((foo == bar)) // change to if (foo == bar) to suppress The provided suppression method is probably an attempt to be less cumbersome than pragmas. If anything, the clang bug is not taking the -weak_framework flag into account.
Filed: https://llvm.org/bugs/show_bug.cgi?id=23347
Comment on attachment 301905 [details] [review] vtdec: fix build error with clang commit a8ea7a9cfb5fd690f459668b7847034b6f2f0f65 Author: Yujin Lee <saddopop@gmail.com> Date: Sun Apr 19 00:55:50 2015 +0900 vtdec: fix build error with clang This commit fixes a simple build error by clang with by clang with [-Werror,-Wtautological-pointer-compare] options. https://bugzilla.gnome.org/show_bug.cgi?id=748110