Re: consider -Wmissing-variable-declarations

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Date: 2024-06-18T07:41:55Z
Lists: pgsql-hackers

Attachments

Here is an updated patch set.  I have implemented proper solutions for 
the various hacks in the previous patch set.  So this patch set should 
now be ready for proper consideration.

The way I have organized it here is that patches 0002 through 0008 
should be improvements in their own right.

The remaining two patches 0009 and 0010 are workarounds that are just 
necessary to satisfy -Wmissing-variable-declarations.  I haven't made up 
my mind if I'd want to take the bison patch 0010 like this and undo it 
later if we move to pure parsers everywhere, or instead wait for the 
pure parsers to arrive before we install -Wmissing-variable-declarations 
for everyone.

Obviously, people might also have opinions on some details of where 
exactly to put the declarations etc.  I have tried to follow existing 
patterns as much as possible, but those are also not necessarily great 
in all cases.

Commits

  1. Use CXXFLAGS instead of CFLAGS for linking C++ code

  2. Add -Wmissing-variable-declarations to the standard compilation flags

  3. Include bison header files into implementation files

  4. Fix -Wmissing-variable-declarations warnings for float.c special case

  5. Add extern declarations for Bison global variables

  6. Move all extern declarations for GUC variables to header files

  7. Move extern declarations for EXEC_BACKEND to header files

  8. Get rid of a global variable

  9. Add missing includes for some global variables

  10. Convert some extern variables to static

  11. Improve some global variable declarations

  12. Remove useless extern keywords