cmac has asked for the wisdom of the Perl Monks concerning the following question:

Just submitted a new version of my CPAN XS module. Something in one of the tools involved in making this module must have changed, because when I 'make' the module I get lots of error messages like the last 2 lines:
cc -c -I/usr/local/include -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fn +o-strict-aliasing -pipe -I/usr/local/include -O2 -DVERSION=\"0.54\ +" -DXS_VERSION=\"0.54\" -DPIC -fPIC "-I/usr/local/lib/perl5/5.8.9/i3 +86-freebsd/CORE" MMA.c MMA.c: In function `boot_IPC__MMA': MMA.c:3033: warning: passing arg 3 of `Perl_newXS' discards qualifiers + from pointer target type MMA.c:3034: warning: passing arg 3 of `Perl_newXS' discards qualifiers + from pointer target type
Here is what the start of the subject routine looks like:
XS(boot_IPC__MMA) { #ifdef dVAR dVAR; dXSARGS; #else dXSARGS; #endif char* file = __FILE__; PERL_UNUSED_VAR(cv); /* -W */ PERL_UNUSED_VAR(items); /* -W */ XS_VERSION_BOOTCHECK ; { CV * cv ; newXS("IPC::MMA::constant", XS_IPC__MMA_constant, file); newXS("IPC::MMA::mm_create", XS_IPC__MMA_mm_create, file);
I think these are due to the tools because I go back to my previous version and get the same messages, which didn't used to happen. In fact, the lines above are from my previous version.

Has anyone seen such warnings before? How do I get rid of them? They are likely to alarm potential users.

cmac

Replies are listed 'Best First'.
Re: warnings in XS make
by chromatic (Archbishop) on Aug 11, 2009 at 05:52 UTC

    Perhaps you updated Devel::PPPort. Change this line:

        char* file = __FILE__;

    ... to:

        const char * const file = __FILE__;

    I believe that will remove the warnings. If not (I don't recall exactly which qualifiers __FILE__ may have here), they're reasonably safe to ignore.

      Do you mean I should modify the .c file, or what? A change in the .c file is blown away every time I make any change in my module, or even just 'make clean'.

      ~/.cpan/histfile includes the following lines:
      install ExtUtils::ParseXS install Devel::PPPort
      in the last round of updates from a CPAN 'r' command. From the thread above one of these seems like the likely culprit (?) And from Nicolas Clark's entry in the thread, maybe one of these was only supposed to apply to 5.10?

      So how does one "uninstall" or drop back a version on a CPAN module? In the past I have hacked my way through such things because my @INC has levels from perl 5.8.[789], and it seems like updates at one level don't delete the corresponding file at an older level.

      But as long as I started this thread here at a major fount of Perl knowledge, is there a better/systematic way to undo a CPAN upgrade?

      cmac

        Change that line in your XS file.

        If it's generated code, you're out of luck. Fortunately, these are tame warnings, as far as warnings go. __FILE__ is effectively const * const already.

Re: warnings in XS make
by Anonymous Monk on Aug 11, 2009 at 05:13 UTC
      The arcane communications in the linked thread certainly seem related to this problem, but I have not updated Perl itself. Maybe a "CPAN shell" r command led to updating a tool from CPAN. All of the files involved in this problem were created by the tools, so the thread leaves me without much indication of what to change to eliminate these warnings. Help?
        You don't need to change anything, it doesn't matter, esp on perl versions before 5.10.