Parens to avoid CPP macros in foreign imports

Sven Panne Sven.Panne at aedion.de
Tue Apr 6 11:51:40 EDT 2004


Ian Lynagh wrote:
> [...] Line 29 is the one containing "wstandend" here:
> 
> {
> I_ _ccall_result;
> StgAddr _ccall_arg1=_B0_;
> CALLER_SAVE_SYSTEM
> _ccall_result = (wstandend((_ccall_arg1)));
> CALLER_RESTORE_SYSTEM
> _B3_=_ccall_result;
> }
> 
> which looks like this after cpp:
> 
> {
> I_ _ccall_result;
> StgAddr _ccall_arg1=_B0_;
> 
> _ccall_result = (((((_ccall_arg1))->_attrs = (0L))));
> 
> _B3_=_ccall_result;
> }

Well, this is a perfect example of a broken "optimization" via the use of
macros (missing cast). I remember having to hack around a similar thing
somewhere in the base package, but don't know where exactly. The right thing
would be fixing the header, not GHC. It's a pity that hacks like this still
exists in 2004...

Cheers,
    S.



More information about the Cvs-ghc mailing list