I found CVS HEAD is broken and the following error is reported.
My environment is RHEL4 Update 2 x86_64 with gcc 3.4.4 and flex 2.5.33.

In file included from ../../../src/include/port.h:17,
                 from ../../../src/include/c.h:841,
                 from ../../../src/include/postgres_fe.h:21,
                 from psqlscan.l:40:
/usr/include/netdb.h:560: error: syntax error before '[' token
make[3]: *** [psqlscan.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [all] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2


The suspect is flex (or yy template file). It defines "__unused" to
be empty, but netdb.h uses "__unused" as a variable.
I found a similar case from google.
http://mailman.icsi.berkeley.edu/pipermail/xorp-cvs/2007-March/009928.html

[src/bin/psql/psqlscan.c]
      9 #if defined(__FreeBSD__)
     10 #include <sys/cdefs.h>
     11 #else
->   12 #define __unused
     13 #endif

[/usr/include/netdb.h]
    552 struct gaicb
    553 {
    554   const char *ar_name;          /* Name to look up.  */
    555   const char *ar_service;       /* Service name.  */
    556   const struct addrinfo *ar_request; /* Additional request 
specification.  */
    557   struct addrinfo *ar_result;   /* Pointer to result.  */
    558   /* The following are internal elements.  */
    559   int __return;
->  560   int __unused[5];
    561 };


Here is a brute fix for the problem, but it is probably improper.
What is better way to fix?

Index: src/include/port.h
===================================================================
--- src/include/port.h  (HEAD)
+++ src/include/port.h  (working copy)
@@ -13,6 +13,7 @@
 #ifndef PG_PORT_H
 #define PG_PORT_H
 
+#undef __unused
 #include <ctype.h>
 #include <netdb.h>
 #include <pwd.h>

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to