Re: Significant oversight in that #include-removal script - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Significant oversight in that #include-removal script
Date
Msg-id 20090107220712.GF14891@alvh.no-ip.org
Whole thread Raw
In response to Re: Significant oversight in that #include-removal script  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Significant oversight in that #include-removal script
List pgsql-hackers
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.


pgsql-hackers by date:

Previous
From: Hiroshi Inoue
Date:
Subject: Re: [BUGS] BUG #4186: set lc_messages does not work
Next
From: Simon Riggs
Date:
Subject: Re: Latest version of Hot Standby patch