Re: Convert varatt.h macros to static inline functions

Masahiko Sawada <sawada.mshk@gmail.com>

From: Masahiko Sawada <sawada.mshk@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter@eisentraut.org>, Michael Paquier <michael@paquier.xyz>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-08-05T22:07:25Z
Lists: pgsql-hackers

Attachments

On Tue, Aug 5, 2025 at 2:39 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Masahiko Sawada <sawada.mshk@gmail.com> writes:
> > On Tue, Aug 5, 2025 at 1:59 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> Maybe there's some strange cross-distro difference here, but
> >> what I'm wondering is if there's a difference in CFLAGS.
> >> My build used
> >>
> >> CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -Wmissing-variable-declarations -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -O2
>
> > Yeah, interestingly I didn't see the warning with CFLAGS your build
> > used but got it if I use -O0 instead of -O2.
>
> I checked the buildfarm, and (so far) adder and flaviventris have
> shown this warning, but nothing else has.  adder is using gcc 14.2.0
> with -O0, while flaviventris is using gcc 16.0.0 with -O0.

Indeed. Thank you for checking.

>  Also
> I tried -O0 with gcc 15.1.1 on my Fedora 42 box, and now it shows the
> warning.  So maybe the difference is just -O0?  But I think there are
> other buildfarm animals using that, so I'm not certain we've explained
> the difference fully.
>
> Anyway, based on that I think there's enough reason to go ahead
> with your patch.

Agreed. I've attached the patch. I'll push it, barring comments.

Regards,

-- 
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com

Commits

  1. Suppress maybe-uninitialized warning.

  2. Convert varatt.h access macros to static inline functions.

  3. Fix varatt versus Datum type confusions