develooper Front page | perl.perl5.porters | Postings from November 2013

DynaLoader broken on older compilers (mixed declarations)

Thread Next
From:
H.Merijn Brand
Date:
November 25, 2013 08:44
Subject:
DynaLoader broken on older compilers (mixed declarations)
Message ID:
20131125094351.3e269d5a@pc09.procura.nl
Compliance: Mixed declarations not allowed in some pre-C99 compilers

This change:
--8<---
Author: Father Chrysostomos <sprout@cpan.org>  2013-11-24 01:38:30
Committer: Father Chrysostomos <sprout@cpan.org>  2013-11-24 01:41:20
Parent: a2235d78944d9a704217e0fc4943f3f90ac51cc8 (Increase $PerlIO::via::VERSION to 0.14)
Child:  3407f4a92d7d9731d099e0290b68d7e983ff2497 (Increase $XS::Typemap::VERSION to 0.13)
Branches: blead, remotes/origin/blead
Follows: v5.19.6
Precedes: 

    Squash COWs in the char* typemap
-->8---

Breaks all older compilers, as the init sequence has changed :( :(
I'd again would ask for camel to build with c89

--8<--- DynaLoader.xs
void
dl_find_symbol(libhandle, symbolname)
    void *	libhandle
    char *	symbolname
    CODE:
    shl_t obj = (shl_t) libhandle;      /* <-- line 123 */
    void *symaddr = NULL;
    int status;
#ifdef __hp9000s300
    symbolname = Perl_form_nocontext("_%s", symbolname);
#endif
    DLDEBUG(2, PerlIO_printf(Perl_debug_log,
			     "dl_find_symbol(handle=%lx, symbol=%s)\n",
			     (unsigned long) libhandle, symbolname));

    ST(0) = sv_newmortal() ;
    errno = 0;
-->8---

translates to
--8<--- DynaLoader.c
XS_EUPXS(XS_DynaLoader_dl_find_symbol); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_DynaLoader_dl_find_symbol)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "libhandle, symbolname");
    {
	void *	libhandle = INT2PTR(void *,SvIV(ST(0)))
;
	char *	symbolname;

	STMT_START {
		SV * const t_pv_tmp_sv = ST(1);
		/* Note: This code works in 5.16 as well as 5.20, which is
		   not strictly necessary, since this typemap is not dual-
		   lifed.  However, keeping this extra logic will make it
		   easier to backport if we decide to dual-life it, or if
		   someone copies the latest typemap into a CPAN dist.  */
		/* This takes advantage of the fact that SvIsCOW always
		   returned 1 or 0 back when all COWs were marked read-only
		   (pre-v5.17.5-484-ge3918bb0, when SvREADONLY did not nec-
		   essarily actually mean read-only) and SVf_IsCOW or 0
		   thereafter. */
		if ((SvIsCOW(t_pv_tmp_sv) && !SvREADONLY(t_pv_tmp_sv))
		 || SvIsCOW(t_pv_tmp_sv) == 1)
		    sv_force_normal(t_pv_tmp_sv);
		symbolname = (char *)SvPV_nolen(t_pv_tmp_sv);
	} STMT_END
;
#line 123 "DynaLoader.xs"
    shl_t obj = (shl_t) libhandle;
    void *symaddr = NULL;
    int status;
#ifdef __hp9000s300
    symbolname = Perl_form_nocontext("_%s", symbolname);
#endif
    DLDEBUG(2, PerlIO_printf(Perl_debug_log,
			     "dl_find_symbol(handle=%lx, symbol=%s)\n",
			     (unsigned long) libhandle, symbolname));

    ST(0) = sv_newmortal() ;
    errno = 0;
-->8---


Running Makefile.PL in ext/DynaLoader
../../miniperl -I../../lib Makefile.PL INSTALLDIRS=perl INSTALLMAN1DIR=none INSTALLMAN3DIR=none PERL_CORE=1 LIBPERL_A=libperl.a LINKTYPE=static CCCDLFLAGS=
Generating a Unix-style Makefile
Writing Makefile for DynaLoader
make[1]: Entering directory `/pro/3gl/CPAN/perl-current/ext/DynaLoader'
make[1]: Leaving directory `/pro/3gl/CPAN/perl-current/ext/DynaLoader'
Making all in ext/DynaLoader
 make all PERL_CORE=1 LIBPERL_A=libperl.a LINKTYPE=static CCCDLFLAGS=
make[1]: Entering directory `/pro/3gl/CPAN/perl-current/ext/DynaLoader'
../../miniperl "-I../../lib" "-I../../lib" DynaLoader_pm.PL DynaLoader.pm
cp DynaLoader.pm ../../lib/DynaLoader.pm
rm -f DynaLoader.xs
cp dl_hpux.xs DynaLoader.xs
../../miniperl "-I../../lib" "-I../../lib" ../../lib/ExtUtils/xsubpp -noprototypes -typemap ../../lib/ExtUtils/typemap DynaLoader.xs > DynaLoader.xsc && mv DynaLoader.xsc DynaLoader.c
cc -c   -Ae -DPERL_DONT_CREATE_GVSV +DAportable +Z -z -D_HPUX_SOURCE -Wl,+vnocompatwarnings -I/pro/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +O2 +Onolimit   -DVERSION=\"1.21\" -DXS_VERSION=\"1.21\"  "-I../.."  -DLIBC="/lib/libc.sl" DynaLoader.c
cc: "DynaLoader.xs", line 123: error 1000: Unexpected symbol: "shl_t".
cc: "DynaLoader.xs", line 124: error 1000: Unexpected symbol: "void".
cc: "DynaLoader.xs", line 125: error 1000: Unexpected symbol: "int".
cc: "DynaLoader.xs", line 123: error 1588: "obj" undefined.
cc: "DynaLoader.xs", line 124: error 1558: The ! operator takes a scalar operand.
cc: "DynaLoader.xs", line 124: error 1549: Modifiable lvalue required for assignment operator.
cc: "DynaLoader.xs", line 124: error 1588: "symaddr" undefined.
cc: "DynaLoader.xs", line 125: error 1588: "status" undefined.
cc: "DynaLoader.xs", line 133: error 1558: The ! operator takes a scalar operand.
cc: "DynaLoader.xs", line 136: warning 563: Argument #1 is not the correct type.
cc: "DynaLoader.xs", line 136: warning 604: Pointers are not assignment-compatible.
cc: "DynaLoader.xs", line 136: warning 563: Argument #2 is not the correct type.
cc: "DynaLoader.xs", line 136: warning 527: Integral value implicitly converted to pointer in assignment.
cc: "DynaLoader.xs", line 136: warning 563: Argument #3 is not the correct type.
cc: "DynaLoader.xs", line 136: warning 563: Argument #4 is not the correct type.
cc: "DynaLoader.xs", line 139: error 1563: Expression in if must be scalar.
cc: "DynaLoader.xs", line 140: warning 563: Argument #1 is not the correct type.
cc: "DynaLoader.xs", line 140: warning 604: Pointers are not assignment-compatible.
cc: "DynaLoader.xs", line 140: warning 563: Argument #2 is not the correct type.
cc: "DynaLoader.xs", line 140: warning 527: Integral value implicitly converted to pointer in assignment.
cc: "DynaLoader.xs", line 140: warning 563: Argument #3 is not the correct type.
cc: "DynaLoader.xs", line 140: warning 563: Argument #4 is not the correct type.
cc: "DynaLoader.xs", line 144: error 1563: Expression in if must be scalar.
cc: "DynaLoader.xs", line 147: error 1527: Incompatible types in cast: Must cast from scalar to scalar or to void type.
make[1]: *** [DynaLoader.o] Error 1
make[1]: Leaving directory `/pro/3gl/CPAN/perl-current/ext/DynaLoader'
Unsuccessful make(ext/DynaLoader): code=512 at make_ext.pl line 524.
make: *** [DynaLoader.o] Error 25


-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.19   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About