Re: consider -Wmissing-variable-declarations - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: consider -Wmissing-variable-declarations
Date
Msg-id 69d9824f-00ea-49b6-b68d-96f0806ec454@iki.fi
Whole thread Raw
In response to consider -Wmissing-variable-declarations  (Peter Eisentraut <peter@eisentraut.org>)
Responses Re: consider -Wmissing-variable-declarations
List pgsql-hackers
On 09/05/2024 12:23, Peter Eisentraut wrote:
> In [0] I had noticed that we have no automated verification that global
> variables are declared in header files.  (For global functions, we have
> this through -Wmissing-prototypes.)  As I mentioned there, I discovered
> the Clang compiler option -Wmissing-variable-declarations, which does
> exactly that.  Clang has supported this for quite some time, and GCC 14,
> which was released a few days ago, now also supports it.  I went and
> installed this option into the standard build flags and cleaned up the
> warnings it found, which revealed a number of interesting things.

Nice! More checks like this is good in general.

> Attached are patches organized by sub-topic.  The most dubious stuff is
> in patches 0006 and 0007.  A bunch of GUC-related variables are not in
> header files but are pulled in via ad-hoc extern declarations.  I can't
> recognize an intentional scheme there, probably just done for
> convenience or copied from previous practice.  These should be organized
> into appropriate header files.

+1 for moving all these to header files. Also all the "other stuff" in 
patch 0007.

-- 
Heikki Linnakangas
Neon (https://neon.tech)




pgsql-hackers by date:

Previous
From: Nazir Bilal Yavuz
Date:
Subject: Re: gcc 12.1.0 warning
Next
From: Nazir Bilal Yavuz
Date:
Subject: Re: Fix parallel vacuum buffer usage reporting