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

Hi,
There's a bug report from a guy running Mac OS X 10.6, perl 5.10.0 and gcc-4.2 where every instance of New() generates a warning - eg:
Random.xs:13: warning: format not a string literal and no format argum +ents
is in response to
SV * Rgmp_randinit_default() { gmp_randstate_t * rand_obj; SV * obj_ref, * obj; New(1, rand_obj, 1, gmp_randstate_t); /* line 13 */ ....
Google supplies plenty of hits for the warning, but I haven't yet been able to understand why that particular piece of code should produce that particular warning - and I don't have access to a machine that exhibits the behaviour.

Has anyone struck (and solved ?) this before ? It's not critical, but it would be nice to quiet those warnings.

Cheers,
Rob

Replies are listed 'Best First'.
Re: [Mac OS X] New() produces odd compiler warnings
by dave_the_m (Monsignor) on Jun 19, 2010 at 08:53 UTC
    Part of the macro expansion of New() does a check for wrap-around, and the bit that prints the error message generates that warning. It's harmless, but has been fixed in 5.10.1

    Dave.

Re: [Mac OS X] New() produces odd compiler warnings
by ikegami (Patriarch) on Jun 18, 2010 at 23:31 UTC

    In theory, the warning comes from doing something like

    fprintf(f, s);
    instead of
    fprintf(f, "%s", s);

    Pass the .c through the preprocessor and see what you end up with.