| 1 | #!/usr/local/bin/perl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 58 | ▶ | eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | if $running_under_some_shell; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 58 | --$running_under_some_shell; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # Version 2.0, Simon Cozens, Thu Mar 30 17:52:45 JST 2000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # Version 2.01, Tom Christiansen, Thu Mar 30 08:25:14 MST 2000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # Version 2.02, Simon Cozens, Sun Apr 16 01:53:36 JST 2000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # Version 2.03, Edward Peschko, Mon Feb 26 12:04:17 PST 2001 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # Version 2.04, Enache Adrian, Fri, 18 Jul 2003 23:15:37 +0300 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # Version 2.05, Reini Urban, 2009-12-01 00:00:13 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # Version 2.06, Reini Urban, 2009-12-28 21:56:15 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # Version 2.07, Reini Urban, 2010-06-30 22:32:20 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # Version 2.08, Reini Urban, 2010-07-30 21:30:33 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # Version 2.09, Reini Urban, 2010-10-11 13:54:52 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # Version 2.10, Reini Urban, 2011-02-11 22:58:37 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # Version 2.11, Reini Urban, 2011-04-11 20:16:00 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | # Version 2.12, Reini Urban, 2011-10-02 05:19:00 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # Version 2.13, Reini Urban, 2012-01-10 13:03:00 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | # Version 2.14, Reini Urban, 2012-02-28 09:04:07 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | # Version 2.15, Reini Urban, 2013-02-01 10:41:54 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | # Version 2.16, Reini Urban, 2013-11-27 11:36:13 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # Version 2.17, Reini Urban, Thu Feb 6 14:04:29 2014 -0600 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # Version 2.18, Reini Urban, 2014-05-28 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # Version 2.19, Reini Urban, 2014-07-09 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | # Version 2.20, Reini Urban, 2014-07-23 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | # Version 2.21, Reini Urban, 2016-06-12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # Version 2.22, Reini Urban, 2017-07-23 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # Version 2.23, Reini Urban, 2018-10-31 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # Version 2.24, Reini Urban, 2018-11-18 (--cross) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 58 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 58 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 58 | ▶ | use 5.006_000; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 58 | ▶ | use FileHandle; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 58 | ▶ | use Config; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 58 | ▶ | use Fcntl qw(:DEFAULT :flock); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 58 | ▶ | use File::Temp qw(tempfile); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 58 | ▶ | use File::Basename qw(basename dirname); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 58 | ▶ | use File::Path qw(mkpath); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | # use Cwd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 58 | ▶ | use Pod::Usage; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | # Time::HiRes does not work with 5.6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 58 | ▶ | use Time::HiRes qw(gettimeofday tv_interval sleep); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 58 | our $VERSION = 2.24; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 58 | $| = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 58 | eval { require B::C::Config; }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | $SIG{INT} = sub { exit(); } if exists $SIG{INT}; # exit gracefully and clean up after ourselves. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 58 | ▶ | use subs qw{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | cc_harness check_read check_write checkopts_byte choose_backend | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | compile_byte compile_cstyle compile_module generate_code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | grab_stash parse_argv sanity_check vprint yclept spawnit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | vsystem | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 58 | }; # gettimeofday tv_interval | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | sub opt(*); # imal quoting | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | sub is_winlike(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | sub is_win32(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | sub is_msvc(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 58 | our ($Options, $BinPerl, $Backend); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 58 | our ($Input => $Output); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 58 | our ($logfh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 58 | our ($cfile); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 58 | our (@begin_output); # output from BEGIN {}, for testsuite | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 58 | our ($extra_libs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # eval { main(); 1 } or die; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 58 | main(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 58 | ▶ | sub main { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
main: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 58 | parse_argv(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 58 | check_write($Output); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 58 | choose_backend(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 58 | generate_code(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 26 | run_code(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | _die("Not reached?"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | ####################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 58 | ▶ | sub choose_backend { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
choose_backend: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # Choose the backend. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 58 | $Backend = 'C'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 58 | ▶ | if (opt('B')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 5 | checkopts_byte(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 5 | $Backend = 'Bytecode'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 58 | ▶ | if (opt('S') && opt('c')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
&opt("S") and &opt("c")
MC/DC100%2/2
&opt("S") and &opt("c")
&opt("S")
&opt("c")
Truth table100%3/3
A and B
A= &opt("S")B= &opt("c")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | # die "$0: Do you want me to compile this or not?\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 1 | delete $Options->{S}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 58 | ▶ | $Backend = 'CC' if opt('O'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 58 | ▶ | sub generate_code { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generate_code: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 58 | vprint 4, "Compiling $Input"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 58 | $BinPerl = yclept(); # Calling convention for perl. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 58 | ▶ | if (exists $Options->{m}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | compile_module(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 58 | ▶ | if ($Backend eq 'Bytecode') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 5 | compile_byte(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 53 | compile_cstyle(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 55 | ▶ | exit(0) if (!opt('r')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 26 | ▶ | sub run_code { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_code: called CC=10 SCAR=35.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 26 | ▶ | if ($Backend eq 'Bytecode') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 2 | ▶ | if ($] < 5.007) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | $Output = "$BinPerl -MByteLoader $Output"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 2 | $Output = "$BinPerl $Output"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 26 | ▶ | if (opt('staticxs') and $extra_libs) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
&opt("staticxs") and $main::extra_libs
MC/DC0%0/2
&opt("staticxs") and $main::extra_libs
&opt("staticxs")
$main::extra_libs
Truth table66%2/3
A and B
A= &opt("staticxs")B= $main::extra_libs
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | my $path = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | my $PATHSEP = $^O eq 'MSWin32' ? ';' : ':'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | for (split / /, $extra_libs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | s{/[^/]+$}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | # XXX qx quote? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | $path .= $PATHSEP.$_ if $_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | if ($^O =~ /^MSWin32|msys|cygwin$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | $ENV{PATH} .= $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | vprint 0, "PATH=\$PATH$path"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } elsif ($^O ne 'darwin') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $ENV{LD_LIBRARY_PATH} .= $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | vprint 0, "LD_LIBRARY_PATH=\$LD_LIBRARY_PATH$path"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 26 | vprint 0, "Running code $Output @ARGV"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 26 | system(join(" ",$Output,@ARGV)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 26 | exit(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | # usage: vprint [level] msg args | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 357 | ▶ | sub vprint { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
vprint: called CC=6 SCAR=19.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 357 | my $level; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 357 | ▶ | if (@_ == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | $level = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } elsif ($_[0] =~ /^-?\d$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 357 | $level = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | # well, they forgot to use a number; means >0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | $level = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 357 | my $msg = "@_"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 357 | ▶ | $msg .= "\n" unless substr($msg, -1) eq "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 357 | ▶ | if (opt('v') > $level) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 27 | ▶ | if (opt('log')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | print $logfh "$0: $msg" ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 27 | print "$0: $msg"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 48 | ▶ | sub vsystem { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
vsystem: called CC=2 SCAR=8.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 48 | ▶ | if (opt('dryrun')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | print "@_\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 48 | system(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 58 | ▶ | sub parse_argv { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_argv: called CC=51 SCAR=55.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 58 | ▶ | use Getopt::Long; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | # disallows using long arguments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 58 | Getopt::Long::Configure("bundling"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 58 | Getopt::Long::Configure("no_ignore_case"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | # no difference in exists and defined for %ENV; also, a "0" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | # argument or a "" would not help cc, so skip | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 58 | ▶ | unshift @ARGV, split ' ', $ENV{PERLCC_OPTS} if $ENV{PERLCC_OPTS}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 58 | $Options = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | # support single dash -Wb. GetOptions requires --Wb with bundling enabled. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 58 | ▶ | if (my ($wb) = grep /^-Wb=.+/, @ARGV) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 5 | ▶ | $Options->{Wb} = $Options->{Wb} ? $Options->{Wb}.",".substr($wb,4) : substr($wb,4); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 5 | @ARGV = grep !/^-Wb=(.+)/, @ARGV; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | # -O2 i.e. -Wb=-O1 (new since 2.13) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 58 | ▶ | if (my ($o1) = grep /^-O(\d)$/, @ARGV) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 16 | ▶ | $Options->{Wb} = $Options->{Wb} ? $Options->{Wb}.",$o1" : $o1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 16 | @ARGV = grep !/^-O\d$/, @ARGV; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 58 | ▶ | if (my ($v) = grep /^-v\d$/, @ARGV) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 9 | $Options->{v} = 0+substr($v,2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 9 | @ARGV = grep !/^-v\d$/, @ARGV; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 58 | ▶ | if (my ($m) = grep /^-m(\w+)$/, @ARGV) { # TODO: until next arg without - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | $Options->{m} = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | @ARGV = grep !/^-m(\w+)$/, @ARGV; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 58 | ▶ | if (grep /^-stash$/, @ARGV) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 1 | $Options->{stash}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 1 | @ARGV = grep !/^-stash$/, @ARGV; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 58 | ▶ | $Options->{spawn} = 1 unless $^O eq 'MSWin32'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 58 | Getopt::Long::GetOptions( $Options, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 'L=s@', # lib directories | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 'I=s@', # include directories (FOR C, NOT FOR PERL) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 'o=s', # Output executable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 'v:i', # Verbosity level | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 'e=s', # One-liner | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 'm|sharedlib:s',# as Module [name] (new since 2.11, not yet tested) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 'r', # run resulting executable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 'B', # Byte compiler backend | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 'O', # Optimised C backend B::CC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | #'O1-4' # alias for -Wb=-O1 (new since 2.13) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 'debug|D', # alias for --Wb=-Dfull and -S to enable all debug and preserve source code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 'dryrun|n', # only print commands, do not execute | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 'c', # Compile to C only, no linking | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 'check', # pass -c to B::C and exit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 'cross=s', # pathto/config.sh (new since 2.24) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 'help|h', # Help me | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 'S', # Keep generated C file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 'T', # run the backend using perl -T | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 't', # run the backend using perl -t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 'A', # -DALLOW_PERL_OPTIONS like -D? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 'u=s@', # use packages (new since 2.13) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 'U=s@', # skip packages (new since 2.13) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 'static', # Link to static libperl (default, new since 2.11) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 'shared', # Link to shared libperl (new since 2.07) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 'staticxs', # Link static XSUBs (new since 2.07) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 'sharedxs', # Link shared XSUBs (default, new since 2.07)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 'stash', # Detect external packages via B::Stash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 'log:s', # where to log compilation process information | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 'Wb=s', # pass (comma-seperated) options to backend | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 'f=s@', # pass compiler option(s) to backend (new since 2.14) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 'Wc=s', # pass (comma-seperated) options to cc (new since 2.13) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 'Wl=s', # pass (comma-seperated) options to ld (new since 2.13) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 'testsuite', # try to be nice to testsuite modules (STDOUT, STDERR handles) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 'spawn!', # --no-spawn (new since 2.12) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 'time', # print benchmark timings (new since 2.08) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 'version', # (new since 2.13) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 58 | ▶ | if ( $Options->{debug} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | $Options->{Wb} = $Options->{Wb} ? $Options->{Wb} . ',' : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | $Options->{Wb} .= '-Dfull'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | $Options->{S} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 58 | $Options->{v} += 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 58 | ▶ | if( opt('t') && opt('T') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
&opt("t") and &opt("T")
MC/DC0%0/2
&opt("t") and &opt("T")
&opt("t")
&opt("T")
Truth table66%2/3
A and B
A= &opt("t")B= &opt("T")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | warn "Can't specify both -T and -t, -t ignored"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | $Options->{t} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 58 | ▶ | helpme() if opt('help'); # And exit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 58 | ▶ | if (opt('version')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | die version(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | # $Options->{Wb} .= ",-O1" if opt('O1'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | # $Options->{Wb} .= ",-O2" if opt('O2'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | # $Options->{Wb} .= ",-O3" if opt('O3'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | # $Options->{Wb} .= ",-O4" if opt('O4'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 58 | ▶ | $Options->{Wc} .= " -DALLOW_PERL_OPTIONS" if opt('A'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 58 | ▶ | if( $Options->{time} or $Options->{spawn} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$main::Options->{"time"} or $main::Options->{"spawn"}
MC/DC0%0/2
$main::Options->{"time"} or $main::Options->{"spawn"}
$main::Options->{"time"}
$main::Options->{"spawn"}
Truth table33%1/3
A or B
A= $main::Options->{"time"}B= $main::Options->{"spawn"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | # eval { require Time::HiRes; }; # 5.6 has no Time::HiRes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | # if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | # warn "--time ignored. No Time::HiRes\n" if $Options->{time}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | # $Options->{time} = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | #} else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | # *gettimeofday = *Time::HiRes::gettimeofday; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 58 | Time::HiRes::gettimeofday(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | # Time::HiRes->import('gettimeofday','tv_interval','sleep'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 58 | ▶ | $logfh = new FileHandle(">> " . opt('log')) if (opt('log')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 58 | ▶ | if (opt('e')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 21 | ▶ | warn "$0: using -e 'code' as input file, ignoring @ARGV\n" if @ARGV; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | # We don't use a temporary file here; why bother? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | # XXX: this is not bullet proof -- spaces or quotes in name! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 21 | ▶ | $Input = is_win32() ? # Quotes eaten by shell | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | '-e "'.opt('e').'"' : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | "-e '".opt('e')."'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 37 | $Input = shift @ARGV; # XXX: more files? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 37 | ▶ | _usage_and_die("No input file specified\n") unless $Input; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | # DWIM modules. This is bad but necessary. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 37 | ▶ | $Options->{m} = '' if $Input =~ /\.pm\z/ and !opt('m') and !opt('r'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$main::Input =~ /\.pm\z/ and not &opt("m") and not &opt("r")
$main::Input =~ /\.pm\z/ and not &opt("m")
MC/DC0%0/3
$main::Input =~ /\.pm\z/ and not &opt("m") and not &opt("r")
$main::Input =~ /\.pm\z/
not &opt("m")
not &opt("r")
Truth table25%1/4
A and not(B) and not(C)
A= $main::Input =~ /\.pm\z/B= not &opt("m")C= not &opt("r")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 37 | ▶ | vprint 1, "$0: using $Input as input file, ignoring @ARGV\n" if @ARGV; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 37 | check_read($Input); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 37 | check_perl($Input); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 58 | ▶ | if (exists $Options->{m} and opt('r')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $main::Options->{"m"} and &opt("r")
MC/DC0%0/2
exists $main::Options->{"m"} and &opt("r")
exists $main::Options->{"m"}
&opt("r")
Truth table33%1/3
A and B
A= exists $main::Options->{"m"}B= &opt("r")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | _die("Cannot run a module\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 58 | ▶ | if (opt('o')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 46 | $Output = opt('o'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 46 | ▶ | if (!opt('B') and is_winlike() and $Output !~ /\.[A-Za-z0-9]{3}$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
not &opt("B") and &is_winlike() and not $main::Output =~ /\.[A-Za-z0-9]{3}$/
not &opt("B") and &is_winlike()
MC/DC0%0/3
not &opt("B") and &is_winlike() and not $main::Output =~ /\.[A-Za-z0-9]{3}$/
not &opt("B")
&is_winlike()
not $main::Output =~ /\.[A-Za-z0-9]{3}$/
Truth table50%2/4
not(A) and B and not(C)
A= not &opt("B")B= &is_winlike()C= not $main::Output =~ /\.[A-Za-z0-9]{3}$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | $Output .= '.exe'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 46 | ▶ | $Output = relativize($Output) unless is_win32(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } elsif (opt('B')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 3 | ▶ | if (opt('e')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | my $suffix = '.plc'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | $suffix = '.pmc' if exists $Options->{m}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | (undef, $Output) = tempfile("plcXXXXX", SUFFIX => $suffix); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 3 | $Output = basename($Input) . "c"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 3 | ▶ | $Output = relativize($Output) unless is_win32(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | ▶ | } elsif (exists $Options->{m} and !opt('e')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
exists $main::Options->{"m"} and not &opt("e")
MC/DC0%0/2
exists $main::Options->{"m"} and not &opt("e")
exists $main::Options->{"m"}
not &opt("e")
Truth table33%1/3
A and not(B)
A= exists $main::Options->{"m"}B= not &opt("e")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | my $module = module_name(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | # shared lib along auto. see algo in DynaLoader | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | my @modparts = split(/::/,$module); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | my $modfname = $modparts[-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | $modfname = &mod2fname(\@modparts) if defined &mod2fname; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | my $modpname = join('/',@modparts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | my $dlext = $Config::Config{dlext}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | my $dir = $Config::Config{sitearch}."/pcc"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | eval { mkpath $dir; }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | $dir = "~/.perl5/pcc" unless -w $dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | if (! -d "$dir/$modpname") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | mkpath "$dir/$modpname" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | or die "perlcc -m: Failed to mkdir $dir/$modpname\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | $Output = "$dir/$modpname/$modfname.$dlext"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 9 | ▶ | $Output = opt('e') ? 'a.out' : $Input; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 9 | $Output =~ s/\.(p[lm]|t)$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 9 | ▶ | if ($Options->{m} or opt('shared')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$main::Options->{"m"} or &opt("shared")
MC/DC0%0/2
$main::Options->{"m"} or &opt("shared")
$main::Options->{"m"}
&opt("shared")
Truth table33%1/3
A or B
A= $main::Options->{"m"}B= &opt("shared")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | $Output .= ".".$Config{dlext}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } elsif (is_winlike()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | if ($Output eq 'a.out') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | $Output = 'a.exe'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | $Output .= '.exe'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 9 | ▶ | $Output = relativize($Output) unless is_win32(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 58 | sanity_check(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 3412 | ▶ | sub opt(*) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
opt: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 3412 | my $opt = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 3412 | ▶ | return exists($Options->{$opt}) && ($Options->{$opt} || 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%5/5
exists $main::Options->{$opt} && ($main::Options->{$opt} || 0)
$main::Options->{$opt} or 0
MC/DC100%2/2
exists $main::Options->{$opt} && ($main::Options->{$opt} || 0)
exists $main::Options->{$opt}
$main::Options->{$opt}
Truth table100%3/3
A && B
A= exists $main::Options->{$opt}B= $main::Options->{$opt}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | ▶ | sub module_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
module_name: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | my $name = $Options->{m}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | unless ($name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | $name = $Input; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | $name =~ s/\.p[lm]$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | if (basename($name) ne $name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | my $base = basename($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | # find first uppercase dirname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | my $m = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | my @list = split(/\//, $name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | pop @list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | for (@list) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | ▶ | if (/^[A-Z]/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | $m .= $_."::"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | } elsif (/^[a-z]/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | $m = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | ▶ | $name = $m ? $m.$base : $base; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | $Options->{m} = $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | sub compile_module { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compile_module: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | my $name = module_name(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | if ($Backend eq 'Bytecode') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | compile_byte("-m$name"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | compile_cstyle("-m$name"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 5 | ▶ | sub compile_byte { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compile_byte: called CC=19 SCAR=31.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 5 | vprint 3, "Writing B on $Output"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 5 | ▶ | my $opts = $] < 5.007 ? "" : "-H,-s,"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 5 | ▶ | if ($] >= 5.007 and $Input =~ /^-e/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$] >= "5.007" and $main::Input =~ /^-e/
MC/DC50%1/2
$] >= "5.007" and $main::Input =~ /^-e/
$] >= "5.007"
$main::Input =~ /^-e/
Truth table66%2/3
A and B
A= $] >= "5.007"B= $main::Input =~ /^-e/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 2 | $opts = "-H,"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 5 | ▶ | if (@_ == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | $opts .= $_[0].","; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 5 | my $addoptions = opt('Wb'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 5 | ▶ | if (opt('v') > 4) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 2 | $opts .= '-v,'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 2 | ▶ | $opts .= '-DM,-DG,-DA,-DComment,' if opt('v') > 5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | #if ($Options->{cross}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | # $opts .= '-cross='.$Options->{cross}.','; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 5 | ▶ | $opts .= "$addoptions," if $addoptions; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 5 | my $command = "$BinPerl -MO=Bytecode,$opts-o$Output $Input"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 5 | $Input =~ s/^-e.*$/-e/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 5 | vprint 5, "Compiling..."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 5 | vprint 0, "Calling $command"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 5 | ▶ | my $t0 = [gettimeofday] if opt('time'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 5 | my ($output_r, $error_r, $errcode) = spawnit($command); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 5 | ▶ | my $elapsed = tv_interval ( $t0 ) if opt('time'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 5 | ▶ | vprint -1, "c time: $elapsed" if opt('time'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 5 | ▶ | if (@$error_r && $errcode != 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@$error_r and $errcode != 0
MC/DC0%0/2
@$error_r and $errcode != 0
@$error_r
$errcode != 0
Truth table33%1/3
A and B
A= @$error_rB= $errcode != 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | _die("$Input did not compile $errcode:\n@$error_r\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 5 | my @error = grep { !/^$Input syntax OK$/o } @$error_r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 5 | @error = grep { !/^No package specified for compilation, assuming main::$/o } @error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 5 | ▶ | warn "$0: Unexpected compiler output\n@error" if @error and opt('v')<5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@error and &opt("v") < 5
MC/DC0%0/2
@error and &opt("v") < 5
@error
&opt("v") < 5
Truth table66%2/3
A and B
A= @errorB= &opt("v") < 5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 5 | ▶ | warn "@error" if @error and opt('v')>4; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@error and &opt("v") > 4
MC/DC50%1/2
@error and &opt("v") > 4
@error
&opt("v") > 4
Truth table66%2/3
A and B
A= @errorB= &opt("v") > 4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 5 | ▶ | unless (opt('dryrun')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 5 | ▶ | chmod 0777 & ~umask, $Output or _die("can't chmod $Output: $!\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 53 | ▶ | sub compile_cstyle { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compile_cstyle: called CC=73 SCAR=63.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 53 | ▶ | my $stash = opt('stash') ? grab_stash() : ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 53 | ▶ | $stash .= "," if $stash; #stash can be empty | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 53 | $stash .= "-u$_," for @{$Options->{u}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 53 | $stash .= "-U$_," for @{$Options->{U}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | #if ($ENV{PERL_CORE} and ($Config{ccflags} =~ /-m32/ or $Config{cc} =~ / -m32/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | # die "perlcc with -m32 cross compilation is not supported\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 53 | ▶ | my $taint = opt('T') ? ' -T' : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | opt('t') ? ' -t' : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | # What are we going to call our output C file? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 53 | my $lose = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 53 | my ($cfh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 53 | my $testsuite = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 53 | my $addoptions = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 53 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | $addoptions = join(",",@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 53 | ▶ | $addoptions .= opt('Wb') ? opt('Wb')."," : ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 53 | ▶ | if( $addoptions ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 21 | ▶ | $addoptions .= ',-Dfull' if opt('v') >= 6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 21 | ▶ | if (opt('v') == 5) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | ▶ | $addoptions .= opt('O') ? ',-DstFl,-v' : ',-DspF,-v'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 21 | $addoptions .= ','; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | } elsif (opt('v') > 4) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 2 | ▶ | $addoptions = opt('O') ? '-DstFl,-v,' : '-DspF,-v,'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 2 | ▶ | $addoptions = '-Dfull,-v,' if opt('v') >= 6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 53 | ▶ | if (opt('f')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | $addoptions .= "-f$_," for @{$Options->{f}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 53 | ▶ | if (opt('check')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 1 | $addoptions .= "-c,"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 53 | ▶ | if (opt('cross')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 1 | $addoptions .= '-cross='.$Options->{cross}.','; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 53 | $addoptions =~ s/,,/,/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 53 | ▶ | my $staticxs = opt('staticxs') ? "-staticxs," : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 53 | ▶ | warn "Warning: --staticxs on darwin is very experimental\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$staticxs and $^O eq "darwin"
MC/DC0%0/2
$staticxs and $^O eq "darwin"
$staticxs
$^O eq "darwin"
Truth table66%2/3
A and B
A= $staticxsB= $^O eq "darwin"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | if $staticxs and $^O eq 'darwin'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 53 | ▶ | if (opt('testsuite')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | my $bo = join '', @begin_output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | $bo =~ s/\\/\\\\\\\\/gs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | $bo =~ s/\n/\\n/gs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | $bo =~ s/,/\\054/gs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | # don't look at that: it hurts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | $testsuite = q{-fuse-script-name,-fsave-data,-fsave-sig-hash,}. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | qq[-e"print q{$bo}",] . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | q{-e"open(Test::Builder::TESTOUT\054 '>&STDOUT') or die $!",} . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | q{-e"open(Test::Builder::TESTERR\054 '>&STDERR') or die $!",}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 53 | ▶ | if (opt('check')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 1 | $cfile = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 1 | $staticxs = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | } elsif (opt('o')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 43 | $cfile = opt('o').".c"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 43 | ▶ | if (is_winlike() and $Output =~ /\.exe.c$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
&is_winlike() and $main::Output =~ /\.exe.c$/
MC/DC0%0/2
&is_winlike() and $main::Output =~ /\.exe.c$/
&is_winlike()
$main::Output =~ /\.exe.c$/
Truth table33%1/3
A and B
A= &is_winlike()B= $main::Output =~ /\.exe.c$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | $cfile =~ s/\.exe\.c$/.c/, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | ▶ | } elsif (opt('S') || opt('c')) { # We need to keep it | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
&opt("S") or &opt("c")
MC/DC0%0/2
&opt("S") or &opt("c")
&opt("S")
&opt("c")
Truth table33%1/3
A or B
A= &opt("S")B= &opt("c")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | ▶ | if (opt('e')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | $cfile = $Output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | ▶ | if (is_winlike() and $Output =~ /\.exe$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
&is_winlike() and $main::Output =~ /\.exe$/
MC/DC0%0/2
&is_winlike() and $main::Output =~ /\.exe$/
&is_winlike()
$main::Output =~ /\.exe$/
Truth table0%0/3
A and B
A= &is_winlike()B= $main::Output =~ /\.exe$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | $cfile =~ s/\.exe$//, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | $cfile .= '.c'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | $cfile = basename($Input); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | # File off extension if present | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | # hold on: plx is executable; also, careful of ordering! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | $cfile =~ s/\.(?:p(?:lx|l|h)|m)\z//i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | $cfile .= ".c"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | ▶ | $cfile = $Output if opt('c') && $Output =~ /\.c\z/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
&opt("c") and $main::Output =~ /\.c\z/i
MC/DC0%0/2
&opt("c") and $main::Output =~ /\.c\z/i
&opt("c")
$main::Output =~ /\.c\z/i
Truth table0%0/3
A and B
A= &opt("c")B= $main::Output =~ /\.c\z/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | check_write($cfile); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | } else { # Do not keep tempfiles (no -S nor -c nor -o) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 9 | $lose = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 9 | ($cfh, $cfile) = tempfile("pccXXXXX", SUFFIX => ".c"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 9 | close $cfh; # See comment just below | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 53 | ▶ | vprint 3, "Writing C on $cfile" unless opt('check'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 53 | my $max_line_len = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 53 | ▶ | if (is_msvc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | $max_line_len = '-l2000,'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 53 | my $options = "$addoptions$testsuite$max_line_len$staticxs$stash"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 53 | ▶ | $options .= "-o$cfile" unless opt('check'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 53 | ▶ | $options = substr($options,0,-1) if substr($options,-1,1) eq ","; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | # This has to do the write itself, so we can't keep a lock. Life sucks. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 53 | my $command = "$BinPerl$taint -MO=$Backend,$options $Input"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 53 | vprint 5, "Compiling..."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 53 | vprint 0, "Calling $command"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 53 | ▶ | my $t0 = [gettimeofday] if opt('time'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 53 | my ($output_r, $error_r, $errcode) = spawnit($command); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 53 | ▶ | my $elapsed = tv_interval ( $t0 ) if opt('time'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 53 | my @output = @$output_r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 53 | my @error = @$error_r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 53 | ▶ | if (@error && $errcode != 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@error and $errcode != 0
MC/DC50%1/2
@error and $errcode != 0
@error
$errcode != 0
Truth table66%2/3
A and B
A= @errorB= $errcode != 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 2 | _die("$Input did not compile, which can't happen $errcode:\n@error\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 51 | ▶ | my $i = substr($Input,0,2) eq '-e' ? '-e' : $Input; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 51 | @error = grep { !/^$i syntax OK$/o } @error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 51 | ▶ | if (opt('check')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 1 | ▶ | print "@error" if @error; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 50 | ▶ | warn "$0: Unexpected compiler output\n@error" if @error and opt('v')<5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@error and &opt("v") < 5
MC/DC50%1/2
@error and &opt("v") < 5
@error
&opt("v") < 5
Truth table66%2/3
A and B
A= @errorB= &opt("v") < 5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 50 | ▶ | warn "@error" if @error and opt('v')>4; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@error and &opt("v") > 4
MC/DC50%1/2
@error and &opt("v") > 4
@error
&opt("v") > 4
Truth table66%2/3
A and B
A= @errorB= &opt("v") > 4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 51 | ▶ | vprint -1, "c time: $elapsed" if opt('time'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 51 | $extra_libs = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 51 | my %rpath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 51 | ▶ | if ($staticxs and open(XS, "<", $cfile.".lst")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$staticxs and open XS, "<", $main::cfile . '.lst'
MC/DC0%0/2
$staticxs and open XS, "<", $main::cfile . '.lst'
$staticxs
open XS, "<", $main::cfile . '.lst'
Truth table66%2/3
A and B
A= $staticxsB= open XS, "<", $main::cfile . '.lst'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | ▶ | while (<XS>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | my ($s, $l) = m/^([^\t]+)(.*)$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | ▶ | next if grep { $s eq $_ } @{$Options->{U}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | $stash .= ",-u$s"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | ▶ | if ($l) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | $l = substr($l,1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | ▶ | if ($^O eq 'darwin' and $l =~/\.bundle$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$^O eq "darwin" and $l =~ /\.bundle$/
MC/DC0%0/2
$^O eq "darwin" and $l =~ /\.bundle$/
$^O eq "darwin"
$l =~ /\.bundle$/
Truth table0%0/3
A and B
A= $^O eq "darwin"B= $l =~ /\.bundle$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | my $ofile = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | $ofile =~ s/\.bundle$/.o/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | $ofile =~ s{^.*/auto/}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | $ofile =~ s{(.*)/[^/]+\.o}{$1.o}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | $ofile =~ s{/}{_}g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | $ofile = 'pcc'.$ofile; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | ▶ | if (-e $ofile) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | vprint 3, "Using ".$ofile; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | vprint 3, "Creating ".$ofile; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | # This fails sometimes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | my $cmd = "otool -tv $l | \"$^X\" -pe " | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | . q{'s{^/}{# .file /};s/^00[0-9a-f]+\s/\t/;s/^\(__(\w+)(,__.*?)?\) section/q(.).lc($1)/e'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | . " | as -o \"$ofile\""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | vprint 3, $cmd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | vsystem($cmd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | ▶ | $extra_libs .= " ".$l if -e $ofile; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | $extra_libs .= " ".$l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | $rpath{dirname($l)}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | close XS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | my ($rpath) = $Config{ccdlflags} =~ /^(.+rpath,)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | ▶ | ($rpath) = $Config{ccdlflags} =~ m{^(.+-R,)/} unless $rpath; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | ▶ | if (!$rpath and $Config{gccversion}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $rpath and $main::Config{"gccversion"}
MC/DC0%0/2
not $rpath and $main::Config{"gccversion"}
not $rpath
$main::Config{"gccversion"}
Truth table0%0/3
not(A) and B
A= not $rpathB= $main::Config{"gccversion"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | $rpath = '-Wl,-rpath,'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | ▶ | $rpath =~ s/^-Wl,-E// if $rpath; # already done via ccdlflags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | # $extra_libs .= " $rpath".join(" ".$rpath,keys %rpath) if $rpath and %rpath; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | vprint 4, "staticxs: $stash $extra_libs"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 51 | ▶ | exit if opt('check'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 50 | ▶ | $t0 = [gettimeofday] if opt('time'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 50 | ▶ | is_msvc ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | cc_harness_msvc($cfile, $stash, $extra_libs) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | cc_harness($cfile, $stash, $extra_libs) unless opt('c'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 50 | ▶ | $elapsed = tv_interval ( $t0 ) if opt('time'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 50 | ▶ | vprint -1, "cc time: $elapsed" if opt('time'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 50 | ▶ | if ($lose and -s $Output) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$lose and -s $main::Output
MC/DC0%0/2
$lose and -s $main::Output
$lose
-s $main::Output
Truth table66%2/3
A and B
A= $loseB= -s $main::Output
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | vprint 3, "Unlinking $cfile"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | ▶ | unlink $cfile or _die("can't unlink $cfile: $!\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | ▶ | sub cc_harness_msvc { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cc_harness_msvc: not called CC=29 SCAR=67.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | my ($cfile, $stash, $extra_libs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 58 | ▶ | use ExtUtils::Embed (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | my $obj = $Output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | $obj =~ s/\.exe$/.obj/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | ▶ | $obj .= ".obj" unless $obj =~ /\.obj$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 0 | my $compile = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 0 | ▶ | $compile = '-I"..\..\lib\CORE" ' if $ENV{PERL_CORE}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | my $ccopts = ExtUtils::Embed::ccopts(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | my $optWc = opt('Wc'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | # suppress cl : Command line warning D4025 : overriding '/O1' with '/Od' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | ▶ | $ccopts =~ s/\b[-\/]O.\b/-Od/ if $optWc && ($optWc =~ /\b[-\/]Od\b/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$optWc and $optWc =~ m[\b[-/]Od\b]
MC/DC0%0/2
$optWc and $optWc =~ m[\b[-/]Od\b]
$optWc
$optWc =~ m[\b[-/]Od\b]
Truth table0%0/3
A and B
A= $optWcB= $optWc =~ m[\b[-/]Od\b]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | $compile .= "$ccopts -c -Fo$obj $cfile "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | ▶ | $compile .= " -DHAVE_INDEPENDENT_COMALLOC" if $B::C::Config::have_independent_comalloc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | $compile .= $B::C::Config::extra_cflags; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | my $link = "-out:$Output $obj"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | my $incdir = opt('I'); # use mult. I opts for paths with spaces, and \ deps. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 0 | ▶ | if ($incdir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | ▶ | if (ref $incdir eq 'ARRAY') { # -I uses now mult. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | $compile .= ' -I"'.$_.'"' for @$incdir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 0 | $compile .= ' -I"'.$incdir.'"'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | ▶ | $compile .= ' -DSTATICXS' if opt('staticxs'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 0 | ▶ | $compile .= " $optWc" if $optWc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | ▶ | $link .= ' -libpath:"..\..\lib\CORE"' if $ENV{PERL_CORE}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | my $libdir = opt('L'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 0 | ▶ | if ($libdir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 0 | ▶ | if (ref $libdir eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | $link .= ' -L"'.$_.'"' for @$libdir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 0 | $link .= ' -L"'.$libdir.'"'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | ▶ | if (exists $Options->{m} or $Options->{shared}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $main::Options->{"m"} or $main::Options->{"shared"}
MC/DC0%0/2
exists $main::Options->{"m"} or $main::Options->{"shared"}
exists $main::Options->{"m"}
$main::Options->{"shared"}
Truth table0%0/3
A or B
A= exists $main::Options->{"m"}B= $main::Options->{"shared"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | $link .= " -shared"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | # TODO: -shared,-static,-sharedxs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | ▶ | if ($stash) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | my @mods = split /,?-?u/, $stash; # XXX -U stashes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | $link .= " ".ExtUtils::Embed::ldopts("-std", \@mods); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | # XXX staticxs need to check if the last mods for staticxs found a static lib. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | # XXX only if not use the extra_libs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 0 | $link .= " ".ExtUtils::Embed::ldopts("-std"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 0 | ▶ | if ($Config{ccversion} eq '12.0.8804') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | $link =~ s/ -opt:ref,icf//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 0 | $link .= " ".$Config{optimize}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | ▶ | $link .= " ".opt('Wl') if opt('Wl'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | ▶ | if (opt('staticxs')) { # TODO: can msvc link to dll's directly? otherwise use dlltool | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | $extra_libs =~ s/^\s+|\s+$//g; # code by stengcode@gmail.com | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | foreach (split /\.dll(?:\s+|$)/, $extra_libs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | $_ .= '.lib'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 0 | ▶ | if (!-e $_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | die "--staticxs requires $_, you should copy it from build area"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | $link .= ' ' . $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 0 | $link .= $extra_libs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | # another ldopts bug: ensure Win32CORE gets added. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | ▶ | if (index($link, "Win32CORE") < 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 0 | ▶ | my $archdir = $ENV{PERL_CORE} ? "../.." : $Config{archlib}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 0 | my $win32core = "-L$archdir/lib/auto/Win32CORE -lWin32CORE"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 0 | ▶ | if (-e "$archdir/lib/auto/Win32CORE/Win32CORE.a") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | $win32core = "$archdir/lib/auto/Win32CORE/Win32CORE.a"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | $link .= " $win32core"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | ▶ | if ($Config{usecperl}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 0 | $link .= " cperl5$Config{PERL_VERSION}.lib"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | $link .= " perl5$Config{PERL_VERSION}.lib"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | $link .= " kernel32.lib msvcrt.lib"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | $link .= $B::C::Config::extra_libs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | vprint 3, "Calling $Config{cc} $compile"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | ▶ | if (!opt('dryrun')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | my @output = split /\n/, `$Config{cc} $compile`; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 0 | @output = grep {$_ ne $cfile} @output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | print STDERR join("\n", @output); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | vprint 3, "Calling $Config{ld} $link"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | ▶ | if (!opt('dryrun')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 0 | my @output = split /\n/, `$Config{ld} $link`; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | @output = grep {!/(Creating library|Generating code|Finished generating code)/} @output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | print STDERR join("\n", @output); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 48 | ▶ | sub cc_harness { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cc_harness: called CC=55 SCAR=63.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 48 | my ($cfile, $stash, $extra_libs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 58 | ▶ | use ExtUtils::Embed (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 48 | my $command = ExtUtils::Embed::ccopts." -o \"$Output\" \"$cfile\" "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 48 | my $coredir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 48 | ▶ | if ($ENV{PERL_CORE}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | $coredir = "/home/cpancover/.cpan"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | ▶ | $coredir .= "/lib/CORE" if $^O eq 'MSWin32'; # forward slashes yes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | $command = "$Config{optimize} $Config{ccflags} -I\"$coredir\" -L\"$coredir\" -o \"$Output\" \"$cfile\" "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 48 | ▶ | $command .= " -DHAVE_INDEPENDENT_COMALLOC" if $B::C::Config::have_independent_comalloc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 48 | ▶ | $command .= $B::C::Config::extra_cflags if $B::C::Config::extra_cflags; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 48 | my $incdir = opt('I'); # use mult. I opts for paths with spaces, and \ deps. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 48 | ▶ | if ($incdir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 2 | ▶ | if (ref $incdir eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 2 | $command .= ' -I"'.$_.'"' for @$incdir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | $command .= ' -I"'.$incdir.'"'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 48 | my $libopt = opt('L'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 48 | ▶ | if ($libopt) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 2 | ▶ | if (ref $libopt eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 2 | $command .= ' -L"'.$_.'"' for @$libopt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | $command .= ' -L"'.$libopt.'"'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 48 | ▶ | $command .= " -DSTATICXS" if opt('staticxs'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 48 | my $optWc = opt('Wc'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 48 | ▶ | if ($optWc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | $command .= " $optWc"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | # no override warning | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 0 | ▶ | $command =~ s/\b-O.\b/-O0/ if $optWc =~ /\b-O0\b/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 48 | my $ccflags = $command; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 48 | my $useshrplib = $Config{useshrplib} =~ /^(true|yes)$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 48 | ▶ | _die("--sharedxs with useshrplib=false\n") if !$useshrplib and opt('sharedxs'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $useshrplib and &opt("sharedxs")
MC/DC0%0/2
not $useshrplib and &opt("sharedxs")
not $useshrplib
&opt("sharedxs")
Truth table33%1/3
not(A) and B
A= not $useshrplibB= &opt("sharedxs")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 48 | my $ldopts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 48 | ▶ | if ($stash) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 2 | my @mods = split /,?-?u/, $stash; # XXX -U stashes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 2 | $ldopts = ExtUtils::Embed::ldopts("-std", \@mods); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 46 | ▶ | if ($ENV{PERL_CORE} and $^O eq 'MSWin32') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$ENV{"PERL_CORE"} and $^O eq "MSWin32"
MC/DC0%0/2
$ENV{"PERL_CORE"} and $^O eq "MSWin32"
$ENV{"PERL_CORE"}
$^O eq "MSWin32"
Truth table33%1/3
A and B
A= $ENV{"PERL_CORE"}B= $^O eq "MSWin32"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | $ldopts = $Config{libs}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 46 | $ldopts = ExtUtils::Embed::ldopts("-std"); # critical on mingw | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 48 | ▶ | $ldopts .= " ".opt('Wl') if opt('Wl'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | # gcc crashes with this duplicate -fstack-protector arg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 48 | my $ldflags = $Config{ldflags}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 48 | ▶ | if ($^O eq 'cygwin' and $ccflags =~ /-fstack-protector / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$^O eq "cygwin" and $ccflags =~ /-fstack-protector / and $ldopts =~ /-fstack-protector /
$^O eq "cygwin" and $ccflags =~ /-fstack-protector /
MC/DC0%0/3
$^O eq "cygwin" and $ccflags =~ /-fstack-protector / and $ldopts =~ /-fstack-protector /
$^O eq "cygwin"
$ccflags =~ /-fstack-protector /
$ldopts =~ /-fstack-protector /
Truth table25%1/4
A and B and C
A= $^O eq "cygwin"B= $ccflags =~ /-fstack-protector /C= $ldopts =~ /-fstack-protector /
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | and $ldopts =~ /-fstack-protector /) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | $ldopts =~ s/-fstack-protector //; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | ▶ | $ldflags =~ s/-fstack-protector // if $extra_libs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | # another ldopts bug: ensure Win32CORE gets added, before -lperl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 48 | ▶ | if (is_winlike()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 0 | ▶ | if (index($ldopts, "Win32CORE") < 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 0 | ▶ | my $archdir = $ENV{PERL_CORE} ? "../.." : $Config{archlib}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 0 | my $win32core = "-L$archdir/lib/auto/Win32CORE -lWin32CORE"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | ▶ | if (-e "$archdir/lib/auto/Win32CORE/Win32CORE.a") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 0 | $win32core = "$archdir/lib/auto/Win32CORE/Win32CORE.a"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 0 | ▶ | if ($ldopts =~ m{ (-lc?perl)}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 0 | $ldopts =~ s{ (-lc?perl)}{ $win32core $1}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 0 | $ldopts .= " $win32core"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 48 | my ($libperl, $libdir) = ($Config{libperl}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 48 | ▶ | if ($ENV{PERL_CORE}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | # on mingw we still search for cperl52x.dll not the importlib | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | # coredir + includedir is ../../lib/CORE on windows | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 0 | $libdir = "../.."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | # $ldopts .= " -L$coredir" if $^O eq 'MSWin32'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 48 | $libdir = $Config{prefix} . "/lib"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 48 | ▶ | $coredir = $ENV{PERL_SRC} || $Config{archlib}."/CORE"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ENV{'PERL_SRC'} || $main::Config{'archlib'} . '/CORE'
MC/DC0%0/1
$ENV{'PERL_SRC'} || $main::Config{'archlib'} . '/CORE'
$ENV{'PERL_SRC'}
Truth table50%1/2
A
A= $ENV{'PERL_SRC'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 48 | ▶ | if ($extra_libs) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | # splice extra_libs after $Config{ldopts} before @archives | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | my $i_ldopts = index($ldopts, $ldflags); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 0 | ▶ | if ($ldflags and $i_ldopts >= 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ldflags and $i_ldopts >= 0
MC/DC0%0/2
$ldflags and $i_ldopts >= 0
$ldflags
$i_ldopts >= 0
Truth table0%0/3
A and B
A= $ldflagsB= $i_ldopts >= 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | my $l = $i_ldopts + length($ldflags); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | $ldopts = substr($ldopts,0,$l).$extra_libs." ".substr($ldopts,$l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 0 | $ldopts = $extra_libs." ".$ldopts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 48 | ▶ | if (exists $Options->{m} or opt('shared')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $main::Options->{"m"} or &opt("shared")
MC/DC0%0/2
exists $main::Options->{"m"} or &opt("shared")
exists $main::Options->{"m"}
&opt("shared")
Truth table33%1/3
A or B
A= exists $main::Options->{"m"}B= &opt("shared")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 0 | $ldopts = "-shared $ldopts"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 48 | ▶ | if (opt('shared')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | ▶ | warn "--shared with useshrplib=false might not work\n" unless $useshrplib; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | my @plibs = ($libperl, "$coredir/$libperl", "$libdir/$libperl"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | ▶ | if ($libperl !~ /$Config{dlext}$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | $libperl = "libperl.".$Config{dlext}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 0 | @plibs = ($libperl, "$coredir/$libperl", "$libdir/$libperl"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | ▶ | push @plibs, glob "$coredir/*perl5*".$Config{dlext}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 0 | push @plibs, glob "$coredir/*perl.".$Config{dlext}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | push @plibs, glob $libdir."/*perl5*.".$Config{dlext}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 0 | push @plibs, glob $libdir."/*perl.".$Config{dlext}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 0 | push @plibs, glob $Config{bin}."/perl*.".$Config{dlext}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | for my $lib (@plibs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 0 | ▶ | if (-e $lib) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 0 | $ldopts =~ s|-lc?perl |$lib |; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 0 | $ldopts =~ s|\s+\S+libc?perl\w+\.a | $lib |; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 0 | ▶ | $ldopts = "$coredir/DynaLoader.o $ldopts" if -e "$coredir/DynaLoader.o"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | } elsif (opt('static')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 0 | for my $lib ($libperl, "$coredir/$libperl", "$coredir/$libperl", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | "$coredir/libperl.a", "$libdir/libperl.a", "$coredir/libcperl.a", "$libdir/libcperl.a") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 0 | ▶ | if (-e $lib) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 0 | $ldopts =~ s|-lc?perl |$lib |; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | ▶ | $ldopts = "$coredir/DynaLoader.o $ldopts" if -e "$coredir/DynaLoader.o"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 48 | ▶ | if ( $useshrplib and -e $libdir."/".$Config{libperl}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$useshrplib and -e $libdir . '/' . $main::Config{"libperl"}
MC/DC0%0/2
$useshrplib and -e $libdir . '/' . $main::Config{"libperl"}
$useshrplib
-e $libdir . '/' . $main::Config{"libperl"}
Truth table33%1/3
A and B
A= $useshrplibB= -e $libdir . '/' . $main::Config{"libperl"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | # debian: only /usr/lib/libperl.so.5.10.1 and broken ExtUtils::Embed::ldopts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 0 | $ldopts =~ s|-lperl |$libdir/$Config{libperl} |; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 48 | ▶ | if ( $useshrplib and -e $coredir."/".$Config{libperl}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$useshrplib and -e $coredir . '/' . $main::Config{"libperl"}
MC/DC0%0/2
$useshrplib and -e $coredir . '/' . $main::Config{"libperl"}
$useshrplib
-e $coredir . '/' . $main::Config{"libperl"}
Truth table33%1/3
A and B
A= $useshrplibB= -e $coredir . '/' . $main::Config{"libperl"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | # help cygwin debugging, and workaround wrong debian linker prefs (/usr/lib before given -L) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | $ldopts =~ s|-lperl |$coredir/$Config{libperl} |; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 48 | ▶ | unless ( $command =~ m{( -lc?perl|/CORE\/libperl)} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 48 | ▶ | if ($Config{usecperl} and $libperl =~ /libcperl/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$main::Config{"usecperl"} and $libperl =~ /libcperl/
MC/DC0%0/2
$main::Config{"usecperl"} and $libperl =~ /libcperl/
$main::Config{"usecperl"}
$libperl =~ /libcperl/
Truth table33%1/3
A and B
A= $main::Config{"usecperl"}B= $libperl =~ /libcperl/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 0 | $ldopts .= " -lcperl"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 48 | $ldopts .= " -lperl"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 48 | ▶ | $ldopts .= " $Config{libs}" if $ENV{PERL_CORE}; # no -L found at all | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 48 | $command .= " ".$ldopts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 48 | ▶ | $command .= $B::C::Config::extra_libs if $B::C::Config::extra_libs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 48 | vprint 3, "Calling $Config{cc} $command"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 48 | vsystem("$Config{cc} $command"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | # Where Perl is, and which include path to give it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 58 | ▶ | sub yclept { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
yclept: called CC=16 SCAR=37.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 58 | ▶ | my $command = $^X =~ m/\s/ ? qq{"$^X"} : $^X; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | # DWIM the -I to be Perl, not C, include directories. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 58 | ▶ | if (opt('I') && $Backend eq "Bytecode") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
&opt("I") and $main::Backend eq "Bytecode"
MC/DC0%0/2
&opt("I") and $main::Backend eq "Bytecode"
&opt("I")
$main::Backend eq "Bytecode"
Truth table66%2/3
A and B
A= &opt("I")B= $main::Backend eq "Bytecode"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 0 | my $incdir = opt('I'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 0 | ▶ | if ($incdir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 0 | ▶ | if (ref $incdir ne 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 0 | $incdir = ($incdir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 0 | for (@$incdir) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 0 | ▶ | if (-d $_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 0 | push @INC, $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 0 | warn "$0: Include directory $_ not found, skipping\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 58 | my %OINC; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 58 | $OINC{$Config{$_}}++ for (qw(privlib archlib sitelib sitearch vendorlib vendorarch)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 58 | ▶ | $OINC{'.'}++ unless ${^TAINT}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 58 | $OINC{$_}++ for split ':', $Config{otherlibdirs}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 58 | ▶ | if (my $incver = $Config{inc_version_list}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 58 | my $incpre = dirname($Config{sitelib}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 0 | $OINC{$_}++ for map { File::Spec->catdir($incpre,$_) } split(' ',$incver); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 58 | $OINC{$incpre}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 58 | for my $i (@INC) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 582 | ▶ | my $inc = $i =~ m/\s/ ? qq{"$i"} : $i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 582 | ▶ | $command .= " -I$inc" unless $OINC{$i}; # omit internal @INC dirs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 58 | return $command; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | # Use B::Stash to find additional modules and stuff. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | my $_stash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 2 | ▶ | sub grab_stash { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
grab_stash: called CC=9 SCAR=24.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 2 | ▶ | warn "already called grab_stash once" if $_stash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 2 | ▶ | my $taint = opt('T') ? ' -T' : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | opt('t') ? ' -t' : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 2 | my $command = "$BinPerl$taint -MB::Stash -c $Input"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | # Filename here is perfectly sanitised. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 2 | vprint 3, "Calling $command\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 2 | my ($stash_r, $error_r, $errcode) = spawnit($command); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 2 | my @stash = @$stash_r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 2 | my @error = @$error_r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 2 | ▶ | if (@error && $errcode != 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@error and $errcode != 0
MC/DC0%0/2
@error and $errcode != 0
@error
$errcode != 0
Truth table33%1/3
A and B
A= @errorB= $errcode != 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 0 | _die("$Input did not compile $errcode:\n@error\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | # band-aid for modules with noisy BEGIN {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 2 | foreach my $i ( @stash ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 2 | ▶ | $i =~ m/-[ux](?:[\w:]+|\<none\>)$/ and $stash[0] = $i and next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$i =~ /-[ux](?:[\w:]+|\<none\>)$/ and $stash[0] = $i
MC/DC0%0/2
$i =~ /-[ux](?:[\w:]+|\<none\>)$/ and $stash[0] = $i
$i =~ /-[ux](?:[\w:]+|\<none\>)$/
$stash[0] = $i
Truth table33%1/3
A and B
A= $i =~ /-[ux](?:[\w:]+|\<none\>)$/B= $stash[0] = $i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | push @begin_output, $i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 2 | chomp $stash[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 2 | $stash[0] =~ s/,-[ux]\<none\>//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 2 | $stash[0] =~ s/^.*?-([ux])/-$1/s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 2 | vprint 2, "Stash: ", join " ", split /,?-[ux]/, $stash[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 2 | chomp $stash[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | 2 | return $_stash = $stash[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | # Check the consistency of options if -B is selected. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | # To wit, (-B|-O) ==> no -shared, no -S, no -c | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 0 | ▶ | sub checkopts_byte { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
checkopts_byte: called CC=8 SCAR=24.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 5 | ▶ | _die("Please choose one of either -B and -O.\n") if opt('O'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 5 | for my $o ( qw[shared sharedxs static staticxs] ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 20 | ▶ | if (exists($Options->{$o}) && $Options->{$o}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $main::Options->{$o} and $main::Options->{$o}
MC/DC0%0/2
exists $main::Options->{$o} and $main::Options->{$o}
exists $main::Options->{$o}
$main::Options->{$o}
Truth table33%1/3
A and B
A= exists $main::Options->{$o}B= $main::Options->{$o}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 0 | warn "$0: --$o incompatible with -B\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 0 | delete $Options->{$o}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | # TODO make -S produce an .asm also? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | 5 | for my $o ( qw[c S] ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 10 | ▶ | if (exists($Options->{$o}) && $Options->{$o}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $main::Options->{$o} and $main::Options->{$o}
MC/DC50%1/2
exists $main::Options->{$o} and $main::Options->{$o}
exists $main::Options->{$o}
$main::Options->{$o}
Truth table66%2/3
A and B
A= exists $main::Options->{$o}B= $main::Options->{$o}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 1 | warn "$0: Compiling to bytecode is a one-pass process. ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | "-$o ignored\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 1 | delete $Options->{$o}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | # Check the input and output files make sense, are read/writeable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 58 | ▶ | sub sanity_check { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sanity_check: called CC=6 SCAR=34.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 58 | ▶ | if ($Input eq $Output) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 0 | ▶ | if ($Input eq 'a.out') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 0 | _die("Compiling a.out is probably not what you want to do.\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | # You fully deserve what you get now. No you *don't*. typos happen. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | my $suffix = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | 0 | ▶ | if (exists $Options->{m} or opt('shared')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
exists $main::Options->{"m"} or &opt("shared")
MC/DC0%0/2
exists $main::Options->{"m"} or &opt("shared")
exists $main::Options->{"m"}
&opt("shared")
Truth table0%0/3
A or B
A= exists $main::Options->{"m"}B= &opt("shared")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 0 | $suffix = ".".$Config{dlext}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | } elsif (is_winlike()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 0 | $suffix = '.exe' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | 0 | (undef, $Output) = tempfile("plcXXXXX", SUFFIX => $suffix); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | 0 | warn "$0: Will not write output on top of input file, ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | "compiling to $Output instead\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 37 | ▶ | sub check_read { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_read: called CC=5 SCAR=25.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 37 | my $file = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 37 | ▶ | unless (-r $file) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | 0 | ▶ | _die("Input file $file is a directory, not a file\n") if -d _; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 0 | ▶ | unless (-e _) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 0 | _die("Input file $file was not found\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | 0 | _die("Cannot read input file $file: $!\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 37 | ▶ | unless (-f _) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | # XXX: die? don't try this on /dev/tty | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | 0 | warn "$0: WARNING: input $file is not a plain file\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 58 | ▶ | sub check_write { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_write: called CC=5 SCAR=17.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 58 | my $file = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 58 | ▶ | if (-d $file) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 0 | _die("Cannot write on $file, is a directory\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 58 | ▶ | if (-e _) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 4 | ▶ | _die("Cannot write on $file: $!\n") unless -w _; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 58 | ▶ | unless (-w '.') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 0 | _die("Cannot write in this directory: $!\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 37 | ▶ | sub check_perl { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_perl: called CC=5 SCAR=20.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 37 | my $file = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 37 | ▶ | unless (-T $file) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 0 | warn "$0: Binary `$file' sure doesn't smell like perl source!\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 0 | print "Checking file type... "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | 0 | vsystem("file", $file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 0 | _die("Please try a perlier file!\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 37 | ▶ | open(my $handle, "<", $file) or _die("Can't open $file: $!\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 37 | local $_ = <$handle>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 37 | ▶ | if (/^#!/ && !/perl/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
/^#!/ and not /perl/
MC/DC0%0/2
/^#!/ and not /perl/
/^#!/
not /perl/
Truth table66%2/3
A and not(B)
A= /^#!/B= not /perl/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 0 | _die("$file is a ", /^#!\s*(\S+)/, " script, not perl\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | # File spawning and error collecting | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | 60 | ▶ | sub spawnit { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
spawnit: called CC=7 SCAR=20.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 60 | my $command = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 60 | my (@error,@output,$errname,$errcode); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 60 | ▶ | if (opt('dryrun')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 0 | print "$command\n";; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | elsif ($Options->{spawn}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | 60 | (undef, $errname) = tempfile("pccXXXXX"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 60 | ▶ | my $pid = open (S_OUT, "$command 2>$errname |") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | or _die("Couldn't spawn the compiler.\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 60 | $errcode = $?; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | 60 | my $kid; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 60 | ▶ | do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | 120 | $kid = waitpid($pid, 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | } while $kid > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 60 | @output = <S_OUT>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 60 | ▶ | open (S_ERROR, $errname) or _die("Couldn't read the error file.\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 60 | @error = <S_ERROR>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | 60 | close S_ERROR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 60 | close S_OUT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | 60 | ▶ | unlink $errname or _die("Can't unlink error file $errname\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | 0 | @output = split /\n/, `$command`; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 60 | return (\@output, \@error, $errcode); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | 0 | ▶ | sub version { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
version: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | 0 | require B::C::Config; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | 58 | ▶ | no warnings 'once'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | 0 | my $BC_VERSION = $B::C::Config::VERSION . $B::C::REVISION; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | 0 | return "perlcc $VERSION, B-C-${BC_VERSION} built for $Config{perlpath} $Config{archname}\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | 0 | ▶ | sub helpme { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
helpme: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 0 | print version(),"\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 0 | ▶ | if (opt('v')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | 0 | pod2usage( -verbose => opt('v') ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 0 | pod2usage( -verbose => 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | 58 | ▶ | sub relativize { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
relativize: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | 58 | my ($args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | 58 | ▶ | return("./".basename($args)) if ($args =~ m"^[/\\]"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 58 | return("./$args"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | 2 | ▶ | sub _die { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_die: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | 2 | my @args = ("$0: ", @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 2 | ▶ | $logfh->print(@args) if opt('log'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 2 | print STDERR @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | 2 | exit(); # should die eventually. However, needed so that a 'make compile' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | # can compile all the way through to the end for standard dist. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 0 | ▶ | sub _usage_and_die { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_usage_and_die: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | 0 | _die(<<EOU); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | Usage: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | $0 [-o executable] [-h][-r] [-O|-B|-c|-S] [-I /foo] [-L /foo] [--log log] [source[.pl] | -e code] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | More options (see perldoc perlcc) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | -v[1-4] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | --stash --staticxs --shared --static | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | --testsuite --time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | EOU | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 0 | ▶ | sub run { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 0 | my (@commands) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | 0 | ▶ | my $t0 = [gettimeofday] if opt('time'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 0 | ▶ | if (!opt('log')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | 0 | print interruptrun(@commands); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | 0 | $logfh->print(interruptrun(@commands)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 0 | ▶ | my $elapsed = tv_interval ( $t0 ) if opt('time'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | 0 | ▶ | vprint -1, "r time: $elapsed" if opt('time'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | 0 | ▶ | sub interruptrun { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
interruptrun: not called CC=10 SCAR=47.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | 0 | my (@commands) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | 0 | my $command = join('', @commands); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | 0 | local(*FD); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | 0 | my $pid = open(FD, "$command |"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 0 | my $text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 0 | ▶ | local($SIG{HUP}, $SIG{INT}) if exists $SIG{HUP}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | 0 | ▶ | $SIG{HUP} = $SIG{INT} = sub { kill 9, $pid; exit } if exists $SIG{HUP}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | my $needalarm = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | ($ENV{PERLCC_TIMEOUT} && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | exists $SIG{ALRM} && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | 0 | ▶ | $Config{'osname'} ne 'MSWin32' && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/9
$ENV{'PERLCC_TIMEOUT'} && exists $SIG{'ALRM'} && $main::Config{'osname'} ne 'MSWin32' && $command =~ /(^|\s)perlcc\s/
$ENV{"PERLCC_TIMEOUT"} and exists $SIG{"ALRM"} and $main::Config{"osname"} ne "MSWin32"
$ENV{"PERLCC_TIMEOUT"} and exists $SIG{"ALRM"}
MC/DC0%0/4
$ENV{'PERLCC_TIMEOUT'} && exists $SIG{'ALRM'} && $main::Config{'osname'} ne 'MSWin32' && $command =~ /(^|\s)perlcc\s/
$ENV{"PERLCC_TIMEOUT"}
exists $SIG{"ALRM"}
$main::Config{"osname"} ne "MSWin32"
$command =~ /(^|\s)perlcc\s/
Truth table0%0/5
A and B and C && D
A= $ENV{"PERLCC_TIMEOUT"}B= exists $SIG{"ALRM"}C= $main::Config{"osname"} ne "MSWin32"D= $command =~ /(^|\s)perlcc\s/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | $command =~ m"(^|\s)perlcc\s"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | 0 | ▶ | local($SIG{ALRM}) = sub { die "INFINITE LOOP"; } if exists $SIG{ALRM}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | 0 | ▶ | alarm($ENV{PERLCC_TIMEOUT}) if $needalarm; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 0 | $text = join('', <FD>); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 0 | ▶ | alarm(0) if $needalarm; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | 0 | eval { kill 'HUP', $pid }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | 0 | vprint 0, "SYSTEM TIMEOUT (infinite loop?)\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | 0 | close(FD); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | 0 | return($text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | 144 | ▶ | sub is_winlike() { $^O =~ m/^(MSWin32|msys|cygwin)/ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_winlike: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | 180 | ▶ | sub is_win32() { $^O =~ m/^(MSWin32|msys)/ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_win32: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | 101 | ▶ | sub is_msvc() { is_win32 && $Config{cc} =~ m/^cl/i } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_msvc: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 58 | ▶ | END { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
END: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | 58 | ▶ | if ($cfile && !opt('S') && !opt('c') && -e $cfile) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
$main::cfile and not &opt("S") and not &opt("c") and -e $main::cfile
$main::cfile and not &opt("S") and not &opt("c")
$main::cfile and not &opt("S")
MC/DC100%4/4
$main::cfile and not &opt("S") and not &opt("c") and -e $main::cfile
$main::cfile
not &opt("S")
not &opt("c")
-e $main::cfile
Truth table100%5/5
A and not(B) and not(C) and D
A= $main::cfileB= not &opt("S")C= not &opt("c")D= -e $main::cfile
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | 41 | vprint 4, "Unlinking $cfile"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | 41 | unlink $cfile; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | 58 | ▶ | if (opt('staticxs') and !opt('S')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
&opt("staticxs") and not &opt("S")
MC/DC100%2/2
&opt("staticxs") and not &opt("S")
&opt("staticxs")
not &opt("S")
Truth table100%3/3
A and not(B)
A= &opt("staticxs")B= not &opt("S")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | 4 | vprint 4, "Unlinking $cfile.lst"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | 4 | unlink "$cfile.lst"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||