Description:
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
[-Wpointer-bool-conversion]
ut_ad(col && type);
in a function declared with __attribute((nonnull))
Gets the column data type. */
UNIV_INLINE
void
dict_col_copy_type(
/*===============*/
const dict_col_t* col, /*!< in: column */
dtype_t* type) /*!< out: data type */
__attribute__((nonnull));
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.