Compilation warning with Perl 5.10

Julien ÉLIE julien at
Thu Jul 17 19:09:37 UTC 2008


There is a compilation issue with Perl 5.10 regarding PERL_SYS_INIT3.

It is only a warning with Perl 5.10 (therefore, it breaks "make warnings" for CURRENT).
This problem does not occur with Perl 5.8 (no warning at all).

perl.c: In function 'PERLsetup':
perl.c:116: warning: passing argument 2 of 'Perl_sys_init3' from incompatible pointer type
perl.c:116: warning: passing argument 3 of 'Perl_sys_init3' from incompatible pointer type
perl.c:120: warning: passing argument 2 of 'perl_parse' from incompatible pointer type

This patch solves these warnings:

--- lib/perl.c  (révision 7932)
+++ lib/perl.c  (copie de travail)
@@ -113,14 +113,15 @@
     if (PerlCode == NULL) {
         /* Perl waits on standard input if not called with '-e'. */
         int argc = 3;
-        const char *argv[] = { "innd", "-e", "0", NULL };
-        char *env[]  = { NULL };
+        const char *argv_innd[] = { "innd", "-e", "0", NULL };
+        char **argv = (char **)argv_innd;
+        char **env  = { NULL };
 #ifdef PERL_SYS_INIT3
         PERL_SYS_INIT3(&argc, &argv, &env);
         PerlCode = perl_alloc();
-        perl_parse(PerlCode, xs_init, argc, (char **)argv, env) ;
+        perl_parse(PerlCode, xs_init, argc, argv, env) ;

However, I do not understand why it is required for Perl 5.10.
Why does it prefer **env to *env[]?  Aren't they equivalent?
(except for the fact that *env[] allocates the right number of
elements while **env points to an anonymous address where the
right number of elements is -- but I do not see why it is prefered

As for *argv[], is it the right thing to do?  It seems weird and
looks more a kludge than something proper to do.

Julien ÉLIE

« L'informatique, c'est l'art de passer 15 jours
  à essayer de gagner quelques millisecondes... » 

More information about the inn-workers mailing list