In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/c7121961d8a0541a0530b15529553c4e9160917b?hp=e0707a4ad5fb4738da21729f352b9e3f6660ae1d>
- Log ----------------------------------------------------------------- commit c7121961d8a0541a0530b15529553c4e9160917b Author: Father Chrysostomos <spr...@cpan.org> Date: Fri Nov 8 13:13:29 2013 -0800 Long verbatim pod line in INSTALL M INSTALL commit a05ea1cf8be01f657bfd7e533d25812d0eeb048c Author: Father Chrysostomos <spr...@cpan.org> Date: Fri Nov 8 13:04:19 2013 -0800 Consistent spaces after dots in sv.c apidocs M sv.c commit a731eb084d691f568ce9cedc364aa1782d3d85f5 Author: Daniel Dragan <bul...@hotmail.com> Date: Fri Nov 8 05:38:51 2013 -0500 POD-only mention sv_setsv does get magic but not set magic M sv.c commit 2186f8734350df0f69b852c67f593773a77590bc Author: Father Chrysostomos <spr...@cpan.org> Date: Fri Nov 8 06:04:20 2013 -0800 Warn for all uses of %hash{...} in scalar cx and reword the warning slightly. See <20131027204944.20489.qm...@lists-nntp.develooper.com>. To avoid getting a warning about scalar context for âdelete %a[1,2]â, which dies anyway, I stopped scalar context from being applied to deleteâs argument. Scalar context is not meaningful here anyway, and the context is not really scalar. This also means that âdelete sortâ no longer produces a warning about scalar context before dying, so I added a test for that. M dump.c M ext/B/B/Concise.pm M op.c M op.h M pod/perldiag.pod M t/lib/croak/op M t/op/kvaslice.t M t/op/kvhslice.t M toke.c commit 6a642c21192e08a710804b462f8c97902797d5b4 Author: Father Chrysostomos <spr...@cpan.org> Date: Thu Nov 7 05:33:24 2013 -0800 Make _charnames comparison null-safe This comparison in toke.c checks whether the charnames translators is the coreâs own and, if so, skips certain validation checks. Charnames translators coming from any package beginning with "_charnames\0" would also be exempt from the checks, because the name comparison stopped at the first null. M t/re/pat_advanced.t M toke.c commit a96df643850d22bc4a943802c3dd142af0ab0057 Author: Father Chrysostomos <spr...@cpan.org> Date: Wed Nov 6 16:18:48 2013 -0800 Stop lexical CORE sub from interfering with CORE:: The way CORE:: was handled in the lexer was convoluted. CORE was treated initially as a keyword, with exceptions in the lexer to make it behave correctly. If it turned out not to be followed by ::, then the lexer would fall back to treating it as a bareword or sub name. Before even checking for a keyword, the lexer looks for :: and goes to the bareword/sub code. But it made a special exception there for CORE::. In the end, treating CORE as a keyword recognized by the keyword() function requires more special cases than simply special-casing CORE:: in toke.c. This fixes the lexical CORE sub bug, while reducing the total num- ber of lines. M gv.c M keywords.c M keywords.h M op.c M pp.c M regen/keywords.pl M t/op/lexsub.t M toke.c commit 466112bb8d1a607f81f127e9641f40ce1164c3e7 Author: Father Chrysostomos <spr...@cpan.org> Date: Wed Nov 6 10:55:36 2013 -0800 toke.c: Remove dead code handling <FH> // A few lines of code added by this commit: commit 6f33ba736d46c2f5bfdb2405fd09d82ec18a1d07 Author: Rafael Garcia-Suarez <rgarciasua...@gmail.com> Date: Sun Aug 25 18:42:46 2002 +0000 Fix parsing problems with the // operator. Make // able to follow various unary operators used without arguments or parens (shift, pop, getc, pos, readline, readlink, undef, umask, and the filetest operators), as well as the <FH> operator. were already unreachable when they were added, specifically the code for handling // after <FH> (which is fortunate, because XTERMORDORDOR after <FH> would break <FH>+1). S_scan_inputsymbol sets pl_yylval.ival to OP_NULL, since it has already created the ops; it has done so since perl 5.000. So this branch is never reached when parsing <FH>. The if-block containing these lines has had â|| op_type == OP_READLINEâ since perl 5.000, which has also always been redundant for the same reason. M toke.c ----------------------------------------------------------------------- Summary of changes: INSTALL | 12 +- dump.c | 3 +- ext/B/B/Concise.pm | 2 +- gv.c | 2 +- keywords.c | 14 +- keywords.h | 493 ++++++++++++++++++++++++++-------------------------- op.c | 94 +++++++--- op.h | 4 +- pod/perldiag.pod | 44 ++--- pp.c | 2 +- regen/keywords.pl | 1 - sv.c | 21 +-- t/lib/croak/op | 6 + t/op/kvaslice.t | 26 +-- t/op/kvhslice.t | 27 +-- t/op/lexsub.t | 5 +- t/re/pat_advanced.t | 10 ++ toke.c | 26 +-- 18 files changed, 420 insertions(+), 372 deletions(-) diff --git a/INSTALL b/INSTALL index 0b7a14a..64d74f7 100644 --- a/INSTALL +++ b/INSTALL @@ -1603,14 +1603,14 @@ should check your installation for packages that create that link, and if no package is installed that supplies that link or you cannot install them, make the symbolic link yourself e.g.: - $ rpm -qf /usr/lib64/libm.so - glibc-devel-2.15-22.17.1.x86_64 - $ ls -lgo /usr/lib64/libm.so - lrwxrwxrwx 1 16 Jan 7 2013 /usr/lib64/libm.so -> /lib64/libm.so.6 + $ rpm -qf /usr/lib64/libm.so + glibc-devel-2.15-22.17.1.x86_64 + $ ls -lgo /usr/lib64/libm.so + lrwxrwxrwx 1 16 Jan 7 2013 /usr/lib64/libm.so -> /lib64/libm.so.6 - or + or - $ sudo ln -s /lib64/libm.so.6 /lib64/libm.so + $ sudo ln -s /lib64/libm.so.6 /lib64/libm.so If the libs variable looks correct, you might have the L<"nm extraction"> problem discussed above. diff --git a/dump.c b/dump.c index 78e9aa9..a5061d3 100644 --- a/dump.c +++ b/dump.c @@ -960,8 +960,7 @@ S_op_private_to_names(pTHX_ SV *tmpsv, U32 optype, U32 op_private) { (UV)(oppriv & OPpPADRANGE_COUNTMASK)); \ if ( (o->op_type == OP_RV2HV || o->op_type == OP_RV2AV || \ o->op_type == OP_PADAV || o->op_type == OP_PADHV || \ - o->op_type == OP_ASLICE || o->op_type == OP_HSLICE || \ - o->op_type == OP_KVHSLICE || o->op_type == OP_KVASLICE) \ + o->op_type == OP_ASLICE || o->op_type == OP_HSLICE) \ && oppriv & OPpSLICEWARNING ) \ sv_catpvs(tmpsv, ",SLICEWARNING"); \ if (SvCUR(tmpsv)) { \ diff --git a/ext/B/B/Concise.pm b/ext/B/B/Concise.pm index 632cc66..01769fa 100644 --- a/ext/B/B/Concise.pm +++ b/ext/B/B/Concise.pm @@ -621,7 +621,7 @@ $priv{$_}{8} = "LVSUB" for qw(rv2av rv2gv rv2hv padav padhv aelem helem aslice hslice av2arylen keys rkeys substr pos vec); $priv{$_}{4} = "SLICEWARN" - for qw(rv2hv rv2av kvhslice kvaslice padav padhv hslice aslice); + for qw(rv2hv rv2av padav padhv hslice aslice); @{$priv{$_}}{32,64} = qw(BOOL BOOL?) for qw(rv2hv padhv); $priv{substr}{16} = "REPL1ST"; $priv{$_}{16} = "TARGMY" diff --git a/gv.c b/gv.c index 136bada..1c86029 100644 --- a/gv.c +++ b/gv.c @@ -463,7 +463,7 @@ S_maybe_add_coresub(pTHX_ HV * const stash, GV *gv, /* no support for \&CORE::infix; no support for funcs that do not parse like funcs */ case KEY___DATA__: case KEY___END__: case KEY_and: case KEY_AUTOLOAD: - case KEY_BEGIN : case KEY_CHECK : case KEY_cmp: case KEY_CORE : + case KEY_BEGIN : case KEY_CHECK : case KEY_cmp: case KEY_default : case KEY_DESTROY: case KEY_do : case KEY_dump : case KEY_else : case KEY_elsif : case KEY_END : case KEY_eq : case KEY_eval : diff --git a/keywords.c b/keywords.c index 23d550d..cd8a99e 100644 --- a/keywords.c +++ b/keywords.c @@ -490,19 +490,9 @@ Perl_keyword (pTHX_ const char *name, I32 len, bool all_keywords) goto unknown; } - case 4: /* 41 tokens of length 4 */ + case 4: /* 40 tokens of length 4 */ switch (name[0]) { - case 'C': - if (name[1] == 'O' && - name[2] == 'R' && - name[3] == 'E') - { /* CORE */ - return -KEY_CORE; - } - - goto unknown; - case 'I': if (name[1] == 'N' && name[2] == 'I' && @@ -3449,5 +3439,5 @@ unknown: } /* Generated from: - * e5a540774760ea54c761ef17ee4a153cc264e9a700b817d561e390730c457406 regen/keywords.pl + * 7c6d47fd2890b2422a40331ec90eac08f9808209b01f2b9c113141410fea91b5 regen/keywords.pl * ex: set ro: */ diff --git a/keywords.h b/keywords.h index 5ebde87..f23896c 100644 --- a/keywords.h +++ b/keywords.h @@ -23,253 +23,252 @@ #define KEY_AUTOLOAD 7 #define KEY_BEGIN 8 #define KEY_UNITCHECK 9 -#define KEY_CORE 10 -#define KEY_DESTROY 11 -#define KEY_END 12 -#define KEY_INIT 13 -#define KEY_CHECK 14 -#define KEY_abs 15 -#define KEY_accept 16 -#define KEY_alarm 17 -#define KEY_and 18 -#define KEY_atan2 19 -#define KEY_bind 20 -#define KEY_binmode 21 -#define KEY_bless 22 -#define KEY_break 23 -#define KEY_caller 24 -#define KEY_chdir 25 -#define KEY_chmod 26 -#define KEY_chomp 27 -#define KEY_chop 28 -#define KEY_chown 29 -#define KEY_chr 30 -#define KEY_chroot 31 -#define KEY_close 32 -#define KEY_closedir 33 -#define KEY_cmp 34 -#define KEY_connect 35 -#define KEY_continue 36 -#define KEY_cos 37 -#define KEY_crypt 38 -#define KEY_dbmclose 39 -#define KEY_dbmopen 40 -#define KEY_default 41 -#define KEY_defined 42 -#define KEY_delete 43 -#define KEY_die 44 -#define KEY_do 45 -#define KEY_dump 46 -#define KEY_each 47 -#define KEY_else 48 -#define KEY_elsif 49 -#define KEY_endgrent 50 -#define KEY_endhostent 51 -#define KEY_endnetent 52 -#define KEY_endprotoent 53 -#define KEY_endpwent 54 -#define KEY_endservent 55 -#define KEY_eof 56 -#define KEY_eq 57 -#define KEY_eval 58 -#define KEY_evalbytes 59 -#define KEY_exec 60 -#define KEY_exists 61 -#define KEY_exit 62 -#define KEY_exp 63 -#define KEY_fc 64 -#define KEY_fcntl 65 -#define KEY_fileno 66 -#define KEY_flock 67 -#define KEY_for 68 -#define KEY_foreach 69 -#define KEY_fork 70 -#define KEY_format 71 -#define KEY_formline 72 -#define KEY_ge 73 -#define KEY_getc 74 -#define KEY_getgrent 75 -#define KEY_getgrgid 76 -#define KEY_getgrnam 77 -#define KEY_gethostbyaddr 78 -#define KEY_gethostbyname 79 -#define KEY_gethostent 80 -#define KEY_getlogin 81 -#define KEY_getnetbyaddr 82 -#define KEY_getnetbyname 83 -#define KEY_getnetent 84 -#define KEY_getpeername 85 -#define KEY_getpgrp 86 -#define KEY_getppid 87 -#define KEY_getpriority 88 -#define KEY_getprotobyname 89 -#define KEY_getprotobynumber 90 -#define KEY_getprotoent 91 -#define KEY_getpwent 92 -#define KEY_getpwnam 93 -#define KEY_getpwuid 94 -#define KEY_getservbyname 95 -#define KEY_getservbyport 96 -#define KEY_getservent 97 -#define KEY_getsockname 98 -#define KEY_getsockopt 99 -#define KEY_given 100 -#define KEY_glob 101 -#define KEY_gmtime 102 -#define KEY_goto 103 -#define KEY_grep 104 -#define KEY_gt 105 -#define KEY_hex 106 -#define KEY_if 107 -#define KEY_index 108 -#define KEY_int 109 -#define KEY_ioctl 110 -#define KEY_join 111 -#define KEY_keys 112 -#define KEY_kill 113 -#define KEY_last 114 -#define KEY_lc 115 -#define KEY_lcfirst 116 -#define KEY_le 117 -#define KEY_length 118 -#define KEY_link 119 -#define KEY_listen 120 -#define KEY_local 121 -#define KEY_localtime 122 -#define KEY_lock 123 -#define KEY_log 124 -#define KEY_lstat 125 -#define KEY_lt 126 -#define KEY_m 127 -#define KEY_map 128 -#define KEY_mkdir 129 -#define KEY_msgctl 130 -#define KEY_msgget 131 -#define KEY_msgrcv 132 -#define KEY_msgsnd 133 -#define KEY_my 134 -#define KEY_ne 135 -#define KEY_next 136 -#define KEY_no 137 -#define KEY_not 138 -#define KEY_oct 139 -#define KEY_open 140 -#define KEY_opendir 141 -#define KEY_or 142 -#define KEY_ord 143 -#define KEY_our 144 -#define KEY_pack 145 -#define KEY_package 146 -#define KEY_pipe 147 -#define KEY_pop 148 -#define KEY_pos 149 -#define KEY_print 150 -#define KEY_printf 151 -#define KEY_prototype 152 -#define KEY_push 153 -#define KEY_q 154 -#define KEY_qq 155 -#define KEY_qr 156 -#define KEY_quotemeta 157 -#define KEY_qw 158 -#define KEY_qx 159 -#define KEY_rand 160 -#define KEY_read 161 -#define KEY_readdir 162 -#define KEY_readline 163 -#define KEY_readlink 164 -#define KEY_readpipe 165 -#define KEY_recv 166 -#define KEY_redo 167 -#define KEY_ref 168 -#define KEY_rename 169 -#define KEY_require 170 -#define KEY_reset 171 -#define KEY_return 172 -#define KEY_reverse 173 -#define KEY_rewinddir 174 -#define KEY_rindex 175 -#define KEY_rmdir 176 -#define KEY_s 177 -#define KEY_say 178 -#define KEY_scalar 179 -#define KEY_seek 180 -#define KEY_seekdir 181 -#define KEY_select 182 -#define KEY_semctl 183 -#define KEY_semget 184 -#define KEY_semop 185 -#define KEY_send 186 -#define KEY_setgrent 187 -#define KEY_sethostent 188 -#define KEY_setnetent 189 -#define KEY_setpgrp 190 -#define KEY_setpriority 191 -#define KEY_setprotoent 192 -#define KEY_setpwent 193 -#define KEY_setservent 194 -#define KEY_setsockopt 195 -#define KEY_shift 196 -#define KEY_shmctl 197 -#define KEY_shmget 198 -#define KEY_shmread 199 -#define KEY_shmwrite 200 -#define KEY_shutdown 201 -#define KEY_sin 202 -#define KEY_sleep 203 -#define KEY_socket 204 -#define KEY_socketpair 205 -#define KEY_sort 206 -#define KEY_splice 207 -#define KEY_split 208 -#define KEY_sprintf 209 -#define KEY_sqrt 210 -#define KEY_srand 211 -#define KEY_stat 212 -#define KEY_state 213 -#define KEY_study 214 -#define KEY_sub 215 -#define KEY_substr 216 -#define KEY_symlink 217 -#define KEY_syscall 218 -#define KEY_sysopen 219 -#define KEY_sysread 220 -#define KEY_sysseek 221 -#define KEY_system 222 -#define KEY_syswrite 223 -#define KEY_tell 224 -#define KEY_telldir 225 -#define KEY_tie 226 -#define KEY_tied 227 -#define KEY_time 228 -#define KEY_times 229 -#define KEY_tr 230 -#define KEY_truncate 231 -#define KEY_uc 232 -#define KEY_ucfirst 233 -#define KEY_umask 234 -#define KEY_undef 235 -#define KEY_unless 236 -#define KEY_unlink 237 -#define KEY_unpack 238 -#define KEY_unshift 239 -#define KEY_untie 240 -#define KEY_until 241 -#define KEY_use 242 -#define KEY_utime 243 -#define KEY_values 244 -#define KEY_vec 245 -#define KEY_wait 246 -#define KEY_waitpid 247 -#define KEY_wantarray 248 -#define KEY_warn 249 -#define KEY_when 250 -#define KEY_while 251 -#define KEY_write 252 -#define KEY_x 253 -#define KEY_xor 254 -#define KEY_y 255 +#define KEY_DESTROY 10 +#define KEY_END 11 +#define KEY_INIT 12 +#define KEY_CHECK 13 +#define KEY_abs 14 +#define KEY_accept 15 +#define KEY_alarm 16 +#define KEY_and 17 +#define KEY_atan2 18 +#define KEY_bind 19 +#define KEY_binmode 20 +#define KEY_bless 21 +#define KEY_break 22 +#define KEY_caller 23 +#define KEY_chdir 24 +#define KEY_chmod 25 +#define KEY_chomp 26 +#define KEY_chop 27 +#define KEY_chown 28 +#define KEY_chr 29 +#define KEY_chroot 30 +#define KEY_close 31 +#define KEY_closedir 32 +#define KEY_cmp 33 +#define KEY_connect 34 +#define KEY_continue 35 +#define KEY_cos 36 +#define KEY_crypt 37 +#define KEY_dbmclose 38 +#define KEY_dbmopen 39 +#define KEY_default 40 +#define KEY_defined 41 +#define KEY_delete 42 +#define KEY_die 43 +#define KEY_do 44 +#define KEY_dump 45 +#define KEY_each 46 +#define KEY_else 47 +#define KEY_elsif 48 +#define KEY_endgrent 49 +#define KEY_endhostent 50 +#define KEY_endnetent 51 +#define KEY_endprotoent 52 +#define KEY_endpwent 53 +#define KEY_endservent 54 +#define KEY_eof 55 +#define KEY_eq 56 +#define KEY_eval 57 +#define KEY_evalbytes 58 +#define KEY_exec 59 +#define KEY_exists 60 +#define KEY_exit 61 +#define KEY_exp 62 +#define KEY_fc 63 +#define KEY_fcntl 64 +#define KEY_fileno 65 +#define KEY_flock 66 +#define KEY_for 67 +#define KEY_foreach 68 +#define KEY_fork 69 +#define KEY_format 70 +#define KEY_formline 71 +#define KEY_ge 72 +#define KEY_getc 73 +#define KEY_getgrent 74 +#define KEY_getgrgid 75 +#define KEY_getgrnam 76 +#define KEY_gethostbyaddr 77 +#define KEY_gethostbyname 78 +#define KEY_gethostent 79 +#define KEY_getlogin 80 +#define KEY_getnetbyaddr 81 +#define KEY_getnetbyname 82 +#define KEY_getnetent 83 +#define KEY_getpeername 84 +#define KEY_getpgrp 85 +#define KEY_getppid 86 +#define KEY_getpriority 87 +#define KEY_getprotobyname 88 +#define KEY_getprotobynumber 89 +#define KEY_getprotoent 90 +#define KEY_getpwent 91 +#define KEY_getpwnam 92 +#define KEY_getpwuid 93 +#define KEY_getservbyname 94 +#define KEY_getservbyport 95 +#define KEY_getservent 96 +#define KEY_getsockname 97 +#define KEY_getsockopt 98 +#define KEY_given 99 +#define KEY_glob 100 +#define KEY_gmtime 101 +#define KEY_goto 102 +#define KEY_grep 103 +#define KEY_gt 104 +#define KEY_hex 105 +#define KEY_if 106 +#define KEY_index 107 +#define KEY_int 108 +#define KEY_ioctl 109 +#define KEY_join 110 +#define KEY_keys 111 +#define KEY_kill 112 +#define KEY_last 113 +#define KEY_lc 114 +#define KEY_lcfirst 115 +#define KEY_le 116 +#define KEY_length 117 +#define KEY_link 118 +#define KEY_listen 119 +#define KEY_local 120 +#define KEY_localtime 121 +#define KEY_lock 122 +#define KEY_log 123 +#define KEY_lstat 124 +#define KEY_lt 125 +#define KEY_m 126 +#define KEY_map 127 +#define KEY_mkdir 128 +#define KEY_msgctl 129 +#define KEY_msgget 130 +#define KEY_msgrcv 131 +#define KEY_msgsnd 132 +#define KEY_my 133 +#define KEY_ne 134 +#define KEY_next 135 +#define KEY_no 136 +#define KEY_not 137 +#define KEY_oct 138 +#define KEY_open 139 +#define KEY_opendir 140 +#define KEY_or 141 +#define KEY_ord 142 +#define KEY_our 143 +#define KEY_pack 144 +#define KEY_package 145 +#define KEY_pipe 146 +#define KEY_pop 147 +#define KEY_pos 148 +#define KEY_print 149 +#define KEY_printf 150 +#define KEY_prototype 151 +#define KEY_push 152 +#define KEY_q 153 +#define KEY_qq 154 +#define KEY_qr 155 +#define KEY_quotemeta 156 +#define KEY_qw 157 +#define KEY_qx 158 +#define KEY_rand 159 +#define KEY_read 160 +#define KEY_readdir 161 +#define KEY_readline 162 +#define KEY_readlink 163 +#define KEY_readpipe 164 +#define KEY_recv 165 +#define KEY_redo 166 +#define KEY_ref 167 +#define KEY_rename 168 +#define KEY_require 169 +#define KEY_reset 170 +#define KEY_return 171 +#define KEY_reverse 172 +#define KEY_rewinddir 173 +#define KEY_rindex 174 +#define KEY_rmdir 175 +#define KEY_s 176 +#define KEY_say 177 +#define KEY_scalar 178 +#define KEY_seek 179 +#define KEY_seekdir 180 +#define KEY_select 181 +#define KEY_semctl 182 +#define KEY_semget 183 +#define KEY_semop 184 +#define KEY_send 185 +#define KEY_setgrent 186 +#define KEY_sethostent 187 +#define KEY_setnetent 188 +#define KEY_setpgrp 189 +#define KEY_setpriority 190 +#define KEY_setprotoent 191 +#define KEY_setpwent 192 +#define KEY_setservent 193 +#define KEY_setsockopt 194 +#define KEY_shift 195 +#define KEY_shmctl 196 +#define KEY_shmget 197 +#define KEY_shmread 198 +#define KEY_shmwrite 199 +#define KEY_shutdown 200 +#define KEY_sin 201 +#define KEY_sleep 202 +#define KEY_socket 203 +#define KEY_socketpair 204 +#define KEY_sort 205 +#define KEY_splice 206 +#define KEY_split 207 +#define KEY_sprintf 208 +#define KEY_sqrt 209 +#define KEY_srand 210 +#define KEY_stat 211 +#define KEY_state 212 +#define KEY_study 213 +#define KEY_sub 214 +#define KEY_substr 215 +#define KEY_symlink 216 +#define KEY_syscall 217 +#define KEY_sysopen 218 +#define KEY_sysread 219 +#define KEY_sysseek 220 +#define KEY_system 221 +#define KEY_syswrite 222 +#define KEY_tell 223 +#define KEY_telldir 224 +#define KEY_tie 225 +#define KEY_tied 226 +#define KEY_time 227 +#define KEY_times 228 +#define KEY_tr 229 +#define KEY_truncate 230 +#define KEY_uc 231 +#define KEY_ucfirst 232 +#define KEY_umask 233 +#define KEY_undef 234 +#define KEY_unless 235 +#define KEY_unlink 236 +#define KEY_unpack 237 +#define KEY_unshift 238 +#define KEY_untie 239 +#define KEY_until 240 +#define KEY_use 241 +#define KEY_utime 242 +#define KEY_values 243 +#define KEY_vec 244 +#define KEY_wait 245 +#define KEY_waitpid 246 +#define KEY_wantarray 247 +#define KEY_warn 248 +#define KEY_when 249 +#define KEY_while 250 +#define KEY_write 251 +#define KEY_x 252 +#define KEY_xor 253 +#define KEY_y 254 /* Generated from: - * e5a540774760ea54c761ef17ee4a153cc264e9a700b817d561e390730c457406 regen/keywords.pl + * 7c6d47fd2890b2422a40331ec90eac08f9808209b01f2b9c113141410fea91b5 regen/keywords.pl * ex: set ro: */ diff --git a/op.c b/op.c index fcefa23..5f7e875 100644 --- a/op.c +++ b/op.c @@ -1145,15 +1145,31 @@ S_op_varname(pTHX_ const OP *o) } static void +S_op_pretty(pTHX_ const OP *o, SV **retsv, const char **retpv) +{ /* or not so pretty :-) */ + const char *key = NULL; + if (o->op_type == OP_CONST) { + *retsv = cSVOPo_sv; + if (SvPOK(*retsv)) { + SV *sv = *retsv; + *retsv = sv_newmortal(); + pv_pretty(*retsv, SvPVX_const(sv), SvCUR(sv), 32, NULL, NULL, + PERL_PV_PRETTY_DUMP |PERL_PV_ESCAPE_UNI_DETECT); + } + else if (!SvOK(*retsv)) + *retpv = "undef"; + } + else *retpv = "..."; +} + +static void S_scalar_slice_warning(pTHX_ const OP *o) { OP *kid; const char lbrack = - o->op_type == OP_KVHSLICE || o->op_type == OP_HSLICE ? '{' : '['; + o->op_type == OP_HSLICE ? '{' : '['; const char rbrack = - o->op_type == OP_KVHSLICE || o->op_type == OP_HSLICE ? '}' : ']'; - const char funny = - o->op_type == OP_ASLICE || o->op_type == OP_HSLICE ? '@' : '%'; + o->op_type == OP_HSLICE ? '}' : ']'; SV *name; SV *keysv = NULL; /* just to silence compiler warnings */ const char *key = NULL; @@ -1199,33 +1215,22 @@ S_scalar_slice_warning(pTHX_ const OP *o) name = S_op_varname(aTHX_ kid->op_sibling); if (!name) /* XS module fiddling with the op tree */ return; - if (kid->op_type == OP_CONST) { - keysv = kSVOP_sv; - if (SvPOK(kSVOP_sv)) { - SV *sv = keysv; - keysv = sv_newmortal(); - pv_pretty(keysv, SvPVX_const(sv), SvCUR(sv), 32, NULL, NULL, - PERL_PV_PRETTY_DUMP |PERL_PV_ESCAPE_UNI_DETECT); - } - else if (!SvOK(keysv)) - key = "undef"; - } - else key = "..."; + S_op_pretty(aTHX_ kid, &keysv, &key); assert(SvPOK(name)); sv_chop(name,SvPVX(name)+1); if (key) - /* diag_listed_as: Scalar value %%s[%s] better written as $%s[%s] */ + /* diag_listed_as: Scalar value @%s[%s] better written as $%s[%s] */ Perl_warner(aTHX_ packWARN(WARN_SYNTAX), - "Scalar value %c%"SVf"%c%s%c better written as $%"SVf + "Scalar value @%"SVf"%c%s%c better written as $%"SVf "%c%s%c", - funny, SVfARG(name), lbrack, key, rbrack, SVfARG(name), + SVfARG(name), lbrack, key, rbrack, SVfARG(name), lbrack, key, rbrack); else - /* diag_listed_as: Scalar value %%s[%s] better written as $%s[%s] */ + /* diag_listed_as: Scalar value @%s[%s] better written as $%s[%s] */ Perl_warner(aTHX_ packWARN(WARN_SYNTAX), - "Scalar value %c%"SVf"%c%"SVf"%c better written as $%" + "Scalar value @%"SVf"%c%"SVf"%c better written as $%" SVf"%c%"SVf"%c", - funny, SVfARG(name), lbrack, keysv, rbrack, + SVfARG(name), lbrack, keysv, rbrack, SVfARG(name), lbrack, keysv, rbrack); } @@ -1293,7 +1298,44 @@ Perl_scalar(pTHX_ OP *o) break; case OP_KVHSLICE: case OP_KVASLICE: - S_scalar_slice_warning(aTHX_ o); + { + /* Warn about scalar context */ + const char lbrack = o->op_type == OP_KVHSLICE ? '{' : '['; + const char rbrack = o->op_type == OP_KVHSLICE ? '}' : ']'; + SV *name; + SV *keysv; + const char *key = NULL; + + /* This warning can be nonsensical when there is a syntax error. */ + if (PL_parser && PL_parser->error_count) + break; + + if (!ckWARN(WARN_SYNTAX)) break; + + kid = cLISTOPo->op_first; + kid = kid->op_sibling; /* get past pushmark */ + assert(kid->op_sibling); + name = S_op_varname(aTHX_ kid->op_sibling); + if (!name) /* XS module fiddling with the op tree */ + break; + S_op_pretty(aTHX_ kid, &keysv, &key); + assert(SvPOK(name)); + sv_chop(name,SvPVX(name)+1); + if (key) + /* diag_listed_as: %%s[%s] in scalar context better written as $%s[%s] */ + Perl_warner(aTHX_ packWARN(WARN_SYNTAX), + "%%%"SVf"%c%s%c in scalar context better written " + "as $%"SVf"%c%s%c", + SVfARG(name), lbrack, key, rbrack, SVfARG(name), + lbrack, key, rbrack); + else + /* diag_listed_as: %%s[%s] in scalar context better written as $%s[%s] */ + Perl_warner(aTHX_ packWARN(WARN_SYNTAX), + "%%%"SVf"%c%"SVf"%c in scalar context better " + "written as $%"SVf"%c%"SVf"%c", + SVfARG(name), lbrack, keysv, rbrack, + SVfARG(name), lbrack, keysv, rbrack); + } } return o; } @@ -9011,7 +9053,7 @@ Perl_ck_fun(pTHX_ OP *o) { return too_many_arguments_pv(o,PL_op_desc[type], 0); } - scalar(kid); + if (type != OP_DELETE) scalar(kid); break; case OA_LIST: if (oa < 16) { @@ -11881,7 +11923,7 @@ Perl_custom_op_register(pTHX_ Perl_ppaddr_t ppaddr, const XOP *xop) This function assigns the prototype of the named core function to C<sv>, or to a new mortal SV if C<sv> is NULL. It returns the modified C<sv>, or NULL if the core function has no prototype. C<code> is a code as returned -by C<keyword()>. It must not be equal to 0 or -KEY_CORE. +by C<keyword()>. It must not be equal to 0. =cut */ @@ -11898,7 +11940,7 @@ Perl_core_prototype(pTHX_ SV *sv, const char *name, const int code, PERL_ARGS_ASSERT_CORE_PROTOTYPE; - assert (code && code != -KEY_CORE); + assert (code); if (!sv) sv = sv_newmortal(); diff --git a/op.h b/op.h index 1c59ca8..8672e4b 100644 --- a/op.h +++ b/op.h @@ -250,8 +250,8 @@ is no conversion of op type. #define OPpEARLY_CV 32 /* foo() called before sub foo was parsed */ /* OP_?ELEM only */ #define OPpLVAL_DEFER 16 /* Defer creation of array/hash elem */ - /* OP_RV2[AH]V OP_KV[AH]SLICE OP_[AH]SLICE */ -#define OPpSLICEWARNING 4 /* warn about %hash{$scalar} */ + /* OP_RV2[AH]V OP_[AH]SLICE */ +#define OPpSLICEWARNING 4 /* warn about @hash{$scalar} */ /* OP_RV2[SAH]V, OP_GVSV, OP_ENTERITER only */ #define OPpOUR_INTRO 16 /* Variable was in an our() */ /* OP_RV2[AGH]V, OP_PAD[AH]V, OP_[AH]ELEM, OP_[AH]SLICE OP_AV2ARYLEN, diff --git a/pod/perldiag.pod b/pod/perldiag.pod index e88646a..81eef8e 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -2348,6 +2348,28 @@ C<state ($a) = 42> as C<state $a = 42> to change from list to scalar context. Constructions such as C<state (@a) = foo()> will be supported in a future perl release. +=item %%s[%s] in scalar context better written as $%s[%s] + +(W syntax) In scalar context, you've used an array index/value slice +(indicated by %) to select a single element of an array. Generally +it's better to ask for a scalar value (indicated by $). The difference +is that C<$foo[&bar]> always behaves like a scalar, both in the value it +returns and when evaluating its argument, while C<%foo[&bar]> provides +a list context to its subscript, which can do weird things if you're +expecting only one subscript. When called in list context, it also +returns the index (what C<&bar> returns) in addition to the value. + +=item %%s{%s} in scalar context better written as $%s{%s} + +(W syntax) In scalar context, you've used a hash key/value slice +(indicated by %) to select a single element of a hash. Generally it's +better to ask for a scalar value (indicated by $). The difference +is that C<$foo{&bar}> always behaves like a scalar, both in the value +it returns and when evaluating its argument, while C<@foo{&bar}> and +provides a list context to its subscript, which can do weird things +if you're expecting only one subscript. When called in list context, +it also returns the key in addition to the value. + =item Insecure dependency in %s (F) You tried to do something that the tainting mechanism didn't like. @@ -4626,28 +4648,6 @@ as a list, you need to look into how references work, because Perl will not magically convert between scalars and lists for you. See L<perlref>. -=item Scalar value %%s[%s] better written as $%s[%s] - -(W syntax) In scalar context, you've used an array index/value slice -(indicated by %) to select a single element of an array. Generally -it's better to ask for a scalar value (indicated by $). The difference -is that C<$foo[&bar]> always behaves like a scalar, both in the value it -returns and when evaluating its argument, while C<%foo[&bar]> provides -a list context to its subscript, which can do weird things if you're -expecting only one subscript. When called in list context, it also -returns the index (what C<&bar> returns) in addition to the value. - -=item Scalar value %%s{%s} better written as $%s{%s} - -(W syntax) In scalar context, you've used a hash key/value slice -(indicated by %) to select a single element of a hash. Generally it's -better to ask for a scalar value (indicated by $). The difference -is that C<$foo{&bar}> always behaves like a scalar, both in the value -it returns and when evaluating its argument, while C<@foo{&bar}> and -provides a list context to its subscript, which can do weird things -if you're expecting only one subscript. When called in list context, -it also returns the key in addition to the value. - =item Search pattern not terminated (F) The lexer couldn't find the final delimiter of a // or m{} diff --git a/pp.c b/pp.c index d090069..a6ab24d 100644 --- a/pp.c +++ b/pp.c @@ -493,7 +493,7 @@ PP(pp_prototype) const char * s = SvPVX_const(TOPs); if (strnEQ(s, "CORE::", 6)) { const int code = keyword(s + 6, SvCUR(TOPs) - 6, 1); - if (!code || code == -KEY_CORE) + if (!code) DIE(aTHX_ "Can't find an opnumber for \"%"UTF8f"\"", UTF8fARG(SvFLAGS(TOPs) & SVf_UTF8, SvCUR(TOPs)-6, s+6)); { diff --git a/regen/keywords.pl b/regen/keywords.pl index b783d08..bbc4188 100755 --- a/regen/keywords.pl +++ b/regen/keywords.pl @@ -124,7 +124,6 @@ __END__ +AUTOLOAD +BEGIN +UNITCHECK --CORE +DESTROY +END +INIT diff --git a/sv.c b/sv.c index 8ef01c9..b165589 100644 --- a/sv.c +++ b/sv.c @@ -770,19 +770,19 @@ is "not there", because you'll be overwriting the last members of the preceding structure in memory.) We calculate the correction using the STRUCT_OFFSET macro on the first -member present. If the allocated structure is smaller (no initial NV +member present. If the allocated structure is smaller (no initial NV actually allocated) then the net effect is to subtract the size of the NV from the pointer, to return a new pointer as if an initial NV were actually -allocated. (We were using structures named *_allocated for this, but +allocated. (We were using structures named *_allocated for this, but this turned out to be a subtle bug, because a structure without an NV could have a lower alignment constraint, but the compiler is allowed to optimised accesses based on the alignment constraint of the actual pointer to the full structure, for example, using a single 64 bit load instruction because it "knows" that two adjacent 32 bit members will be 8-byte aligned.) -This is the same trick as was used for NV and IV bodies. Ironically it +This is the same trick as was used for NV and IV bodies. Ironically it doesn't need to be used for NV bodies any more, because NV is now at -the start of the structure. IV bodies don't need it either, because +the start of the structure. IV bodies don't need it either, because they are no longer allocated. In turn, the new_body_* allocators call S_new_body(), which invokes @@ -3662,9 +3662,10 @@ Perl_sv_utf8_decode(pTHX_ SV *const sv) Copies the contents of the source SV C<ssv> into the destination SV C<dsv>. The source SV may be destroyed if it is mortal, so don't use this -function if the source SV needs to be reused. Does not handle 'set' magic. -Loosely speaking, it performs a copy-by-value, obliterating any previous -content of the destination. +function if the source SV needs to be reused. Does not handle 'set' magic on +destination SV. C alls 'get' magic on +source SV. Loosely speaking, it performs a +copy-by-value, obliterating any previous content of the destination. You probably want to use one of the assortment of wrappers, such as C<SvSetSV>, C<SvSetSV_nosteal>, C<SvSetMagicSV> and @@ -7932,8 +7933,8 @@ S_sv_gets_read_record(pTHX_ SV *const sv, PerlIO *const fp, I32 append) =for apidoc sv_gets Get a line from the filehandle and store it into the SV, optionally -appending to the currently-stored string. If C<append> is not 0, the -line is appended to the SV instead of overwriting it. C<append> should +appending to the currently-stored string. If C<append> is not 0, the +line is appended to the SV instead of overwriting it. C<append> should be set to the byte offset that the appended string should start at in the SV (typically, C<SvCUR(sv)> is a suitable choice). @@ -9626,7 +9627,7 @@ Perl_sv_isa(pTHX_ SV *sv, const char *const name) Creates a new SV for the existing RV, C<rv>, to point to. If C<rv> is not an RV then it will be upgraded to one. If C<classname> is non-null then the new SV will be blessed in the specified package. The new SV is returned and its -reference count is 1. The reference count 1 is owned by C<rv>. +reference count is 1. The reference count 1 is owned by C<rv>. =cut */ diff --git a/t/lib/croak/op b/t/lib/croak/op index 31af174..3ec418f 100644 --- a/t/lib/croak/op +++ b/t/lib/croak/op @@ -48,6 +48,12 @@ delete $x; EXPECT delete argument is not a HASH or ARRAY element or slice at - line 1. ######## +# NAME delete sort +use warnings; +delete sort; # used to warn about scalar context, too +EXPECT +delete argument is not a HASH or ARRAY element or slice at - line 2. +######## # NAME exists BAD exists $x; EXPECT diff --git a/t/op/kvaslice.t b/t/op/kvaslice.t index a1d9388..0738a17 100644 --- a/t/op/kvaslice.t +++ b/t/op/kvaslice.t @@ -8,7 +8,7 @@ BEGIN { # use strict; -plan tests => 39; +plan tests => 40; # simple use cases { @@ -41,17 +41,19 @@ plan tests => 39; # scalar context { + my @warn; + local $SIG{__WARN__} = sub {push @warn, "@_"}; + my @a = 'a'..'z'; - is scalar %a[4,5,6], 'g', 'last element in scalar context'; + is eval'scalar %a[4,5,6]', 'g', 'last element in scalar context'; - { - my @warn; - local $SIG{__WARN__} = sub {push @warn, "@_"}; - eval 'is( scalar %a[5], "f", "correct value");'; + like ($warn[0], + qr/^\%a\[\.\.\.\] in scalar context better written as \$a\[\.\.\.\]/); - is (scalar @warn, 1); - like ($warn[0], qr/^Scalar value \%a\[5\] better written as \$a\[5\]/); - } + eval 'is( scalar %a[5], "f", "correct value");'; + + is (scalar @warn, 2); + like ($warn[1], qr/^\%a\[5\] in scalar context better written as \$a\[5\]/); } # autovivification @@ -151,7 +153,8 @@ plan tests => 39; @warn = (); my $v = eval '%a[0]'; is (scalar @warn, 1, 'warning in scalar context'); - like $warn[0], qr{^Scalar value %a\[0\] better written as \$a\[0\]}, + like $warn[0], + qr{^%a\[0\] in scalar context better written as \$a\[0\]}, "correct warning text"; } { @@ -179,7 +182,8 @@ plan tests => 39; { my %h = 'a'..'b'; my @i = \%h; - my ($k,$v) = each %i[(0)]; # parens suppress "Scalar better written as" + no warnings 'syntax'; + my ($k,$v) = each %i[0]; is $k, 'a', 'key returned by each %array[ix]'; is $v, 'b', 'val returned by each %array[ix]'; %h = 1..10; diff --git a/t/op/kvhslice.t b/t/op/kvhslice.t index bb0f3c1..8acd0ab 100644 --- a/t/op/kvhslice.t +++ b/t/op/kvhslice.t @@ -8,7 +8,7 @@ BEGIN { # use strict; -plan tests => 43; +plan tests => 44; # simple use cases { @@ -41,18 +41,20 @@ plan tests => 43; # scalar context { + my @warn; + local $SIG{__WARN__} = sub {push @warn, "@_"}; + my %h = map { $_ => uc $_ } 'a'..'z'; - is scalar %h{'c','d','e'}, 'E', 'last element in scalar context'; + is scalar eval"%h{'c','d','e'}", 'E', 'last element in scalar context'; - { - my @warn; - local $SIG{__WARN__} = sub {push @warn, "@_"}; - eval 'is( scalar %h{i}, "I", "correct value");'; + like ($warn[0], + qr/^\%h\{\.\.\.\} in scalar context better written as \$h\{\.\.\.\}/); - is (scalar @warn, 1); - like ($warn[0], - qr/^Scalar value \%h\{"i"\} better written as \$h\{"i"\}/); - } + eval 'is( scalar %h{i}, "I", "correct value");'; + + is (scalar @warn, 2); + like ($warn[1], + qr/^\%h\{"i"\} in scalar context better written as \$h\{"i"\}/); } # autovivification @@ -149,7 +151,7 @@ plan tests => 43; my $v = eval '%h{a}'; is (scalar @warn, 1, 'warning in scalar context'); like $warn[0], - qr{^Scalar value %h{"a"} better written as \$h{"a"}}, + qr{^%h{"a"} in scalar context better written as \$h{"a"}}, "correct warning text"; } { @@ -193,7 +195,8 @@ plan tests => 43; { my %h = 'a'..'b'; my %i = (foo => \%h); - my ($k,$v) = each %i{foo=>}; # => suppresses "Scalar better written as" + no warnings 'syntax'; + my ($k,$v) = each %i{foo=>}; is $k, 'a', 'key returned by each %hash{key}'; is $v, 'b', 'val returned by each %hash{key}'; %h = 1..10; diff --git a/t/op/lexsub.t b/t/op/lexsub.t index 0be305b..07bfce5 100644 --- a/t/op/lexsub.t +++ b/t/op/lexsub.t @@ -8,7 +8,7 @@ BEGIN { *bar::like = *like; } no warnings 'deprecated'; -plan 139; +plan 140; # -------------------- Errors with feature disabled -------------------- # @@ -284,6 +284,9 @@ sub make_anon_with_state_sub{ state sub END { shift } is eval{END('jkqeudth')}, jkqeudth, 'state sub END {shift} implies @_, not @ARGV'; + state sub CORE { scalar reverse shift } + is CORE::uc("hello"), "HELLO", + 'lexical CORE does not interfere with CORE::...'; } { state sub redef {} diff --git a/t/re/pat_advanced.t b/t/re/pat_advanced.t index d7ef8e9..6329683 100644 --- a/t/re/pat_advanced.t +++ b/t/re/pat_advanced.t @@ -1083,6 +1083,16 @@ sub run_tests { like ($@, qr/Trailing white-space in a charnames alias definition is deprecated/, "... same under utf8"); } + { + BEGIN { no strict; *CnameTest:: = *{"_charnames\0A::" } } + package CnameTest { sub translator { pop } } + BEGIN { $^H{charnames} = \&CnameTest::translator } + undef $w; + () = eval q ["\N{TOO MANY SPACES}"]; + like ($w, qr/A sequence of multiple spaces/, + 'translators in _charnames\0* packages get validated'); + } + # If remove the limitation in regcomp code these should work # differently undef $w; diff --git a/toke.c b/toke.c index 0773036..509aa8e 100644 --- a/toke.c +++ b/toke.c @@ -2588,7 +2588,7 @@ S_sublex_start(pTHX) PL_lex_op = NULL; return THING; } - if (op_type == OP_CONST || op_type == OP_READLINE) { + if (op_type == OP_CONST) { SV *sv = tokeq(PL_lex_stuff); if (SvTYPE(sv) == SVt_PVIV) { @@ -2601,9 +2601,6 @@ S_sublex_start(pTHX) } pl_yylval.opval = (OP*)newSVOP(op_type, 0, sv); PL_lex_stuff = NULL; - /* Allow <FH> // "foo" */ - if (op_type == OP_READLINE) - PL_expect = XTERMORDORDOR; return THING; } @@ -2862,7 +2859,8 @@ S_get_and_check_backslash_N_name(pTHX_ const char* s, const char* const e) SvTYPE(rv) == SVt_PVCV) && ((stash = CvSTASH(rv)) != NULL)) { const char * const name = HvNAME(stash); - if strEQ(name, "_charnames") { + if (HvNAMELEN(stash) == sizeof("_charnames")-1 + && strEQ(name, "_charnames")) { return res; } } @@ -5855,13 +5853,6 @@ Perl_yylex(pTHX) if ((PL_expect != XREF || PL_oldoldbufptr == PL_last_lop) && intuit_more(s)) { if (*s == '[') PL_tokenbuf[0] = '@'; - - /* Warn about % where they meant $. */ - if (*s == '[' || *s == '{') { - if (ckWARN(WARN_SYNTAX)) { - S_check_scalar_slice(aTHX_ s); - } - } } PL_expect = XOPERATOR; force_ident_maybe_lex('%'); @@ -7007,8 +6998,10 @@ Perl_yylex(pTHX) anydelim = word_takes_any_delimeter(PL_tokenbuf, len); /* x::* is just a word, unless x is "CORE" */ - if (!anydelim && *s == ':' && s[1] == ':' && strNE(PL_tokenbuf, "CORE")) + if (!anydelim && *s == ':' && s[1] == ':') { + if (strEQ(PL_tokenbuf, "CORE")) goto case_KEY_CORE; goto just_a_word; + } d = s; while (d < PL_bufend && isSPACE(*d)) @@ -7147,7 +7140,7 @@ Perl_yylex(pTHX) } gv = NULL; gvp = 0; - if (hgv && tmp != KEY_x && tmp != KEY_CORE) /* never ambiguous */ + if (hgv && tmp != KEY_x) /* never ambiguous */ Perl_ck_warner(aTHX_ packWARN(WARN_AMBIGUOUS), "Ambiguous call resolved as CORE::%s(), " "qualify as such or use &", @@ -7753,8 +7746,8 @@ Perl_yylex(pTHX) } goto just_a_word; - case KEY_CORE: - if (*s == ':' && s[1] == ':') { + case_KEY_CORE: + { STRLEN olen = len; d = s; s += 2; @@ -7778,7 +7771,6 @@ Perl_yylex(pTHX) orig_keyword = tmp; goto reserved_word; } - goto just_a_word; case KEY_abs: UNI(OP_ABS); -- Perl5 Master Repository