[Perl/perl5] c7b4e1: toke.c - silence maybe-uninitialized warning on gc...

2023-02-17 Thread Yves Orton via perl5-changes
  Branch: refs/heads/yves/fix_maybe_uninit
  Home:   https://github.com/Perl/perl5
  Commit: c7b4e1f745e0bcda876df403ab81f7e5603d64ed
  
https://github.com/Perl/perl5/commit/c7b4e1f745e0bcda876df403ab81f7e5603d64ed
  Author: Yves Orton 
  Date:   2023-02-18 (Sat, 18 Feb 2023)

  Changed paths:
M toke.c

  Log Message:
  ---
  toke.c - silence maybe-uninitialized warning on gcc 12

This silences the following (bogus) warning:

toke.c:12104:24: warning:
‘b’ may be used uninitialized [-Wmaybe-uninitialized]

It won't be used unitialized, but there is no reason not to initialize
it to shut up the warning on gcc-12

Fixes Github Issue #20816


  Commit: 11e18305d0b150fb7898830747d718237791cce1
  
https://github.com/Perl/perl5/commit/11e18305d0b150fb7898830747d718237791cce1
  Author: Yves Orton 
  Date:   2023-02-18 (Sat, 18 Feb 2023)

  Changed paths:
M ext/mro/mro.pm
M ext/mro/mro.xs

  Log Message:
  ---
  mro.xs - silence maybe-uninitialized warning on gcc 12

Silence the following bogus warning:

mro.xs:561:25: warning:
‘fq_subname_len’ may be used uninitialized [-Wmaybe-uninitialized]

561 | subname_len = fq_subname_len - (subname - fq_subname);

The code does not need to be structured the way it was, and we actually
don't need to define fq_subname_len at all. So restructure the code and
remove it and make gcc-12 shut up.

Fixes GH Issue #20816


  Commit: ef2219211cc6fd32462467f1ab8736497c8baf6e
  
https://github.com/Perl/perl5/commit/ef2219211cc6fd32462467f1ab8736497c8baf6e
  Author: Yves Orton 
  Date:   2023-02-18 (Sat, 18 Feb 2023)

  Changed paths:
M pp_hot.c

  Log Message:
  ---
  pp_hot.c - rework padhv_rv2hv_common fix maybe-uninit warning on gcc 12

This function was creating a var is_tied that was not necessary,
and using unnecessarily convoluted code to achieve its goals. Its
still somewhat convoluted, but less so. Since we no longer have to
predeclare all variables, moving the bulk of the var decls down
makes the code more clear, and ensures that nothing ends up
uninitialized.

GCC 12 warnings seems to have crappy warnings and overly senstivie ones
as well. The actual usage was from line 1912 in pp_hot.c, yet the
warning mumbles a lot about embed.h. Feh. Note as far as I am concerned
this warning was bogus, except that it highlighted unnecessarily
convoluted code that should be cleaned up.

In file included from perl.h:6197,
 from pp_hot.c:36:
embed.h: In function ‘S_padhv_rv2hv_common’:
embed.h:981:49: warning:
  ‘mg’ may be used uninitialized [-Wmaybe-uninitialized]
  981 | #   define magic_scalarpack(a,b)\
Perl_magic_scalarpack(aTHX_ a,b)
  | ^
pp_hot.c:1878:12: note: ‘mg’ was declared here
 1878 | MAGIC *mg;
  |^~

Fixes Github Issue #20816


  Commit: 22f479e1bc72967eedd09ede76948d92edc433a1
  
https://github.com/Perl/perl5/commit/22f479e1bc72967eedd09ede76948d92edc433a1
  Author: Yves Orton 
  Date:   2023-02-18 (Sat, 18 Feb 2023)

  Changed paths:
M dist/Devel-PPPort/PPPort_pm.PL
M dist/Devel-PPPort/parts/inc/misc

  Log Message:
  ---
  Devel-PPPort - silence maybe-uninitialized warnings on gcc-12

GCC-12 seems to have a propensity to warning about maybe-uninitialized
variables a lot more than it should. Most of the cases I have looked
into it turns out to be a false positive, but at the same time, it is
pretty simple to fix this kind of thing, so just fix it so the darn
thing will shut up.

