From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp40.i.mail.ru (smtp40.i.mail.ru [94.100.177.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 1B56E469719 for ; Tue, 20 Oct 2020 15:59:38 +0300 (MSK) Date: Tue, 20 Oct 2020 15:59:10 +0300 From: Sergey Kaplun Message-ID: <20201020125910.GE1834@root> References: <20201017114459.18598-1-skaplun@tarantool.org> <20201020110600.GF5396@tarantool.org> <20201020124436.GE10320@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201020124436.GE10320@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH] test: fix warning for old gcc at testgetmetrics.c List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Ostanevich Cc: tarantool-patches@dev.tarantool.org Sergos, Igor, Thanks for the review! On 20.10.20, Sergey Ostanevich wrote: > Hi! > > The patch is LGTM, wording in the commit message still needs updates > (the latest branch log below). > > Sergos > > > commit 7a4c686e61bb70defe56e4e823ae09ce98c8dc04 (HEAD -> skaplun/gh-5187-old-gcc-warning, origin/skaplun/gh-5187-old-gcc-warning) > > Author: Sergey Kaplun > > Date: Sat Oct 17 09:13:07 2020 +0300 > > > > test: fix warning for old gcc at testgetmetrics.c > > > > This patch fixes the regression introduced in scope of > > 5a61e1ab54b5c66bfebd836db1ac47996611e065 ('misc: add C and Lua > > API for platform metrics'). > > > > Old gcc compiler (gcc-4.8.5-39) throws warnings like: > > "error: comparison is always true due to limited range of data type > > [-Werror=type-limits]", when you cast syze_t value to ssyze_t type and > > size instead of syze Thanks, fixed! > > > compare its to >= 0. This leads to failing compilation with -Werror > > compare it, not its Thanks, fixed. > > > flag. > > > > Taking into account that this base test check only API format, not > > values by themself, it will be enough to use (void) construction here. > > by themself -> themselves Thanks, fixed! > > > > > Follows up tarantool/tarantool#5187 > > > So, new commit message is: =================================================================== test: fix warning for old gcc at testgetmetrics.c This patch fixes the regression introduced in scope of 5a61e1ab54b5c66bfebd836db1ac47996611e065 ('misc: add C and Lua API for platform metrics'). Old gcc compiler (gcc-4.8.5-39) throws warnings like: "error: comparison is always true due to limited range of data type [-Werror=type-limits]", when you cast size_t value to ssize_t type and compare it to >= 0. This leads to failing compilation with -Werror flag. Taking into account that this base test checks only API format, not values by themselves, it will be enough to use (void) construction here. Follows up tarantool/tarantool#5187 =================================================================== Also updated comment. See iterative patch below. Branch is force pushed. =================================================================== diff --git a/test/misclib-getmetrics-capi/testgetmetrics.c b/test/misclib-getmetrics-capi/testgetmetrics.c index fc19680..7fd3eef 100644 --- a/test/misclib-getmetrics-capi/testgetmetrics.c +++ b/test/misclib-getmetrics-capi/testgetmetrics.c @@ -12,7 +12,7 @@ static int base(lua_State *L) struct luam_Metrics metrics; luaM_metrics(L, &metrics); - /* Just check API, not values by itself. */ + /* Just check structure format, not values that fields contain. */ (void)metrics.strhash_hit; (void)metrics.strhash_miss; =================================================================== -- Best regards, Sergey Kaplun