Re: src/tools/msvc usage instructions

From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Jeremy Drake" <pgsql(at)jdrake(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: src/tools/msvc usage instructions
Date: 2006-10-03 05:43:56
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCEA0FC0C@algol.sollentuna.se
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
> > > 1>(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.
> >
> <snip patch>
> >
> > 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?
>
> In the bison 2.2 generated code, the #if check is
>
> #if (defined __STDC__ || defined __C99__FUNC__ \
> || defined __cplusplus || defined _MSC_VER)
>
> which looks like they figured out that they needed to check
> for MicroSoft C explicitly. I have no idea why they do not
> define __STDC__ however.

Can we just define __STDC__ when compiling that file (or rather, when
compiling any bison-generated output file)? Or is that likely to cause
*other* issues?

//Magnus

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2006-10-03 05:50:27 Re: [HACKERS] Bad bug in fopen() wrapper code
Previous Message Magnus Hagander 2006-10-03 05:43:01 Re: src/tools/msvc usage instructions