Bug #76690 InnoDB: warnings: nonnull parameter will evaluate to 'true' on first enc
Submitted: 14 Apr 2015 16:49 Modified: 24 Apr 2015 13:12
Reporter: Kevin Lewis Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.7.8 OS:Any
Assigned to: CPU Architecture:Any

[14 Apr 2015 16:49] Kevin Lewis
Dozens of new compiler warnings started to occur on MacOS 10.10.2
gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix

They are all similar to this:
In file included from /Users/kevinlewis/Work/portability/mysql/storage/innobase/include/dict0dict.h:1937:
/Users/kevinlewis/Work/portability/mysql/storage/innobase/include/dict0dict.ic:84:15: warning: nonnull parameter 'type' will evaluate to 'true' on first encounter
        ut_ad(col && type);

in a function declared with __attribute((nonnull))

Gets the column data type. */
	const dict_col_t*	col,	/*!< in: column */
	dtype_t*		type)	/*!< out: data type */

How to repeat:
compile mysql on MacOS 10.10.2

Suggested fix:
In most cases, the assert can simply be deleted since they assert that pointers are nonnull which is redundant with the attribute.

Another reason to delete the assert is that the pointers are immediately used.  If they are null the crash would happen anyway and cause a core dump.

But some of these asserts are combined with other conditions, so if they are still needed, the assert can be changes to (var != NULL) to avoid the compiler warning.
[24 Apr 2015 13:12] Daniel Price
Posted by developer:
Fixed as of the upcoming 5.7.8, 5.8.0 releases, and here's the changelog entry:

Assertion code was revised to avoid compiler warnings that occurred when
compiling MySQL on Mac OS X 10.10.2. 

Thank you for the bug report.