From dcca861554e90d6395c3c153317b0b0e3841f103 Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Sun, 15 Jan 2023 07:32:50 -0500 Subject: [PATCH] Improve typedef logic for MacOS Tom Lane --- run_build.pl | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/run_build.pl b/run_build.pl index 5683a2c..09a34af 100755 --- a/run_build.pl +++ b/run_build.pl @@ -2186,7 +2186,32 @@ sub find_typedefs next if $bin =~ m!bin/(ipcclean|pltcl_)!; next unless -f $bin; next if -l $bin; # ignore symlinks to plain files (e.g. postmaster) - if (@err == 1) # Linux and sometimes windows + if ($using_osx) + { + # no run_log due to redirections. + @dumpout = + `dwarfdump $bin 2>/dev/null | egrep -A2 TAG_typedef 2>/dev/null`; + foreach (@dumpout) + { + ## no critic (RegularExpressions::ProhibitCaptureWithoutTest) + @flds = split; + if (@flds == 3) + { + # old format + next unless ($flds[0] eq "AT_name("); + next unless ($flds[1] =~ m/^"(.*)"$/); + $syms{$1} = 1; + } + elsif (@flds == 2) + { + # new format + next unless ($flds[0] eq "DW_AT_name"); + next unless ($flds[1] =~ m/^\("(.*)"\)$/); + $syms{$1} = 1; + } + } + } + elsif (@err == 1) # Linux and sometimes windows { my $cmd = "$objdump -Wi $bin 2>/dev/null | " . "egrep -A3 DW_TAG_typedef 2>/dev/null"; @@ -2217,31 +2242,6 @@ sub find_typedefs $syms{ $flds[-1] } = 1; } } - elsif ($using_osx) - { - # no run_log due to redirections. - @dumpout = - `dwarfdump $bin 2>/dev/null | egrep -A2 TAG_typedef 2>/dev/null`; - foreach (@dumpout) - { - ## no critic (RegularExpressions::ProhibitCaptureWithoutTest) - @flds = split; - if (@flds == 3) - { - # old format - next unless ($flds[0] eq "AT_name("); - next unless ($flds[1] =~ m/^"(.*)"$/); - $syms{$1} = 1; - } - elsif (@flds == 2) - { - # new format - next unless ($flds[0] eq "DW_AT_name"); - next unless ($flds[1] =~ m/^\("(.*)"\)$/); - $syms{$1} = 1; - } - } - } else { # no run_log due to redirections.