Re: GCC 6 -Wnonnull is too aggressive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 17, 2016 at 05:43:51PM +0100, Petr Spacek wrote:
> __attribute__((nonnull)) is tremendously useful for static code analysis and
> helped to uncover a lot of (not-yet triggered) issues in the code, so just
> removing the attribute would not make me happy.

Sure.

> On the other hand, assert(var != NULL) checks are tremendously useful at
> run-time. They detects problems early/near the place when the problem occurred
> and makes debugging easier.

That is wrong.  Even older gcc versions would just optimize away the
assertion.  For debugging code that uses nonnull attribute, to make sure you
aren't violating the assumptions, you can use
-fsanitize=undefined (in particular -fsanitize=nonnull,returns-nonnull).
So, just remove the bogus assertions.

BTW, in the next gcc build the warning option for this will be
-Wnonnull-compare (enabled in -Wall).

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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux