Bruce Momjian wrote:

> The script certainly has no way to know it is missing an extern, and I
> am not sure how I would even teach it that trick.
> 
> The example you saw was:
> 
>   src/include/optimizer/cost.h:55:extern bool constraint_exclusion;
>   src/backend/optimizer/util/plancat.c:46:bool constraint_exclusion = false;
> 
> The only clean way I can think of to fix this would be to have all the
> globals in a single C file that is included as part of postgres.h. 

Agreed, it seems pretty difficult.  Another insane idea is to grep all
the header files and make sure that no header contains an identically
named variable to a variable not marked static.

It would be easy if the compiler were to have an option to throw a
warning when it finds a non-static variable that doesn't have a
corresponding extern declaration.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to