bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tests: pacify gcc -fanalyzer on zerosize_ptr


From: Bernhard Voelker
Subject: Re: [PATCH] tests: pacify gcc -fanalyzer on zerosize_ptr
Date: Thu, 2 Jul 2020 23:37:40 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0

On 2020-07-02 01:48, Paul Eggert wrote:
> diff --git a/tests/test-memchr.c b/tests/test-memchr.c

> -  ASSERT (MEMCHR (zerosize_ptr (), 'a', 0) == NULL);
> +  void *page_boundary = zerosize_ptr ();
> +  if (page_boundary)
> +    ASSERT (MEMCHR (page_boundary, 'a', 0) == NULL);

This triggers a new shadowing warning (here with -Werror, gcc 10.1.1):

  test-memchr.c: In function 'main':
  test-memchr.c:98:11: error: declaration of 'page_boundary' shadows a previous 
local [-Werror=shadow]
     98 |     char *page_boundary = (char *) zerosize_ptr ();
        |           ^~~~~~~~~~~~~
  test-memchr.c:52:9: note: shadowed declaration is here
     52 |   void *page_boundary = zerosize_ptr ();
        |         ^~~~~~~~~~~~~
  cc1: all warnings being treated as errors

The attached fixes it.
Okay to push?

Have a nice day,
Berny

Attachment: 0001-tests-avoid-shadowing-warning.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]