From 626218ced83c98e8f0b17240690afe49bea9d07c Mon Sep 17 00:00:00 2001 From: Chris Green Date: Fri, 5 Jan 2024 15:35:35 -0600 Subject: [PATCH] Satisfy BuiltinFunctions::ProhibitVoid{Grep,Map} --- libexec/Cetmodules/CMake.pm | 7 ++++--- libexec/Cetmodules/Migrate/CMake/Handlers.pm | 11 +++++++---- libexec/Cetmodules/Migrate/CMake/Tagging.pm | 6 +++--- libexec/Cetmodules/Migrate/ProductDeps.pm | 5 ++--- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/libexec/Cetmodules/CMake.pm b/libexec/Cetmodules/CMake.pm index 0f0d4593..08c5f599 100644 --- a/libexec/Cetmodules/CMake.pm +++ b/libexec/Cetmodules/CMake.pm @@ -237,9 +237,10 @@ sub process_cmake_file { cmake_file_in => $cmake_file_in, pending_comments => {} }; $cmake_file_out and $cmake_file_data->{cmake_file_out} = $cmake_file_out; - grep { - m&_handler\z&msx and $cmake_file_data->{$_} = delete $options->{$_}; - } keys %{$options}; + foreach my $option_key (keys %{$options}) { + $option_key =~ m&_handler\z&msx and + $cmake_file_data->{$option_key} = delete $options->{$option_key}; + } $cmake_file_data->{cmd_handler_regex} = join(q(|), map { quotemeta(sprintf('%s', $_)); } keys %{ $cmake_file_data->{cmd_handlers} }); diff --git a/libexec/Cetmodules/Migrate/CMake/Handlers.pm b/libexec/Cetmodules/Migrate/CMake/Handlers.pm index 5e8145e2..5d1a61c9 100644 --- a/libexec/Cetmodules/Migrate/CMake/Handlers.pm +++ b/libexec/Cetmodules/Migrate/CMake/Handlers.pm @@ -1128,13 +1128,16 @@ sub tbb_offload { # Remove problematic and unnecessary install path fragments. sub _ah_fix_install_paths { my ($cmd_info, $arg_idx_idx) = @_; - grep { - if (my @separated = $cmd_info->arg_at($_)) { + my $changed; + foreach my $idx (@{$arg_idx_idx}) { + if (my @separated = $cmd_info->arg_at($idx)) { $separated[(scalar @separated > 1) ? 1 : 0] =~ s&\$\{product\}/+\$\{version\}/*&&gmsx - and $cmd_info->replace_arg_at($_, join(q(), @separated)); + and $cmd_info->replace_arg_at($idx, join(q(), @separated)) + and $changed = 1; } ## end if (my @separated = $cmd_info...) - } @{$arg_idx_idx} and tag_changed($cmd_info, <<'EOF'); + } + $changed and tag_changed($cmd_info, <<'EOF'); ${product}/+${version}/* -> "" EOF return; diff --git a/libexec/Cetmodules/Migrate/CMake/Tagging.pm b/libexec/Cetmodules/Migrate/CMake/Tagging.pm index 721e28d0..a61565d7 100644 --- a/libexec/Cetmodules/Migrate/CMake/Tagging.pm +++ b/libexec/Cetmodules/Migrate/CMake/Tagging.pm @@ -93,10 +93,10 @@ sub ignored { sub report_removed { my ($cmake_file, $msg, @args) = @_; defined $msg or $msg = q(); - map { + foreach my $arg (@args) { info("command removed from $cmake_file:$_->{start_line}$msg:\n", - reconstitute_code($_)); - } @args; + reconstitute_code($arg)); + } return; } ## end sub report_removed diff --git a/libexec/Cetmodules/Migrate/ProductDeps.pm b/libexec/Cetmodules/Migrate/ProductDeps.pm index 1012bed6..836484b0 100644 --- a/libexec/Cetmodules/Migrate/ProductDeps.pm +++ b/libexec/Cetmodules/Migrate/ProductDeps.pm @@ -364,8 +364,7 @@ sub _write_qualifier_table { $ntabs->{ $headers->[-1] } = 0; # No padding at end of table. $fh->print(trim_lines(map { _pad_to($ntabs->{$_}, $_); } @{$headers}), "\n"); - grep { - my $qualifier = $_; + foreach my $qualifier (sort keys %{ $qualifier_table->{qualifier} }) { $fh->print( trim_lines( map { @@ -374,7 +373,7 @@ sub _write_qualifier_table { } @{$headers} ), "\n"); - } sort keys %{ $qualifier_table->{qualifier} }; + } $fh->print("end_qualifier_list\n"); return; } ## end sub _write_qualifier_table