Closed p5pRT closed 21 years ago
On win32 - W2K and W98SE - the following compiler diagnostic is given. On AIX\, no such diagnostic is given.
cl -c -I..\lib\CORE -I.\include -I. -I.. [...] ..\pp_sys.c pp_sys.c ...\pp_sys.c(2209) : warning C4715: 'Perl_pp_ioctl' : not all control paths return a value
The problem is in the code:
C:\perl-5.8.0-RC3> sed 2174\,2209!d pp_sys.c if (optype == OP_IOCTL) #ifdef HAS_IOCTL retval = PerlLIO_ioctl(PerlIO_fileno(IoIFP(io))\, func\, s); #else DIE(aTHX_ "ioctl is not implemented"); #endif else #ifdef HAS_FCNTL #if defined(OS2) && defined(__EMX__) retval = fcntl(PerlIO_fileno(IoIFP(io))\, func\, (int)s); #else retval = fcntl(PerlIO_fileno(IoIFP(io))\, func\, s); #endif
if (SvPOK(argsv)) { if (s[SvCUR(argsv)] != 17) DIE(aTHX_ "Possible memory corruption: %s overflowed 3rd argument"\, OP_NAME(PL_op)); s[SvCUR(argsv)] = 0; /* put our null back */ SvSETMAGIC(argsv); /* Assume it has changed */ }
if (retval == -1) RETPUSHUNDEF; if (retval != 0) { PUSHi(retval); } else { PUSHp(zero_but_true\, ZBTLEN); } RETURN;
#else DIE(aTHX_ "fcntl is not implemented"); #endif }
C:\perl-5.8.0-RC3>
With HAS_IOCTL and !HAS_FCNTL\, this reduces to:
if (optype == OP_IOCTL) retval = PerlLIO_ioctl(PerlIO_fileno(IoIFP(io))\, func\, s); else DIE(aTHX_ "fcntl is not implemented"); }
This is macro-expanded to:
if (optype == OP_IOCTL) retval = win32_ioctl((Perl_PerlIO_fileno(my_perl\, ((XPVIO*) (io)->sv_any)->xio_ifp))\, (func)\, (s)); else return Perl_die(my_perl\, "fcntl is not implemented"); }
This incorrect code MAY do what is needed if retval is written via the register which returns the value of Perl_pp_ioctl().
This is a minimum change to produce plausible code:
C:\perl-5.8.0-RC3\win32> \wfb\bin\diff -c ../0pp_sys.c ../pp_sys.c *** ../0pp_sys.c Sat Jul 13 14:56:14 2002 --- ../pp_sys.c Mon Jul 15 20:52:10 2002 *************** *** 2201\,2211 **** else { PUSHp(zero_but_true\, ZBTLEN); } - RETURN; - #else DIE(aTHX_ "fcntl is not implemented"); #endif }
PP(pp_flock) --- 2201\,2210 ---- else { PUSHp(zero_but_true\, ZBTLEN); } #else DIE(aTHX_ "fcntl is not implemented"); #endif + RETURN; }
PP(pp_flock)
C:\perl-5.8.0-RC3\win32> dmake ..\pp_sys.obj cl -c -I..\lib\CORE -I.\include -I. -I.. [...] ..\pp_sys.c pp_sys.c
C:\perl-5.8.0-RC3\win32>
I think this change produces a more pleasing structure:
C:\perl-5.8.0-RC3\win32> \wfb\bin\diff -c ../0pp_sys.c ../pp_sys.c *** ../0pp_sys.c Sat Jul 13 14:56:14 2002 --- ../pp_sys.c Mon Jul 15 21:04:04 2002 *************** *** 2178\,2184 **** DIE(aTHX_ "ioctl is not implemented"); #endif else ! #ifdef HAS_FCNTL #if defined(OS2) && defined(__EMX__) retval = fcntl(PerlIO_fileno(IoIFP(io))\, func\, (int)s); #else --- 2178\,2186 ---- DIE(aTHX_ "ioctl is not implemented"); #endif else ! #ifndef HAS_FCNTL ! DIE(aTHX_ "fcntl is not implemented"); ! #else #if defined(OS2) && defined(__EMX__) retval = fcntl(PerlIO_fileno(IoIFP(io))\, func\, (int)s); #else *************** *** 2201\,2211 **** else { PUSHp(zero_but_true\, ZBTLEN); } - RETURN; - - #else - DIE(aTHX_ "fcntl is not implemented"); #endif }
PP(pp_flock) --- 2203\,2210 ---- else { PUSHp(zero_but_true\, ZBTLEN); } #endif + RETURN; }
PP(pp_flock)
C:\perl-5.8.0-RC2>
This patch made it in to Perl 5.8.0\, I'm marking the problem ticket as resolved.
@jhi - Status changed from 'open' to 'resolved'
Migrated from rt.perl.org#10074 (status was 'resolved')
Searchable as RT10074$