Re: pgsql: Try to fix compiler warnings.

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Erik Rijkers <er(at)xs4all(dot)nl>
Cc: pgsql-committers <pgsql-committers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Try to fix compiler warnings.
Date: 2021-03-12 20:06:29
Message-ID: CA+TgmobYGNwDyite28hdezR_y8UCh2B77PJfZsgD5mHW3E9S8Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Fri, Mar 12, 2021 at 2:52 PM <er(at)xs4all(dot)nl> wrote:
> > On 2021.03.12. 20:36 Robert Haas <rhaas(at)postgresql(dot)org> wrote:
> > Try to fix compiler warnings.
> >
> > Per report from Peter Geoghegan.
>
> I had the same errors Peter reported. gcc 10.2 on debian.
>
> The compile stops with:
>
> In file included from ../../../src/include/postgres_fe.h:25,
> from pg_amcheck.c:13:
> pg_amcheck.c: In function ‘compile_relation_list_one_db’:
> ../../../src/include/c.h:118:31: error: expected ‘,’ or ‘;’ before ‘__attribute__’
> 118 | #define pg_attribute_unused() __attribute__((unused))
> | ^~~~~~~~~~~~~
> ../../../src/include/c.h:155:34: note: in expansion of macro ‘pg_attribute_unused’
> 155 | #define PG_USED_FOR_ASSERTS_ONLY pg_attribute_unused()
> | ^~~~~~~~~~~~~~~~~~~
> pg_amcheck.c:2061:26: note: in expansion of macro ‘PG_USED_FOR_ASSERTS_ONLY’
> 2061 | bool is_btree = false PG_USED_FOR_ASSERTS_ONLY;
> | ^~~~~~~~~~~~~~~~~~~~~~~~
> pg_amcheck.c:2061:9: warning: variable ‘is_btree’ set but not used [-Wunused-but-set-variable]
> 2061 | bool is_btree = false PG_USED_FOR_ASSERTS_ONLY;
> | ^~~~~~~~
> make[3]: *** [pg_amcheck.o] Error 1
> make[2]: *** [all-pg_amcheck-recurse] Error 2
> make[2]: *** Waiting for unfinished jobs....
> make[1]: *** [all-bin-recurse] Error 2
> make: *** [all-src-recurse] Error 2
> ../../../src/Makefile.global:919: recipe for target 'pg_amcheck.o' failed
> Makefile:43: recipe for target 'all-pg_amcheck-recurse' failed
> Makefile:42: recipe for target 'all-bin-recurse' failed
> GNUmakefile:11: recipe for target 'all-src-recurse' failed

Well, that's not quite the same. The warning about mixing declarations
and code is gone, which is good, but the error about
PG_USED_FOR_ASSERTS_ONLY is clearly bad. I am a bit confused, though
... or I was until I realized that I put PG_USED_FOR_ASSERTS_ONLY
after the initializer whereas existing occurrences are before the
initializer. I just committed something to move that; hopefully that
fixes it for you.

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Erik Rijkers 2021-03-12 20:18:34 Re: pgsql: Try to fix compiler warnings.
Previous Message Robert Haas 2021-03-12 20:05:46 pgsql: Move PG_USED_FOR_ASSERTS_ONLY before initializer.