Errors generating compiler/parser/Parser.hs with Happy 1.16 under mingw

Peter Tanski p.tanski at gmail.com
Sat Jul 21 19:08:27 EDT 2007


On Jul 21, 2007, at 6:24 PM, Ian Lynagh wrote:
> On Thu, Jul 19, 2007 at 08:57:36PM -0400, Peter Tanski wrote:
>>
>> Sorry, I forgot to attach the original Parser.hs file.  Here it is:
>
> Looks like the problem is before this point. You have a space before
> #include "HsVersions.h"
> when there shouldn't be one. In my log this file is built with:
>
> c:/mingw/bin/gcc -E -mno-cygwin  -undef -traditional -P -I../ 
> includes    -x c parser/Parser.y.pp | \
>         grep -v '^#pragma GCC' > parser/Parser.y
>
> so if you are using a different C compiler then perhaps the problem is
> that its preprocessor works differently?

That seems to be what it is: the preprocessor for gcc 3.4.5 (Mingw  
special) inserts a space:
 > cat TstFile.pp

#define INCLUDE #include
INCLUDE "HsVersions.h"

 > gcc -E -u -P TstFile.pp
  #include "HsVersions.h
^
If it isn't apparent from the email, it does insert a space; it does  
recognise the --traditional flag but that makes no difference (it  
still inserts a space, though I don't know why configure didn't pick  
it up and add it to RAWCPP_FLAGS).  At least it isn't a problem with  
Happy or Parser.y.pp.  I think gcc-3.4.5's preprocessor is reading  
the the # as a concatenation operator and concatenating the space-- 
but then why would it include # in the output?  Odd.

Cheers,
Pete



More information about the Cvs-ghc mailing list