pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Try to fix compiler warnings.
5+ messages / 4 participants
[nested] [flat]

* pgsql: Try to fix compiler warnings.
@ 2021-03-12 19:36 Robert Haas <rhaas@postgresql.org>
  2021-03-12 19:52 ` Re: pgsql: Try to fix compiler warnings. er@xs4all.nl
  0 siblings, 1 reply; 5+ messages in thread

From: Robert Haas @ 2021-03-12 19:36 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Try to fix compiler warnings.

Per report from Peter Geoghegan.

Discussion: http://postgr.es/m/CAH2-WznpwULZ3uJ1_6WXvNMXYbOy8k8tYs3r=qSdGmZeRd6tDw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d60e61de4fb4a8e7ca88204c2c409e7380887d76

Modified Files
--------------
src/bin/pg_amcheck/pg_amcheck.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Try to fix compiler warnings.
  2021-03-12 19:36 pgsql: Try to fix compiler warnings. Robert Haas <rhaas@postgresql.org>
@ 2021-03-12 19:52 ` er@xs4all.nl
  2021-03-12 20:06   ` Re: pgsql: Try to fix compiler warnings. Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: er@xs4all.nl @ 2021-03-12 19:52 UTC (permalink / raw)
  To: Robert Haas <rhaas@postgresql.org>; pgsql-committers@lists.postgresql.org


> On 2021.03.12. 20:36 Robert Haas <rhaas@postgresql.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


> 
> Discussion: http://postgr.es/m/CAH2-WznpwULZ3uJ1_6WXvNMXYbOy8k8tYs3r=qSdGmZeRd6tDw@mail.gmail.com
> 
> Branch
> ------
> master
> 
> Details
> -------
> https://git.postgresql.org/pg/commitdiff/d60e61de4fb4a8e7ca88204c2c409e7380887d76
> 
> Modified Files
> --------------
> src/bin/pg_amcheck/pg_amcheck.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Try to fix compiler warnings.
  2021-03-12 19:36 pgsql: Try to fix compiler warnings. Robert Haas <rhaas@postgresql.org>
  2021-03-12 19:52 ` Re: pgsql: Try to fix compiler warnings. er@xs4all.nl
@ 2021-03-12 20:06   ` Robert Haas <robertmhaas@gmail.com>
  2021-03-12 20:18     ` Re: pgsql: Try to fix compiler warnings. Erik Rijkers <er@xs4all.nl>
  0 siblings, 1 reply; 5+ messages in thread

From: Robert Haas @ 2021-03-12 20:06 UTC (permalink / raw)
  To: Erik Rijkers <er@xs4all.nl>; +Cc: pgsql-committers <pgsql-committers@lists.postgresql.org>

On Fri, Mar 12, 2021 at 2:52 PM <er@xs4all.nl> wrote:
> > On 2021.03.12. 20:36 Robert Haas <rhaas@postgresql.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





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Try to fix compiler warnings.
  2021-03-12 19:36 pgsql: Try to fix compiler warnings. Robert Haas <rhaas@postgresql.org>
  2021-03-12 19:52 ` Re: pgsql: Try to fix compiler warnings. er@xs4all.nl
  2021-03-12 20:06   ` Re: pgsql: Try to fix compiler warnings. Robert Haas <robertmhaas@gmail.com>
@ 2021-03-12 20:18     ` Erik Rijkers <er@xs4all.nl>
  2021-03-13 01:09       ` Re: pgsql: Try to fix compiler warnings. Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Erik Rijkers @ 2021-03-12 20:18 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: pgsql-committers <pgsql-committers@lists.postgresql.org>

> On 2021.03.12. 21:06 Robert Haas <robertmhaas@gmail.com> wrote:
> On Fri, Mar 12, 2021 at 2:52 PM <er@xs4all.nl> wrote:
> > > On 2021.03.12. 20:36 Robert Haas <rhaas@postgresql.org> wrote:
> > ../../../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

Sorry, I could have been clearer; I meant that /earlier/ I had the same error that Peter reported. 

Now compile is OK again, no errors, no warnings. Thanks.

Erik





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Try to fix compiler warnings.
  2021-03-12 19:36 pgsql: Try to fix compiler warnings. Robert Haas <rhaas@postgresql.org>
  2021-03-12 19:52 ` Re: pgsql: Try to fix compiler warnings. er@xs4all.nl
  2021-03-12 20:06   ` Re: pgsql: Try to fix compiler warnings. Robert Haas <robertmhaas@gmail.com>
  2021-03-12 20:18     ` Re: pgsql: Try to fix compiler warnings. Erik Rijkers <er@xs4all.nl>
@ 2021-03-13 01:09       ` Robert Haas <robertmhaas@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Robert Haas @ 2021-03-13 01:09 UTC (permalink / raw)
  To: Erik Rijkers <er@xs4all.nl>; +Cc: pgsql-committers <pgsql-committers@lists.postgresql.org>

On Fri, Mar 12, 2021 at 3:18 PM Erik Rijkers <er@xs4all.nl> wrote:
> Now compile is OK again, no errors, no warnings. Thanks.

Cool, thanks for confirming.

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





^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2021-03-13 01:09 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-03-12 19:36 pgsql: Try to fix compiler warnings. Robert Haas <rhaas@postgresql.org>
2021-03-12 19:52 ` er@xs4all.nl
2021-03-12 20:06   ` Robert Haas <robertmhaas@gmail.com>
2021-03-12 20:18     ` Erik Rijkers <er@xs4all.nl>
2021-03-13 01:09       ` Robert Haas <robertmhaas@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox