This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: nonnull, -Wnonnull, and do/while


On Tue, Feb 16, 2016 at 10:43:08AM +0100, Stefan Sobernig wrote:
> Under a recent gcc 6 [*], we run into -Wnonnull warnings using the
> nonnull attribute:

Yes, this warning has been enhanced for GCC 6.
 
> test.c: In function 'f':
> test.c:16:14: warning: nonnull argument 's' compared to NULL [-Wnonnull]
>    } while (s != NULL);
> 
> Am I missing sth.? Is this a false positive?

Well, it's just that "s" has the nonnull attribute so the compiler thinks it
should never be null in which case comparing it to null should be redundant.
Doesn't seem like a false positive to me, but maybe someone else feels
otherwise.

	Marek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]