[MDEV-9998] Fix issues caught by Clang's -Wpointer-bool-conversion warning Created: 2016-04-26  Updated: 2017-05-16  Due: 2017-04-28  Resolved: 2017-05-16

Status: Closed
Project: MariaDB Server
Component/s: Compiling
Affects Version/s: 10.0.24
Fix Version/s: 10.1.24, 10.0.31, 10.2.7

Type: Bug Priority: Major
Reporter: David Gow Assignee: Sergei Golubchik
Resolution: Fixed Votes: 1
Labels: clang, contribution, foundation, patch
Environment:

Ubuntu clang version 3.6.0-2ubuntu1~trusty1 with -Wpointer-bool-conversion


Attachments: File 0001-Fix-issues-caught-by-Clang-s-Wpointer-bool-conversio.patch     File 0001-InnoDB-fix-attribute-nonnull-debug-problems.patch    

 Description   

MariaDB 10.0 triggers Clang 3.6's -Wpointer-bool-conversion warnings. These warnings trigger when a pointer which the compiler knows cannot be null is converted to a bool (e.g. in a comparison). These mostly arise from statically or stack-allocated arrays or structures, but may also be triggered by _attribute_((nonnull)) on functions.

The attached patch cleans up these issues in the client, server, and InnoDB — mostly by removing or adjusting the comparison — so that they compile successfully with -Werror=pointer-bool-conversion.

Thanks,
— David



 Comments   
Comment by David Gow [ 2016-04-26 ]

When compiling InnoDB in debug mode, several assertions also trigger this warning.

0001-InnoDB-fix-attribute-nonnull-debug-problems.patch fixes these by adding a new ut_nonnulld() assertion which bypasses the check.

Generated at Thu Feb 08 07:38:54 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.