This one just initializes some variables to NULL at the start of a test
function.

Fixes the following (slightly elided) warning.

gcc-12 -c ... -Og -g ... -W -Wall RealPPPort.c
In file included from ../../perl.h:6197,
 from RealPPPort.xs:31:
../../embed.h: In function ‘XS_Devel__PPPort_OpSIBLING_tests’:
../../embed.h:461:49:
warning: ‘lastkid’ may be used uninitialized [-Wmaybe-uninitialized]
  461 | # define op_free(a)
Perl_op_free(aTHX_ a)
^~~~
RealPPPort.xs:1741:21: note: ‘lastkid’ was declared here
 1741 | OP *lastkid;
  | ^~~

Fixes Github Issue #20816


Compare: https://github.com/Perl/perl5/compare/c7b4e1f745e0%5E...22f479e1bc72


[Perl/perl5] 04c020: Fix a bunch of memory leaks in feature 'class'

2023-02-17 Thread Paul Evans via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 04c0207ebb3cb7f894b5f5b6320970aabda477a9
  
https://github.com/Perl/perl5/commit/04c0207ebb3cb7f894b5f5b6320970aabda477a9
  Author: Paul "LeoNerd" Evans 
  Date:   2023-02-17 (Fri, 17 Feb 2023)

  Changed paths:
M class.c
M hv.c
M pad.c
M pad.h
M perly.act
M perly.h
M perly.tab
M perly.y
M sv.c

  Log Message:
  ---
  Fix a bunch of memory leaks in feature 'class'

 * Free the attrlist OP fragment when applying class or field attribute
 * Free the OP_PADxV ops we only use to get the pad index out for
   fieldvar declarations
 * Add a refcount to the `struct padname_fieldinfo` to keep track of its
   capture in inner closures so it can be freed at the right time
 * Free the class-related fields out of HvAUX
 * Free the actual ObjectFIELDS() array when destroying an object instance
 * Dup fieldinfo->paramname at sv_dup() time / free it at free time




[Perl/perl5] 7da192: [pod] release_managers_guide.pod: spelling fix

2023-02-17 Thread Elvin Aslanov via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 7da1927c007a205d378f1913ba5dd4027799926e
  
https://github.com/Perl/perl5/commit/7da1927c007a205d378f1913ba5dd4027799926e
  Author: Elvin Aslanov 
  Date:   2023-02-17 (Fri, 17 Feb 2023)

  Changed paths:
M Porting/release_managers_guide.pod

  Log Message:
  ---
  [pod] release_managers_guide.pod: spelling fix

1 letter: "as long as"




[Perl/perl5] 54446d: Calculate conflict markers instead of hardcoding

2023-02-17 Thread Yves Orton via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 54446d4f70689e0027bf1e9ba86be8bca9904ee4
  
https://github.com/Perl/perl5/commit/54446d4f70689e0027bf1e9ba86be8bca9904ee4
  Author: Andrew Hewus Fresh 
  Date:   2023-02-17 (Fri, 17 Feb 2023)

  Changed paths:
M t/comp/parser.t

  Log Message:
  ---
  Calculate conflict markers instead of hardcoding

It turns out that some tooling (Game of Trees) has special handling for
conflict markers and will continually mark files that have them.

Since the test doesn't actually need them to be expanded,
calculate them instead to not trigger the detection.


  Commit: befe556df0101b81e0df487e4a7c9b7b3ea1a832
  
https://github.com/Perl/perl5/commit/befe556df0101b81e0df487e4a7c9b7b3ea1a832
  Author: Yves Orton 
  Date:   2023-02-17 (Fri, 17 Feb 2023)

  Changed paths:
M t/test.pl

  Log Message:
  ---
  t/test.pl - support NOTE comments in code for run_multiple_progs()

These comments will be autoremoved from the code before it is executed.
*Must* start the line, and have exactly one space between the comment
char and the NOTE string, which must be uppercased.

This will be used in the following patch.


  Commit: 02d6071031bd9a27295cf9f217e280098e7d6b65
  
https://github.com/Perl/perl5/commit/02d6071031bd9a27295cf9f217e280098e7d6b65
  Author: Yves Orton 
  Date:   2023-02-17 (Fri, 17 Feb 2023)

  Changed paths:
