On Wed, Feb 17, 2016 at 05:30:27PM +0000, Daniel P. Berrange wrote:
> Instead of using __attribute__((nonnull)) directly in the code, define a
> macro for it. When compiling normal builds with gcc, make the macro
> expand to nothing, but when compiling with coverity or other static analysis
> tools make it expand normally.

Well, nonnull attribute is not primarily a debugging aid, but an
optimization hint, which allows the compiler to optimize, sometimes
significantly, the code that gives the compiler the additional information
it can't figure itself otherwise.
So while it could make sense to disable it in debug builds if you want
your assertions to work, for production builds built without assertions
it is really unnecessary pessimization of the code if you don't define it.

>  * still requiring correct gcc syntax when it is turned off.  See also
>  * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17308 */

Funny you mention this PR, because the new warning is one of the
warnings requested in that PR.  And now some people are complaining that the
warning got implemented.

        Jakub
--
devel mailing list
devel@lists.fedoraproject.org
http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org

Reply via email to