Re: C++ keywords in headers (was Re: [GENERAL] #include <funcapi.h>)

Alvaro Herrera <alvherre@commandprompt.com>

From: Alvaro Herrera <alvherre@commandprompt.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter_e@gmx.net>, Craig Ringer <craig@postnewspapers.com.au>, Elliot Chance <elliotchance@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2010-12-27T17:11:36Z
Lists: pgsql-hackers
Excerpts from Tom Lane's message of lun dic 27 13:54:56 -0300 2010:

> [ lightbulb ] ... although we could improve that quite a bit if we
> processed each .h file separately instead of insisting on smashing
> everything into one compilation.  Let me go try that.

FWIW I have this patch lingering about that I wrote months ago, to check
for header problems (not C++ stuff, just things like forgetting to
include some necessary header in some other header).  Since it needs a
lot of polish (needs to ignore certain headers, and avoid leave
lingering files around), I didn't commit it; and I haven't updated it to
the new Make recursive stuff, either.  Maybe someone else knows what to
do with it, though.

*** a/src/include/Makefile
--- b/src/include/Makefile
*************** uninstall:
*** 60,65 ****
--- 60,72 ----
  # heuristic...
  	rm -rf $(addprefix '$(DESTDIR)$(includedir_server)'/, $(SUBDIRS) *.h)
  
+ check:
+ 	for dir in $(SUBDIRS); do \
+ 		for header in `find $(srcdir)/$$dir -type f -name \*.h`; do \
+ 			echo $$header; \
+ 			$(CC) $(CFLAGS) $(CPPFLAGS) -include postgres.h -o $$dir/`basename $$header .h`.gch $$header; \
+ 		done; \
+ 	done
  
  clean:
  	rm -f utils/fmgroids.h parser/gram.h utils/probes.h catalog/schemapg.h

-- 
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support