From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: Significant oversight in that #include-removal script |
Date: | 2009-01-07 21:31:24 |
Message-ID: | 200901072131.n07LVOL19963@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
> I just noticed that optimizer/cost.h is not #include'd by plancat.c,
> which is not too cool because the former has the extern declaration
> for the constraint_exclusion global variable while the latter has
> the actual definition. I didn't run it down in the CVS history to
> make sure, but I imagine what happened is that your unnecessary-includes
> script diked it out because the file still compiled warning-free without
> that header, ie, there is no warning for "int foo;" not preceded by
> "extern int foo;". This isn't real good because it would allow a global
> variable to get out of sync with its declaration. Is there a way to
> prevent such problems in future?
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.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
From | Date | Subject | |
---|---|---|---|
Next Message | Dimitri Fontaine | 2009-01-07 21:40:20 | Re: Do we still need constraint_exclusion? |
Previous Message | Magnus Hagander | 2009-01-07 21:26:04 | Re: [BUGS] BUG #4186: set lc_messages does not work |