From: Peter O. <obe...@us...> - 2012-07-06 14:29:29
|
Update of /cvsroot/ltp/utils/analysis/lcov/bin In directory vz-cvs-4.sog:/tmp/cvs-serv28201 Modified Files: geninfo Log Message: geninfo: rename compatibility setting to compatibility mode Index: geninfo =================================================================== RCS file: /cvsroot/ltp/utils/analysis/lcov/bin/geninfo,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** geninfo 6 Jul 2012 09:03:27 -0000 1.99 --- geninfo 6 Jul 2012 14:29:27 -0000 1.100 *************** *** 89,98 **** our $EXCL_LINE = "LCOV_EXCL_LINE"; ! # Compatibility setting values our $COMPAT_VALUE_OFF = 0; our $COMPAT_VALUE_ON = 1; our $COMPAT_VALUE_AUTO = 2; ! # Compatibility setting value names our %COMPAT_NAME_TO_VALUE = ( "off" => $COMPAT_VALUE_OFF, --- 89,98 ---- our $EXCL_LINE = "LCOV_EXCL_LINE"; ! # Compatibility mode values our $COMPAT_VALUE_OFF = 0; our $COMPAT_VALUE_ON = 1; our $COMPAT_VALUE_AUTO = 2; ! # Compatibility mode value names our %COMPAT_NAME_TO_VALUE = ( "off" => $COMPAT_VALUE_OFF, *************** *** 101,136 **** ); ! # Compatiblity setting flags ! our $COMPAT_FLAG_LIBTOOL = 1 << 0; ! our $COMPAT_FLAG_HAMMER = 1 << 1; ! our $COMPAT_FLAG_GCC_4_7 = 1 << 2; ! # Compatibility setting flag names ! our %COMPAT_NAME_TO_FLAG = ( ! "libtool" => $COMPAT_FLAG_LIBTOOL, ! "hammer" => $COMPAT_FLAG_HAMMER, ! "android_4_4_0" => $COMPAT_FLAG_GCC_4_7, ! "gcc_4_7" => $COMPAT_FLAG_GCC_4_7, ); ! # Map flags to names ! our %COMPAT_FLAG_TO_NAME = ( ! $COMPAT_FLAG_LIBTOOL => "libtool", ! $COMPAT_FLAG_HAMMER => "hammer", ! $COMPAT_FLAG_GCC_4_7 => "gcc_4_7/android_4_4_0", ); ! # Compatibility setting default values ! our %COMPAT_FLAG_DEFAULTS = ( ! $COMPAT_FLAG_LIBTOOL => $COMPAT_VALUE_ON, ! $COMPAT_FLAG_HAMMER => $COMPAT_VALUE_OFF, ! $COMPAT_FLAG_GCC_4_7 => $COMPAT_VALUE_AUTO, ); ! # Compatibility setting autodetection routines sub compat_hammer_autodetect(); ! our %COMPAT_FLAG_AUTO = ( ! $COMPAT_FLAG_HAMMER => \&compat_hammer_autodetect, ! $COMPAT_FLAG_GCC_4_7 => 1, ); --- 101,136 ---- ); ! # Compatiblity modes ! our $COMPAT_MODE_LIBTOOL = 1 << 0; ! our $COMPAT_MODE_HAMMER = 1 << 1; ! our $COMPAT_MODE_GCC_4_7 = 1 << 2; ! # Compatibility mode names ! our %COMPAT_NAME_TO_MODE = ( ! "libtool" => $COMPAT_MODE_LIBTOOL, ! "hammer" => $COMPAT_MODE_HAMMER, ! "gcc_4_7" => $COMPAT_MODE_GCC_4_7, ! "android_4_4_0" => $COMPAT_MODE_GCC_4_7, ); ! # Map modes to names ! our %COMPAT_MODE_TO_NAME = ( ! $COMPAT_MODE_LIBTOOL => "libtool", ! $COMPAT_MODE_HAMMER => "hammer", ! $COMPAT_MODE_GCC_4_7 => "gcc_4_7", ); ! # Compatibility mode default values ! our %COMPAT_MODE_DEFAULTS = ( ! $COMPAT_MODE_LIBTOOL => $COMPAT_VALUE_ON, ! $COMPAT_MODE_HAMMER => $COMPAT_VALUE_OFF, ! $COMPAT_MODE_GCC_4_7 => $COMPAT_VALUE_AUTO, ); ! # Compatibility mode auto-detection routines sub compat_hammer_autodetect(); ! our %COMPAT_MODE_AUTO = ( ! $COMPAT_MODE_HAMMER => \&compat_hammer_autodetect, ! $COMPAT_MODE_GCC_4_7 => 1, # will be done later ); *************** *** 200,204 **** sub is_external($); sub compat_name($); ! sub parse_compat_flags($); sub is_compat($); sub is_compat_auto($); --- 200,204 ---- sub is_external($); sub compat_name($); ! sub parse_compat_modes($); sub is_compat($); sub is_compat_auto($); *************** *** 381,386 **** push(@gcov_options, "-p") if ($gcov_caps->{'preserve-paths'}); ! # Determine compatibility flags ! parse_compat_flags($opt_compat); # Determine which errors the user wants us to ignore --- 381,386 ---- push(@gcov_options, "-p") if ($gcov_caps->{'preserve-paths'}); ! # Determine compatibility modes ! parse_compat_modes($opt_compat); # Determine which errors the user wants us to ignore *************** *** 458,462 **** if ($gcov_version < $GCOV_VERSION_3_4_0) { ! if (is_compat($COMPAT_FLAG_HAMMER)) { $data_file_extension = ".da"; --- 458,462 ---- if ($gcov_version < $GCOV_VERSION_3_4_0) { ! if (is_compat($COMPAT_MODE_HAMMER)) { $data_file_extension = ".da"; *************** *** 840,844 **** # avoid files from .libs dirs ! if (is_compat($COMPAT_FLAG_LIBTOOL) && $da_dir =~ m/(.*)\/\.libs$/) { $source_dir = $1; } else { --- 840,844 ---- # avoid files from .libs dirs ! if (is_compat($COMPAT_MODE_LIBTOOL) && $da_dir =~ m/(.*)\/\.libs$/) { $source_dir = $1; } else { *************** *** 898,902 **** if ($gcov_version < $GCOV_VERSION_3_4_0) { ! if (is_compat($COMPAT_FLAG_HAMMER)) { ($instr, $graph) = read_bbg($bb_filename, $base_dir); --- 898,902 ---- if ($gcov_version < $GCOV_VERSION_3_4_0) { ! if (is_compat($COMPAT_MODE_HAMMER)) { ($instr, $graph) = read_bbg($bb_filename, $base_dir); *************** *** 2158,2162 **** # avoid files from .libs dirs ! if (is_compat($COMPAT_FLAG_LIBTOOL) && $graph_dir =~ m/(.*)\/\.libs$/) { $source_dir = $1; } else { --- 2158,2162 ---- # avoid files from .libs dirs ! if (is_compat($COMPAT_MODE_LIBTOOL) && $graph_dir =~ m/(.*)\/\.libs$/) { $source_dir = $1; } else { *************** *** 2176,2180 **** if ($gcov_version < $GCOV_VERSION_3_4_0) { ! if (is_compat($COMPAT_FLAG_HAMMER)) { ($instr, $graph) = read_bbg($graph_filename, $base_dir); --- 2176,2180 ---- if ($gcov_version < $GCOV_VERSION_3_4_0) { ! if (is_compat($COMPAT_MODE_HAMMER)) { ($instr, $graph) = read_bbg($graph_filename, $base_dir); *************** *** 3052,3056 **** return 1 if ($gcov_version >= $GCOV_VERSION_4_7_0); ! return 1 if (is_compat($COMPAT_FLAG_GCC_4_7)); # Heuristic: --- 3052,3056 ---- return 1 if ($gcov_version >= $GCOV_VERSION_4_7_0); ! return 1 if (is_compat($COMPAT_MODE_GCC_4_7)); # Heuristic: *************** *** 3066,3070 **** $overlong_string = 1 if ($strlen * 4 >= $rec_length - 12); ! if (!is_compat_auto($COMPAT_FLAG_GCC_4_7)) { # Sanity check if ($overlong_string) { --- 3066,3070 ---- $overlong_string = 1 if ($strlen * 4 >= $rec_length - 12); ! if (!is_compat_auto($COMPAT_MODE_GCC_4_7)) { # Sanity check if ($overlong_string) { *************** *** 3326,3338 **** # ! # compat_name(flag) # ! # Return the name of compatibility flag FLAG. # sub compat_name($) { ! my ($flag) = @_; ! my $name = $COMPAT_FLAG_TO_NAME{$flag}; return $name if (defined($name)); --- 3326,3338 ---- # ! # compat_name(mode) # ! # Return the name of compatibility mode MODE. # sub compat_name($) { ! my ($mode) = @_; ! my $name = $COMPAT_MODE_TO_NAME{$mode}; return $name if (defined($name)); *************** *** 3342,3351 **** # ! # parse_compat_flags(opt) # ! # Determine compatibility flag settings. # ! sub parse_compat_flags($) { my ($opt) = @_; --- 3342,3351 ---- # ! # parse_compat_modes(opt) # ! # Determine compatibility mode settings. # ! sub parse_compat_modes($) { my ($opt) = @_; *************** *** 3354,3362 **** # Initialize with defaults ! %compat_value = %COMPAT_FLAG_DEFAULTS; # Add old style specifications if (defined($opt_compat_libtool)) { ! $compat_value{$COMPAT_FLAG_LIBTOOL} = $opt_compat_libtool ? $COMPAT_VALUE_ON : $COMPAT_VALUE_OFF; --- 3354,3362 ---- # Initialize with defaults ! %compat_value = %COMPAT_MODE_DEFAULTS; # Add old style specifications if (defined($opt_compat_libtool)) { ! $compat_value{$COMPAT_MODE_LIBTOOL} = $opt_compat_libtool ? $COMPAT_VALUE_ON : $COMPAT_VALUE_OFF; *************** *** 3368,3430 **** } foreach my $directive (@opt_list) { ! my ($flag, $value); # Either ! # flag=off|on|auto or ! # flag (implies auto) if ($directive !~ /^(\w+)=(\w+)$/ && $directive !~ /^(\w+)$/) { ! die("ERROR: Unknown compatibility setting format: ". "$directive!\n"); } ! # Determine flag ! $flag = $COMPAT_NAME_TO_FLAG{lc($1)}; ! if (!defined($flag)) { ! die("ERROR: Unknown compatibility setting: $1!\n"); } ! $specified{$flag} = 1; # Determine value if (defined($2)) { $value = $COMPAT_NAME_TO_VALUE{lc($2)}; if (!defined($value)) { ! die("ERROR: Unknown compatibility setting ". ! "value: $2!\n"); } } else { $value = $COMPAT_VALUE_ON; } ! $compat_value{$flag} = $value; } ! # Perform autodetection ! foreach my $flag (sort(keys(%compat_value))) { ! my $value = $compat_value{$flag}; my $is_autodetect = ""; ! my $name = compat_name($flag); if ($value == $COMPAT_VALUE_AUTO) { ! my $autodetect = $COMPAT_FLAG_AUTO{$flag}; if (!defined($autodetect)) { ! die("ERROR: No automatic detection for ". ! "setting '$name' available!\n"); } if (ref($autodetect) eq "CODE") { $value = &$autodetect(); ! $compat_value{$flag} = $value; $is_autodetect = " (auto-detected)"; } } ! if ($specified{$flag}) { if ($value == $COMPAT_VALUE_ON) { ! info("Enabling compatibility setting ". "'$name'$is_autodetect\n"); } elsif ($value == $COMPAT_VALUE_OFF) { ! info("Disabling compatibility setting ". "'$name'$is_autodetect\n"); } else { info("Using delayed auto-detection for ". ! "compatibility setting ". "'$name'\n"); } --- 3368,3430 ---- } foreach my $directive (@opt_list) { ! my ($mode, $value); # Either ! # mode=off|on|auto or ! # mode (implies on) if ($directive !~ /^(\w+)=(\w+)$/ && $directive !~ /^(\w+)$/) { ! die("ERROR: Unknown compatibility mode specification: ". "$directive!\n"); } ! # Determine mode ! $mode = $COMPAT_NAME_TO_MODE{lc($1)}; ! if (!defined($mode)) { ! die("ERROR: Unknown compatibility mode '$1'!\n"); } ! $specified{$mode} = 1; # Determine value if (defined($2)) { $value = $COMPAT_NAME_TO_VALUE{lc($2)}; if (!defined($value)) { ! die("ERROR: Unknown compatibility mode ". ! "value '$2'!\n"); } } else { $value = $COMPAT_VALUE_ON; } ! $compat_value{$mode} = $value; } ! # Perform auto-detection ! foreach my $mode (sort(keys(%compat_value))) { ! my $value = $compat_value{$mode}; my $is_autodetect = ""; ! my $name = compat_name($mode); if ($value == $COMPAT_VALUE_AUTO) { ! my $autodetect = $COMPAT_MODE_AUTO{$mode}; if (!defined($autodetect)) { ! die("ERROR: No auto-detection for ". ! "mode '$name' available!\n"); } if (ref($autodetect) eq "CODE") { $value = &$autodetect(); ! $compat_value{$mode} = $value; $is_autodetect = " (auto-detected)"; } } ! if ($specified{$mode}) { if ($value == $COMPAT_VALUE_ON) { ! info("Enabling compatibility mode ". "'$name'$is_autodetect\n"); } elsif ($value == $COMPAT_VALUE_OFF) { ! info("Disabling compatibility mode ". "'$name'$is_autodetect\n"); } else { info("Using delayed auto-detection for ". ! "compatibility mode ". "'$name'\n"); } *************** *** 3445,3472 **** # ! # is_compat(flag) # ! # Return non-zero if compatibility setting for FLAG is enabled. # sub is_compat($) { ! my ($flag) = @_; ! return 1 if ($compat_value{$flag} == $COMPAT_VALUE_ON); return 0; } # ! # is_compat_auto(flag) # ! # Return non-zero if compatibility setting for FLAG is set to auto-detect. # sub is_compat_auto($) { ! my ($flag) = @_; ! return 1 if ($compat_value{$flag} == $COMPAT_VALUE_AUTO); return 0; } --- 3445,3472 ---- # ! # is_compat(mode) # ! # Return non-zero if compatibility mode MODE is enabled. # sub is_compat($) { ! my ($mode) = @_; ! return 1 if ($compat_value{$mode} == $COMPAT_VALUE_ON); return 0; } # ! # is_compat_auto(mode) # ! # Return non-zero if compatibility mode MODE is set to auto-detect. # sub is_compat_auto($) { ! my ($mode) = @_; ! return 1 if ($compat_value{$mode} == $COMPAT_VALUE_AUTO); return 0; } |