From 9f858f38c03d2671a94d3ff8e8d726f0d2f7023c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 13 Mar 2020 08:37:22 +0200 Subject: [PATCH] Fix clang 10 warnings _ma_fetch_keypage(): Correct an assertion that used to always hold. Thanks to clang -Wint-in-bool-context for flagging this. double_to_datetime_with_warn(): Suppress -Wimplicit-int-float-conversion by adding a cast. LONGLONG_MAX converted to double will actually be LONGLONG_MAX+1. --- sql/sql_time.cc | 4 ++-- storage/maria/ma_page.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sql/sql_time.cc b/sql/sql_time.cc index 5a251cfd733..a6fe937df4b 100644 --- a/sql/sql_time.cc +++ b/sql/sql_time.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2010, Oracle and/or its affiliates. - Copyright (c) 2009, 2013 Monty Program Ab. + Copyright (c) 2009, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -403,7 +403,7 @@ bool double_to_datetime_with_warn(double value, MYSQL_TIME *ltime, if (neg) value= -value; - if (value > LONGLONG_MAX) + if (value > static_cast(LONGLONG_MAX)) value= static_cast(LONGLONG_MAX); longlong nr= static_cast(floor(value)); diff --git a/storage/maria/ma_page.c b/storage/maria/ma_page.c index 9cd68a208b9..e55c5288d1d 100644 --- a/storage/maria/ma_page.c +++ b/storage/maria/ma_page.c @@ -1,4 +1,5 @@ /* Copyright (C) 2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB + Copyright (c) 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -112,7 +113,7 @@ my_bool _ma_fetch_keypage(MARIA_PAGE *page, MARIA_HA *info, if (lock != PAGECACHE_LOCK_LEFT_UNLOCKED) { - DBUG_ASSERT(lock == PAGECACHE_LOCK_WRITE || PAGECACHE_LOCK_READ); + DBUG_ASSERT(lock == PAGECACHE_LOCK_WRITE || lock == PAGECACHE_LOCK_READ); page_link.unlock= (lock == PAGECACHE_LOCK_WRITE ? PAGECACHE_LOCK_WRITE_UNLOCK : PAGECACHE_LOCK_READ_UNLOCK);