[MDEV-11849] Fix storage/innobase/* compile warnings Created: 2017-01-20  Updated: 2018-01-13  Resolved: 2017-01-26

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.2
Fix Version/s: 10.2.4

Type: Bug Priority: Major
Reporter: Jan Lindström (Inactive) Assignee: Jan Lindström (Inactive)
Resolution: Fixed Votes: 0
Labels: 10.2-ga

Issue Links:
Relates
relates to MDEV-14887 On a 32-bit system, MariaDB 10.2 mish... Closed

 Comments   
Comment by Jan Lindström (Inactive) [ 2017-01-20 ]

http://lists.askmonty.org/pipermail/commits/2017-January/010472.html

Comment by Jan Lindström (Inactive) [ 2017-01-20 ]

Windows:

http://lists.askmonty.org/pipermail/commits/2017-January/010473.html

Comment by Marko Mäkelä [ 2017-01-25 ]

I am not happy to see so many new type casts. Is there any other solution?
Please use static_cast<ulint>(xxx) or ulint(xxx) instead of (ulint)(xxx).

The following is ignoring the high-order 32 bits of the field on 32-bit systems:

		compression_alg = (ulint)mach_read_from_8(buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);

Maybe we should use mach_read_from_4() from offset +4 instead?
The following ought to be introducing a warning for an unused variable in non-debug builds:

diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index a5fd7788af2..bc375f20e9b 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -5508,10 +5508,7 @@ innobase_kill_query(
 			trx_mutex_taken = true;
 		}
 
-#ifdef UNIV_DEBUG
-		dberr_t err =
-#endif
-		lock_trx_handle_wait(trx, true, true);
+		dberr_t err = lock_trx_handle_wait(trx, true, true);
 
 		ut_ad(err == DB_SUCCESS || err == DB_LOCK_WAIT
 		      || err == DB_DEADLOCK);

Maybe it would be better to remove the MY_ATTRIBUTE((warn_unused_result)) if that was the reason for this change, or to change the API otherwise.
Please build with both debug and non-debug. Maybe you could submit the patches to buildbot and examine the warnings on every platform?

Comment by Jan Lindström (Inactive) [ 2017-01-25 ]

Buildbot results bb-10.2-mdev11849, I can try to avoid some of the casts by changing the variable type, but that does not work for all of these.

Comment by Jan Lindström (Inactive) [ 2017-01-26 ]

commit 71495a1748784a887f42888a2a7b8cac5e088ff6
Author: Jan Lindström <jan.lindstrom@mariadb.com>
Date: Wed Jan 25 10:11:37 2017 +0200

MDEV-11849: Fix storage/innobase/* compile warnings

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