Re: Significant oversight in that #include-removal script

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Significant oversight in that #include-removal script
Date: 2009-01-07 22:07:12
Message-ID: 20090107220712.GF14891@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2009-01-07 22:08:08 Re: Latest version of Hot Standby patch
Previous Message Hiroshi Inoue 2009-01-07 22:03:32 Re: [BUGS] BUG #4186: set lc_messages does not work