On 2005-02-01, at 09:40:27 +0000, Steve Hay wrote:

> Steve Hay wrote:
> 
> >Automated smoke report for 5.9.2 patch 23914
> >TANGAROA.uk.radan.com:  Intel(R) Pentium(R) 4 CPU 2.00GHz(~1992 MHz) (x86/1 
> >cpu)
> >    on        MSWin32 - WinXP/.Net SP1
> >    using     cl version 12.00.8804
> >    smoketime 2 hours 18 minutes (average 4 minutes 18.906 seconds)
> >
> >Summary: FAIL(M)
> >
> The problem here seems to be changes to Devel::PPPort (change 23912).  
> The build fails trying to make that extension:
> 
>         cl -c    -nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE 
> -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT 
> -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -MD -Zi -DNDEBUG 
> -O1    -DVERSION=\"3.05\"  -DXS_VERSION=\"3.05\"  
> "-I..\..\..\lib\CORE"   PPPort.c
> PPPort.c
> PPPort.xs(84) : warning C4013: 'PerlProc_setjmp' undefined; assuming 
> extern returning int
> PPPort.xs(91) : warning C4013: 'PerlProc_longjmp' undefined; assuming 
> extern returning int
> PPPort.xs(106) : error C2275: 'IV' : illegal use of this type as an 
> expression
>         ..\..\..\lib\CORE\perl.h(1273) : see declaration of 'IV'
> PPPort.xs(106) : error C2146: syntax error : missing ';' before 
> identifier 'iv'
> PPPort.xs(106) : error C2065: 'iv' : undeclared identifier
> NMAKE : fatal error U1077: 'cl' : return code '0x2'
> Stop.
> 
> The attached patch resolves the error there (it's the old 
> code-before-declaration chestnut again, which always screws up the M$ 

Ouch, that one is obvious. I wonder why gcc didn't warn me...

> compiler), but the warnings about PerlProc_{set|long}jmp then become 
> errors when linking:
> 
> PPPort.obj : error LNK2001: unresolved external symbol _PerlProc_longjmp
> PPPort.obj : error LNK2001: unresolved external symbol _PerlProc_setjmp
> ..\..\..\lib\auto\Devel\PPPort\PPPort.dll : fatal error LNK1120: 2 
> unresolved externals
> NMAKE : fatal error U1077: 'link' : return code '0x460'
> Stop.
> 
> What's gone wrong there?  iperlsys.h has:
> 
> #define PerlProc_setjmp(b, n) Sigsetjmp((b), (n))
> #define PerlProc_longjmp(b, n) Siglongjmp((b), (n))
> 
> and win32/config.h has:
> 
> #define Sigsetjmp(buf,save_mask) setjmp((buf))
> #define Siglongjmp(buf,retval) longjmp((buf),(retval))
> 
> but the errors sound like it isn't seeing these #definitions?

Heh. The problem is "infinite" preprocessor recursion.
Basically, this is what happens:

  [EMAIL PROTECTED] $ cat test.c 
  // from config.h
  #define Siglongjmp(buf,retval) longjmp((buf),(retval))
  
  // from iperlsys.h
  #define PerlProc_longjmp(b, n) Siglongjmp((b), (n))
  
  // from XSUB.h
  #define longjmp  PerlProc_longjmp
  
  PerlProc_longjmp(0, 0);

  [EMAIL PROTECTED] $ gcc -E test.c
  # 1 "test.c"
  # 1 "<built-in>"
  # 1 "<command line>"
  # 1 "test.c"
  # 10 "test.c"
  PerlProc_longjmp(((0)),((0)));

So, the preprocessor stops at the point where it detects an
infinite recursion, and that's just where it started from.

The problem will show up on all platforms that don't have
sig(set|long)jmp.

Generally speaking, this means that you cannot use the
iperlsys abstraction from within XS.

As I cannot think of a way to fix this right now, I'll need
to rewrite the exception handling macros to not use iperlsys
abstraction.

Marcus

-- 
work, n.:
        The blessed respite from screaming kids and
        soap operas for which you actually get paid.

Reply via email to