Re: Compile warnings in dbcommands.c building with meson

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Aleksander Alekseev <aleksander(at)timescale(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Compile warnings in dbcommands.c building with meson
Date: 2024-01-12 05:19:34
Message-ID: CACJufxGPkiED5C8T2S=D7y8ki9coCc37oVQjZCO1LmVZmBQGHQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 12, 2024 at 1:05 AM Magnus Hagander <magnus(at)hagander(dot)net> wrote:
>
> On Wed, Jan 10, 2024 at 1:16 PM Aleksander Alekseev
> <aleksander(at)timescale(dot)com> wrote:
> >
> > Hi,
> >
> > > When building current head on debian bullseye I get this compile warning:
> > >
> > > In file included from ../src/backend/commands/dbcommands.c:20:
> > > ../src/backend/commands/dbcommands.c: In function ‘createdb’:
> > > ../src/include/postgres.h:104:9: warning: ‘src_hasloginevt’ may be
> > > used uninitialized in this function [-Wmaybe-uninitialized]
> > > 104 | return (Datum) (X ? 1 : 0);
> > > | ^~~~~~~~~~~~~~~~~~~
> > > ../src/backend/commands/dbcommands.c:683:8: note: ‘src_hasloginevt’
> > > was declared here
> > > 683 | bool src_hasloginevt;
> > > | ^~~~~~~~~~~~~~~
> > >
> > >
> > > I only get this when building with meson, not when building with
> > > autotools. AFAICT, I have the same config:
> > >
> > > ./configure --enable-debug --enable-depend --with-python
> > > --enable-cassert --with-openssl --enable-tap-tests --with-icu
> > >
> > > vs
> > >
> > > meson setup build -Ddebug=true -Dpython=true -Dcassert=true
> > > -Dssl=openssl -Dtap-test=true -Dicu=enabled -Dnls=disabled
> > >
> > >
> > > in both cases the compiler is:
> > > gcc (Debian 10.2.1-6) 10.2.1 20210110
> >
> > Seems to me that the compiler is not smart enough to process:
> >
> > ```
> > if (!get_db_info(dbtemplate, ShareLock,
> > &src_dboid, &src_owner, &src_encoding,
> > &src_istemplate, &src_allowconn, &src_hasloginevt,
> > &src_frozenxid, &src_minmxid, &src_deftablespace,
> > &src_collate, &src_ctype, &src_iculocale,
> > &src_icurules, &src_locprovider,
> > &src_collversion))
> > ereport(ERROR, ...
> > ```
> >
> > Should we just silence the warning like this - see attachment? I don't
> > think createdb() is called that often to worry about slight
> > performance change, if there is any.
>
> Certainly looks that way, but I'm curious as to why nobody else has seen this..
>

I saw it sometimes, sometimes not.
Now I think the reason is:
it will appear when you do `-Dbuildtype=release`.

but it will not occur when I do:
`-Dbuildtype=debug`

my current meson version is 1.3.1, my ninja version is 1.10.1.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2024-01-12 05:41:09 Re: Synchronizing slots from primary to standby
Previous Message Hayato Kuroda (Fujitsu) 2024-01-12 05:08:57 RE: speed up a logical replica setup