Makefile_header.PL

filter: Statementstmt 57.1% 20 / 35 Branchbran 37.5% 6 / 16 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 50.8% 30 / 59 CC 1 SCAR 0.0
CC
1
Cov
50%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Perl/Structure/Graph/Tree/Trie.pm ↑ Summary blib/lib/Perl/Type.pm »
1 #our $VERSION = 0.042_000; # DEV NOTE: comment to avoid potential conflict w/ Dist::Zilla & friends
2  
3 # DEV NOTE, CORRELATION #pt000: minimum Perl version to support "my array @foo;" & "my hash %bar;" Perl::Types syntax
4 1 ▶use 5.012;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 BEGIN {
7 1 ▶ use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶ use English qw(-no_match_vars); # for $OSNAME
Subroutine BEGIN: called CC=1 SCAR=0.0
9 }
10  
11 # choose correct C++11 compiler for each OS and/or Perl configuration;
12 # if unsupported compiler, `exit 0` to avoid creating any CPAN Testers failure or report at all
13 1 my $min_cxx_versions = {
14 'g++' => 4.7,
15 'clang++' => 3.3
16 };
17 1 my $cxx = 'g++';
18 1 ▶if ($OSNAME eq 'freebsd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($main::OSNAME eq "freebsd") 0 1 1
19 0 $cxx = 'c++';
20 }
21 1 ▶if ($Config{cc} =~ /clang/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($main::Config{"cc"} =~ /clang/u) 0 1 1
22 0 $cxx = 'clang++';
23 }
24  
25 =begin COMPILER_VERSION_OUTPUT_EXAMPLES
26  
27 $ g++ --version
28 g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
29 ...
30  
31 $ g++ --version
32 g++ (i686-posix-sjlj, built by strawberryperl.com project) 4.9.2
33 Copyright (C) 2014 Free Software Foundation, Inc.
34 This is free software; see the source for copying conditions. There is NO
35 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
36  
37 $ clang++ --version
38 Ubuntu clang version 3.4-1ubuntu3 ...
39 ...
40  
41 =end COMPILER_VERSION_OUTPUT_EXAMPLES
42  
43 =cut
44  
45 # run external compiler command to get version info
46 1 my $version_retval = `$cxx --version`;
47 #print {*STDERR} '<<< DEBUG >>>: have $version_retval = ', "\n", $version_retval, "\n";
48 1 ▶if ((not defined $version_retval) or ($version_retval eq q{})) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $version_retval or $version_retval eq "") 0 1 1
Condition33%1/3
not defined $version_retval or $version_retval eq ""
l!l&&r!l&&!r
001
MC/DC0%0/2
not defined $version_retval or $version_retval eq ""
not defined $version_retval $version_retval eq ""
Truth table33%1/3
not(A) or B
A= not defined $version_retvalB= $version_retval eq ""
ABresult
1X1
011
000
49 0 print {*STDERR} 'C++ compiler ', $cxx, ' not found, bailing out!', "\n";
50 0 exit 0;
51 }
52  
53 # FreeBSD c++ is sometimes g++, sometimes clang++
54 1 my $cxx_real = $cxx;
55 1 ▶if ($cxx eq 'c++') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cxx eq "c++") 0 1 1
56 0 ▶ if ($version_retval =~ m/clang/xms) {
Branch: 2 branches
BranchTrueFalseTotal
if ($version_retval =~ /clang/msux) { } 0 0 0
elsif ($version_retval =~ /Free\ Software\ Foundation/msux) { } 0 0 0
57 0 $cxx_real = 'clang++';
58 }
59 elsif ($version_retval =~ m/Free\ Software\ Foundation/xms) {
60 0 $cxx_real = 'g++';
61 }
62 else {
63 0 print {*STDERR} 'C++ compiler ', $cxx, ' does not seem to provide the known g++ or clang++ compilers, bailing out!', "\n";
64 0 exit 0;
65 }
66 }
67 #print {*STDERR} '<<< DEBUG >>>: have $cxx_real = ', $cxx_real, "\n";
68  
69 # must meet minimum compiler version requirements
70 1 $version_retval =~ m/(\d+\.\d+)/xms;
71 1 my $version = $1 + 0;
72 #print {*STDERR} '<<< DEBUG >>>: have $version = ', $version, "\n";
73 1 ▶if ($version < $min_cxx_versions->{$cxx_real}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($version < $min_cxx_versions->{$cxx_real}) 0 1 1
74 0 print {*STDERR} 'C++ compiler ', $cxx_real, ' version ', $version, ' found, does not meet minimum version requirement ', $min_cxx_versions->{$cxx_real} , ', bailing out!', "\n";
75 0 exit 0;
76 }
77  
78 # fix read-only blib/lib in MS Windows
79 1 ▶if ( $OSNAME eq 'MSWin32' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($main::OSNAME eq "MSWin32") 0 1 1
80 # DEV NOTE, CORRELATION #gt01: Dist::Zilla::Plugin::AutoPrereqs incorrectly finds ExtUtils::MakeMaker as dependency
81 0 push( @ExtUtils::MakeMaker::Overridable, qw(pm_to_blib) );
82 }
« blib/lib/Perl/Structure/Graph/Tree/Trie.pm ↑ Summary blib/lib/Perl/Type.pm »