M t/test.pl

  Log Message:
  ---
  t/test.pl - support obfu conflict markers for code via run_multiple_progs()

This was we dont have to have literal conflict markers in test code
that is executed via run_multiple_progs(). For instance, t/lib/croak/toke
patch for that will follow.


  Commit: a3129c9ac8adb96e5e5bbdd1a2856967692728ed
  
https://github.com/Perl/perl5/commit/a3129c9ac8adb96e5e5bbdd1a2856967692728ed
  Author: Yves Orton 
  Date:   2023-02-17 (Fri, 17 Feb 2023)

  Changed paths:
M t/lib/croak/toke

  Log Message:
  ---
  t/lib/croak/toke - hide conflict markers in test code

This uses the previous two patches to add a NOTE comment
to the test for conflict markers explaining that we are using
the obfu style markers that run_multiple_progs() supports (now),
so that picky tools don't think we have conflict markers in
our files.


Compare: https://github.com/Perl/perl5/compare/e10136381f20...a3129c9ac8ad


[Perl/perl5] add24d: embed.fnc - sort entries alphabetically by functio...

2023-02-17 Thread Yves Orton via perl5-changes
  Branch: refs/heads/yves/tidy_embed_fnc
  Home:   https://github.com/Perl/perl5
  Commit: add24d8948b1968264236a0cd592a60c969c4866
  
https://github.com/Perl/perl5/commit/add24d8948b1968264236a0cd592a60c969c4866
  Author: Yves Orton 
  Date:   2023-02-17 (Fri, 17 Feb 2023)

  Changed paths:
M regen/tidy_embed.pl

  Log Message:
  ---
  embed.fnc - sort entries alphabetically by function name.

This is actually a library sort (lc with underbars removed), followed by a
lexicographical sort. Comment lines are sticky to the line that follows
them.

Somehow the original version of this patch was missed in my earlier work on
tidy_embed.pl, I think I messed up a rebase somehow. I noticed it was missing
when I realized that new entries werent being sorted into place correctly.

While this patch creates a fair bit of churn in the file right now, long
term it will make it easier to use. Also note that the *output* files
have not changed, which validates that the patch did not break anything.


  Commit: 9a93998d485054bc88c4126e13f73dced852528f
  
https://github.com/Perl/perl5/commit/9a93998d485054bc88c4126e13f73dced852528f
  Author: Yves Orton 
  Date:   2023-02-17 (Fri, 17 Feb 2023)

  Changed paths:
M embed.fnc

  Log Message:
  ---
  embed.fnc - updated as per previous commit (squash before committing)


  Commit: 1280179a54c501672fadaf025b2a268c669b1f38
  
https://github.com/Perl/perl5/commit/1280179a54c501672fadaf025b2a268c669b1f38
  Author: Yves Orton 
  Date:   2023-02-17 (Fri, 17 Feb 2023)

  Changed paths:
M regen/HeaderParser.pm
M regen/embed.pl

  Log Message:
  ---
  embed.pl - sort and dedupe flags in embef.fnc as part of tidy

This ensures we use a canonical string for each possible flag variant,
which makes it easier to search for flags with a given flag signature.

It also exposed a mutex bug in flag handling which caused
PerlEnv_putenv to be improperly marked as static, when it is in fact
static inline.

To validate there aren't any issues like this remaining in the script
I set it up so the flags were shuffled during processing and ran
embed.pl in a loop for a while and none of the output files changed,
so I assume there are no further such issues.

This patch also includes some basic validation of the flags so that if
someone misses a line continuation the following lines are not treated
as a new definition without any flags. I also ran perltidy on it
according to the rules contained within the file.


  Commit: 86344c764f89676ffd11047d28936270cf48eedb
  
https://github.com/Perl/perl5/commit/86344c764f89676ffd11047d28936270cf48eedb
  Author: Yves Orton 
  Date:   2023-02-17 (Fri, 17 Feb 2023)

  Changed paths:
M embed.fnc

  Log Message:
  ---
  embed.fnc - updated as per previous commit (squash before committing)


Compare: https://github.com/Perl/perl5/compare/e78674502645...86344c764f89