perl5 icon indicating copy to clipboard operation
perl5 copied to clipboard

add custom error for 'catch (my $e)'

Open mauke opened this issue 8 months ago • 5 comments

This fixes an oversight where catch (my $e) would run into generic error code that was not prepared to handle catch (and hence complain about redeclaring my in our, like our (my $x)).


  • This set of changes requires a perldelta entry, and it is included.

mauke avatar Apr 28 '25 01:04 mauke

(This does not happen automatically because the changes to 'perly.y' land in 'perly.act', which 'perly.c' includes but 'make' knows nothing about. Thus, even if 'perly.act' has a newer mtime, 'make' won't update 'perly.o' if it already exists.)

Don't you get dependencies in makefile after ~~make regen~~ make depend for these, I see:

perly$(OBJ_EXT): perlvars.h
perly$(OBJ_EXT): perly.act
perly$(OBJ_EXT): perly.c
perly$(OBJ_EXT): perly.h
perly$(OBJ_EXT): perly.tab
perly$(OBJ_EXT): perly.y
perly$(OBJ_EXT): pp.h

I changed a message in perly.y just before the regen_perly below:

tony@venus:.../git/perl6$ make perly.o
tony@venus:.../git/perl6$ make regen_perly
perl regen_perly.pl
Changed: perly.act perly.tab perly.h
tony@venus:.../git/perl6$ make perly.o
cc -c -DPERL_CORE -D_REENTRANT -D_GNU_SOURCE -fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -std=c99 -O2 -g -Wall -Werror=pointer-arith -Werror=vla -Wextra -Wno-long-long -Wno-declaration-after-statement -Wc++-compat -Wwrite-strings -Wno-use-after-free perly.c

tonycoz avatar Apr 28 '25 01:04 tonycoz

File times before:

-rw-r--r-- 1 tony tony  66795 Apr 28 08:13 perly.act
-rw-r--r-- 1 tony tony  19138 Jul 25  2024 perly.c
-rw-r--r-- 1 tony tony  10182 Apr 28 08:13 perly.h
-rw-r--r-- 1 tony tony 272864 Apr 28 11:32 perly.o
-rw-r--r-- 1 tony tony 106585 Apr 28 08:13 perly.tab
-rw-r--r-- 1 tony tony  50541 Apr 28 08:13 perly.y

after:

-rw-r--r-- 1 tony tony  66796 Apr 28 11:34 perly.act
-rw-r--r-- 1 tony tony  19138 Jul 25  2024 perly.c
-rw-r--r-- 1 tony tony  10182 Apr 28 11:34 perly.h
-rw-r--r-- 1 tony tony 272864 Apr 28 11:34 perly.o
-rw-r--r-- 1 tony tony 106585 Apr 28 11:34 perly.tab
-rw-r--r-- 1 tony tony  50541 Apr 28 11:40 perly.y

tonycoz avatar Apr 28 '25 01:04 tonycoz

Looks good otherwise.

tonycoz avatar Apr 28 '25 01:04 tonycoz

I've dropped the changes to regen_perly.pl. Whatever was going on with my setup, it seems to be gone after git clean -dfx + rebuild.

mauke avatar Apr 28 '25 02:04 mauke

Code change all looks good, but I think it could do with adding a new test of the new message to t/lib/croak/op.

I've added some tests to t/lib/croak/toke, next to the existing our (my $x) tests.

mauke avatar Apr 28 '25 16:04 mauke