List Info

Thread: Don't use NULL in Perl_die




Don't use NULL in Perl_die
user name
2007-09-24 09:52:50
Attached patch fixes the following compiler warnings:

mg.c: In function `Perl_sighandler':
mg.c:2910: warning: null format string
pp_sys.c: In function `Perl_pp_die':
pp_sys.c:504: warning: null format string

  
Don't use NULL in Perl_die
user name
2007-09-24 10:07:03
On 9/24/07, Jerry D. Hedden <jdheddencpan.org> wrote:
> Attached patch fixes the following compiler warnings:
>
> mg.c: In function `Perl_sighandler':
> mg.c:2910: warning: null format string
> pp_sys.c: In function `Perl_pp_die':
> pp_sys.c:504: warning: null format string

Attached revised patch adds better output when die 'pattern'
is empty.

  
Re: Don't use NULL in Perl_die
user name
2007-09-24 10:37:21
On 9/24/07, Jerry D. Hedden <jdheddencpan.org> wrote:
> On 9/24/07, Jerry D. Hedden <jdheddencpan.org> wrote:
> > Attached patch fixes the following compiler
warnings:
> >
> > mg.c: In function `Perl_sighandler':
> > mg.c:2910: warning: null format string
> > pp_sys.c: In function `Perl_pp_die':
> > pp_sys.c:504: warning: null format string
>
> Attached revised patch adds better output when die
'pattern' is empty.

Hmmm.  I don't think this patch is the correct approach.

It seems that the following:
    Perl_die(_aTHX_ NULL);
produces a "null format string" warning under
FreeBSD.

However, the following:
    Perl_die(_aTHX_ "");
produces a "zero-length printf format string"
warning under Cywgin.

So how should this be changed?  Conditionalize the
expression?

    #if ???
        Perl_die(_aTHX_ NULL);
    #else
        Perl_die(_aTHX_ "");
    #endif

And what should be used for the condition?

Re: Don't use NULL in Perl_die
user name
2007-09-24 11:54:46
On Mon, Sep 24, 2007 at 10:52:50AM -0400, Jerry D. Hedden
wrote:
> Attached patch fixes the following compiler warnings:
> 
> mg.c: In function `Perl_sighandler':
> mg.c:2910: warning: null format string
> pp_sys.c: In function `Perl_pp_die':
> pp_sys.c:504: warning: null format string


But the compiler is wrong, not the code.

Nicholas Clark

RE: Don't use NULL in Perl_die
user name
2007-09-24 13:18:48
Jerry 
 
This is supposed to handled by PRINTF_FORMAT_NULL_OK (or
whatever I called it)
 
The idea is that if a compiler does not allow NULL printf
format strings, 
then the printf-like functions that use NULL formats do not
have the __printf__ attribute.
 
Perl_die(NULL) has special semantics: so can not be replaced
by Perl_die("").
 
Can you post config.sh or myconfig for your configuration, 
it looks as if the __attribute__ macros are not being
properly set.
 
Robin

------------------------------------------------------------
-------
This e-mail and any attachments may contain confidential
and/or
privileged material; it is for the intended addressee(s)
only.
If you are not a named addressee, you must not use, retain
or
disclose such information.

NPL Management Ltd cannot guarantee that the e-mail or any
attachments are free from viruses.

NPL Management Ltd. Registered in England and Wales. No:
2937881
Registered Office: Serco House, 16 Bartley Wood Business
Park,
                   Hook, Hampshire, United Kingdom  RG27
9UY
------------------------------------------------------------
-------
Re: Don't use NULL in Perl_die
user name
2007-09-24 16:51:54
I started on this based on the warnings here:
http://www.nntp.perl.org/group/perl.perl
5.porters/2007/09/msg129030.html
You'd have to get the details from Johan Vroman.  (I stuck
my nose in this
business before fully understanding the problem.  Sorry.)*
*
On 9/24/07, Robin Barker <Robin.Barkernpl.co.uk> wrote:
>
>   Jerry
>
> This is supposed to handled by PRINTF_FORMAT_NULL_OK
(or whatever I called
> it)
>
> The idea is that if a compiler does not allow NULL
printf format strings,
> then the printf-like functions that use NULL formats do
not have the
> __printf__ attribute.
>
> Perl_die(NULL) has special semantics: so can not be
replaced by
> Perl_die("").
>
> Can you post config.sh or myconfig for your
configuration,
> it looks as if the __attribute__ macros are not being
properly set.
>
> Robin
>
>
------------------------------------------------------------
-------
> This e-mail and any attachments may contain
confidential and/or
> privileged material; it is for the intended
addressee(s) only.
> If you are not a named addressee, you must not use,
retain or
> disclose such information.
>
> NPL Management Ltd cannot guarantee that the e-mail or
any
> attachments are free from viruses.
>
> NPL Management Ltd. Registered in England and Wales.
No: 2937881
> Registered Office: Serco House, 16 Bartley Wood
Business Park,
>                    Hook, Hampshire, United Kingdom 
RG27 9UY
>
------------------------------------------------------------
-------
>
>
[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )