Re: src/tools/msvc usage instructions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeremy Drake <pgsql(at)jdrake(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: src/tools/msvc usage instructions
Date: 2006-10-02 15:13:57
Message-ID: 10900.1159802037@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeremy Drake <pgsql(at)jdrake(dot)com> writes:
> The errors I got on this file were:
> 1>bootparse.tab.c(1065) : error C2449: found '{' at file scope (missing function header?)

I looked at this. Line 1065 is the left brace starting yyparse(). On
my Fedora Core 5 box with Bison 2.1 installed, the stuff leading up to
it is

#ifdef YYPARSE_PARAM
... some uninteresting stuff, since we don't define YYPARSE_PARAM ...
#else /* ! YYPARSE_PARAM */
#if defined (__STDC__) || defined (__cplusplus)
int
yyparse (void)
#else
int
yyparse ()

#endif
#endif
{

But lookee here, your Windows-built version has

#ifdef YYPARSE_PARAM
...
#else /* ! YYPARSE_PARAM */
#if defined (__STDC__) || defined (__cplusplus)
int
yyparse (void)
#else
int
yyparse ()
;
#endif
#endif
{

So that semicolon is the source of the trouble. That's clearly a bison
bug, and in fact digging in Red Hat's SRPM shows that they are carrying
a patch for it:

2005-10-05 Paul Eggert <eggert(at)cs(dot)ucla(dot)edu>

* data/m4sugar/m4sugar.m4 (_m4_map): New macro.
(m4_map, m4_map_sep): Use it. Handle the empty list correctly.

--- bison-2.1/data/m4sugar/m4sugar.m4
+++ bison-2.1/data/m4sugar/m4sugar.m4
@@ -398,8 +398,11 @@ m4_define([m4_cdr],
# of LIST (which can be lists themselves, for multiple arguments MACROs).
m4_define([m4_fst], [$1])
m4_define([m4_map],
+[m4_if([$2], [[]], [],
+ [_m4_map([$1], [$2])])])
+m4_define([_m4_map],
[m4_ifval([$2],
- [$1(m4_fst($2))[]m4_map([$1], m4_cdr($2))])])
+ [$1(m4_fst($2))[]_m4_map([$1], m4_cdr($2))])])


# m4_map_sep(MACRO, SEPARATOR, LIST)
@@ -408,8 +411,8 @@ m4_define([m4_map],
# are the elements of LIST (which can be lists themselves, for multiple
# arguments MACROs).
m4_define([m4_map_sep],
-[m4_ifval([$3],
- [$1(m4_fst($3))[]m4_map([$2[]$1], m4_cdr($3))])])
+[m4_if([$3], [[]], [],
+ [$1(m4_fst($3))[]_m4_map([$2[]$1], m4_cdr($3))])])


## ---------------------------------------- ##

Presumably bison 2.2 includes this fix. But I guess the real question
is why the devil doesn't MSVC define __STDC__ ? Are they that far
removed from spec compliance?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-10-02 15:20:24 Re: Another idea for dealing with cmin/cmax
Previous Message Andrew Dunstan 2006-10-02 15:03:38 Re: In which module does query rewriting takes place