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

[perl #118813] [PATCH] Make warning display for 'Prototype after' and 'Illegal character' consistent

Thread Previous
From:
Peter Martini
Date:
July 9, 2013 04:50
Subject:
[perl #118813] [PATCH] Make warning display for 'Prototype after' and 'Illegal character' consistent
Message ID:
rt-3.6.HEAD-2552-1373345383-1658.118813-75-0@perl.org
# New Ticket Created by  Peter Martini 
# Please include the string:  [perl #118813]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=118813 >


This is a bug report for perl from petercmartini@gmail.com
-----------------------------------------------------------------

We currently have a test for this:

perl -we 'eval "sub foo (\$\0) {}";'

Which prints:

Illegal character in prototype for main::foo : $\0 at (eval 1) line 1.

If that's changed to

perl -we 'eval "sub foo (@\$\0) {}";'

We instead get:

Prototype after '@' for main::foo : @ at (eval 1) line 1.
Illegal character in prototype for main::foo : @\0 at (eval 1) line 1.

There are two warnings, one with a prettified version of the prototype
to display the illegal character, and one without.

I thought this was just a consistency issue, then I noticed this is
even more evil:

perl -wE 'eval "sub foo (\@\$\0blah) {}"'

The first warning would only display

Prototype after '@' for main::foo : @$ at (eval 1) line 1.

Anyway, attached is a patch to make things consistent by displaying
the prettified form in both cases.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl 5.19.1:

Configured by pmartini at Fri Jan 25 00:20:08 EST 2013.

Summary of my perl5 (revision 5 version 19 subversion 2) configuration:
  Commit id: de5c37d7b71464603fe7ccc9be2d47de77a38e9e
  Platform:
    osname=linux, osvers=3.2.0-38-generic, archname=i686-linux-thread-multi
    uname='linux pmlinlaptop 3.2.0-38-generic #61-ubuntu smp tue feb
19 12:20:02 utc 2013 i686 i686 i386 gnulinux '
    config_args='-Dusedevel -DDEBUGGING -Dusethreads -des'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING
-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include
-D_LA
RGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2 -g',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING
-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.6.3', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib/i386-linux-gnu /lib/../lib
/usr/lib/i386-linux-gnu /usr/lib/../lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.15'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib
-fstack-protector'

Characteristics of this binary (from libperl):
  Compile-time options: DEBUGGING HAS_TIMES MULTIPLICITY PERLIO_LAYERS
                        PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
                        PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
                        PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV
                        PERL_TRACK_MEMPOOL PERL_USE_DEVEL USE_ITHREADS
                        USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
                        USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO
                        USE_PERL_ATOF USE_REENTRANT_API
  Built under linux
  Compiled at Jun 27 2013 21:33:59
  %ENV:
    PERL5LIB="/home/pmartini/perl5/lib/perl5:"
    PERL_LOCAL_LIB_ROOT=":/home/pmartini/perl5"
    PERL_MB_OPT="--install_base /home/pmartini/perl5"
    PERL_MM_OPT="INSTALL_BASE=/home/pmartini/perl5"
  @INC:
    lib
    /home/pmartini/perl5/lib/perl5/i686-linux-thread-multi
    /home/pmartini/perl5/lib/perl5
    /usr/local/lib/perl5/site_perl/5.19.2/i686-linux-thread-multi
    /usr/local/lib/perl5/site_perl/5.19.2
    /usr/local/lib/perl5/5.19.2/i686-linux-thread-multi
    /usr/local/lib/perl5/5.19.2
    /usr/local/lib/perl5/site_perl
    .

Thread Previous


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