Tarantool development patches archive
 help / color / mirror / Atom feed
From: "Alexander V. Tikhonov" <avtikhon@tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH] test: fix warning for old gcc at testgetmetrics.c
Date: Tue, 20 Oct 2020 18:17:49 +0300	[thread overview]
Message-ID: <20201020151749.GB26378@hpalx> (raw)
In-Reply-To: <20201020125910.GE1834@root>

Hi Sergey, thanks for the patch. I've checked your fix and it really
helped with building using gcc-4.8.5 with Werror flag [1]. Also no new
degradations occurred [2]. Patch LGTM.

[1] - https://gitlab.com/tarantool/tarantool/-/jobs/801762908
[2] - https://gitlab.com/tarantool/tarantool/-/pipelines/205243134

On Tue, Oct 20, 2020 at 03:59:10PM +0300, Sergey Kaplun wrote:
> 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 <skaplun@tarantool.org>
> > > 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

      reply	other threads:[~2020-10-20 15:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-17 11:44 Sergey Kaplun
2020-10-20 11:06 ` Igor Munkin
2020-10-20 12:44   ` Sergey Ostanevich
2020-10-20 12:59     ` Sergey Kaplun
2020-10-20 15:17       ` Alexander V. Tikhonov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201020151749.GB26378@hpalx \
    --to=avtikhon@tarantool.org \
    --cc=skaplun@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] test: fix warning for old gcc at testgetmetrics.c' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox