Branch Coverage

blib/lib/ExtUtils/ParseXS.pm
Criterion Covered Total %
branch 374 608 61.5


line true false branch
85 7 1 if (@_ % 2) { }
87 5 2 ref $invocant ? :
114 0 8 $args{'except'} ? :
119 0 8 if ($^O eq "VMS")
145 0 8 unless $args{'filename'}
154 4 4 unless (ref $args{'output'})
155 0 4 unless open my $fh, "> $args{'output'}"
169 6 2 if ($self->{'WantLineNumbers'}) { }
171 3 3 if ($args{'outfile'}) { }
176 0 3 unless $cfile =~ s/\.xs$/$csuffix/i
207 6 2 if $self->{'WantLineNumbers'}
211 0 8 unless open $self->{'FH'}, "<", $self->{'filename'}
215 1 182 if (/^=/)
218 1 4 if (/^=cut\s*$/)
234 1 0 if $self->{'WantLineNumbers'}
243 0 0 unless $self->{'lastline'}
245 8 174 if ($self->{'Package'}, $self->{'Prefix'}) = /^MODULE\s*=\s*[\w:]+(?:\s+PACKAGE\s*=\s*([\w:]+))?(?:\s+PREFIX\s*=\s*(\S+))?\s*$/
250 0 8 unless (defined $_)
255 6 2 if $self->{'WantLineNumbers'}
259 6 2 if $self->{'WantLineNumbers'}
274 2 3 unless $ln =~ /^\#\s*((if)(?:n?def)?|elsif|else|endif)\b/
282 17 71 unless @{$self->{'line'};}
284 1 70 if ($XSS_work_idx and not $self->{'XSStack'}[$XSS_work_idx]{'varname'})
296 0 71 if $self->{'line'}[0] =~ /^\s/
321 14 0 unless @{$self->{'line'};}
325 1 56 if ($self->check_keyword("BOOT"))
329 1 0 if $self->{'WantLineNumbers'} and not $self->{'line'}[0] =~ /^\s*#\s*line\b/
336 0 56 if $self->{'ret_type'} =~ s/^NO_OUTPUT\s+//
341 0 56 if $self->{'argtypes'} and $self->{'ret_type'} =~ s/^(.*?\w.*?)\s*\b(\w+\s*\(.*)/$1/s
345 0 56 unless @{$self->{'line'};}
347 0 56 if $self->{'ret_type'} =~ s/^extern "C"\s+//
348 0 56 if $self->{'ret_type'} =~ s/^static\s+//
351 0 56 unless $func_header =~ /^(?:([\w:]*)::)?(\w+)\s*\(\s*(.*?)\s*\)\s*(const)?\s*(;\s*)?$/s
356 0 56 if $4
361 0 56 if ($Is_VMS)
367 59 0 unless defined $tmp->{'functions'}{$self->{'Full_func_name'}}
384 47 9 if ($self->{'argtypes'} and $orig_args =~ /\S/) { }
387 47 0 if ($args =~ /^( (??{ $C_arg; }) , )* $ /x) { }
397 57 13 unless defined $pre and length $pre
400 5 8 if ($self->{'inout'} and s/^(IN|IN_OUTLIST|OUTLIST|OUT|IN_OUT)\b\s*//)
402 4 1 if $type ne "IN"
407 1 12 if ($len_name =~ /^length\( \s* (\w+) \s* \)\z/x)
410 0 1 if length $default
413 13 0 if (length $pre or $islength)
414 1 12 if ($islength) { }
424 5 8 if $out_type eq "OUTLIST" or $islength
425 4 9 if $out_type =~ /OUTLIST$/
426 4 9 if $out_type
438 0 0 if ($self->{'inout'} and s/^(IN|IN_OUTLIST|OUTLIST|IN_OUT|OUT)\b\s*//)
440 0 0 if $out_type eq "IN"
441 0 0 if $out_type eq "OUTLIST"
442 0 0 if ($out_type =~ /OUTLIST$/)
449 0 56 if (defined $class)
450 0 0 defined $static || $self->{'func_name'} eq 'new' ? :
460 4 66 if ($args[$i] =~ s/\.\.\.//)
462 4 0 if ($args[$i] eq "" and $i == $#args)
468 5 61 if ($$only_C_inlist_ref{$args[$i]}) { }
475 1 65 if ($args[$i] =~ /^([^=]*[^\s=])\s*=\s*(.*)/s)
481 61 5 unless $$only_C_inlist_ref{$args[$i]}
500 0 56 if $EXPLICIT_RETURN
502 0 56 $externC ? :
512 6 50 if $self->{'ALIAS'}
515 1 55 if $INTERFACE
521 0 56 if $self->{'except'}
526 54 2 if ($self->{'cond'}) { }
545 4 52 if $PPCODE
549 4 52 if $PPCODE
563 2 55 if $self->check_keyword("CASE")
577 0 57 if $self->{'ScopeThisXSUB'}
582 0 57 if (not $self->{'thisdone'} and defined $class)
583 0 0 if (defined $static or $self->{'func_name'} eq 'new') { }
610 0 57 if (/^\s*NOT_IMPLEMENTED_YET/) { }
615 36 21 if ($self->{'ret_type'} ne "void")
617 36 0 unless $self->{'retvaldone'}
622 27 9 if $self->{'optimize'} and $outputmap and $outputmap->targetable
625 7 50 if (@fake_INPUT or @fake_INPUT_pre)
635 4 53 if ($self->check_keyword('PPCODE')) { }
35 18 elsif ($self->check_keyword('CODE')) { }
0 18 elsif (defined $class and $self->{'func_name'} eq 'DESTROY') { }
637 0 4 if @{$self->{'line'};}
638 0 4 if $self->{'ScopeThisXSUB'}
639 0 4 if $^O eq "hpux"
644 0 4 if $^O eq "hpux"
652 27 8 if ($consumed_code =~ /\bRETVAL\b/)
662 9 9 if ($self->{'ret_type'} ne "void")
666 0 18 if (defined $static) { }
0 18 elsif (defined $class) { }
667 0 0 if ($self->{'func_name'} eq 'new') { }
675 0 0 if ($self->{'func_name'} eq 'new') { }
683 0 18 if defined $strip
685 1 17 if $self->{'interface'}
694 0 57 if $RETVAL_no_return
700 0 27 if ($self->{'have_CODE_with_RETVAL'} and not $self->{'have_OUTPUT'} and $self->{'ret_type'} ne "void")
713 3 54 if ($outlist_count)
715 2 1 if $self->{'gotRETVAL'} or $wantRETVAL
720 0 57 if ($self->{'gotRETVAL'} and $self->{'RETVAL_code'}) { }
32 25 elsif ($self->{'gotRETVAL'} or $wantRETVAL) { }
722 0 0 if $outlist_count
730 27 5 if ($trgt) { }
735 0 27 if (not $trgt->{'with_size'} and $trgt->{'type'} eq 'p') { }
738 0 0 unless $outlist_count
743 27 0 unless defined $tsize
748 26 1 unless $outlist_count
761 1 4 if $outlist_count
765 36 21 if $self->{'ret_type'} ne "void"
779 0 57 if $self->{'ScopeThisXSUB'}
782 0 57 if $self->{'ScopeThisXSUB'} and not $PPCODE
790 0 57 if $self->{'except'}
796 1 56 if ($self->check_keyword("CASE"))
798 0 1 unless $self->{'condnum'}
802 56 0 if $_ eq "${END}:"
803 0 0 /^$BLOCK_regexp/o ? :
806 0 56 if $self->{'except'}
810 0 56 if $^O eq "hpux"
815 36 20 if ($xsreturn) { }
816 36 0 unless $PPCODE
821 16 4 unless $PPCODE
825 0 56 if $^O eq "hpux"
836 17 39 if ($self->{'ProtoThisXSUB'}) { }
845 0 17 if ($self->{'ProtoThisXSUB'} eq 2) { }
16 1 elsif ($self->{'ProtoThisXSUB'} eq 1) { }
850 0 16 if ($min_args < $num_args)
854 2 14 if $ellipsis
866 6 50 if ($self->{'XsubAliases'} and keys %{$$self{'XsubAliases'};}) { }
1 49 elsif (@{$self->{'Attributes'};}) { }
1 48 elsif ($self->{'interface'}) { }
33 15 elsif ($self->{'newXS'} eq 'newXS_deffile') { }
868 5 1 unless defined $self->{'XsubAliases'}{$self->{'pname'}}
886 1 0 unless $yname =~ /::/
946 7 1 $self->{'WantVersionChk'} ? :
955 8 0 if $self->{'Full_func_name'}
972 7 1 if ($self->{'WantVersionChk'}) { }
991 1 7 if defined $self->{'XsubAliases'} or defined $self->{'interfaces'}
997 1 7 if (keys %{$$self{"Overloaded"};})
1022 1 7 if defined $self->{'XsubAliases'} or defined $self->{'interfaces'}
1026 1 7 if (@{$BootCode_ref;})
1051 0 8 unless $self->{'ProtoUsed'}
1055 6 2 if tied *PSEUDO_STDOUT
1062 1 1 if (@_) { }
1077 110 523 if s/^(\s*)($_[0])\s*:\s*(?:#.*)?/$1/s
1090 33 1 if $self->{'WantLineNumbers'} and not /^\s*#\s*line\b/ and not /^#if XSubPPtmp/
1095 34 14 if $self->{'WantLineNumbers'}
1128 0 2 if $self->{'condnum'} and $self->{'cond'} eq ""
1131 1 1 $self->{'condnum'}++ ? :
2 0 $self->{'cond'} ? :
1139 0 71 if /^\s*NOT_IMPLEMENTED_YET/
1140 9 62 unless /\S/
1146 60 2 unless /[=;+].*\S/
1149 1 61 if (s/^([^=]*)\blength\(\s*(\w+)\s*\)\s*$/$1 XSauto_length_of_$2=NO_INIT/x)
1157 3 59 if s/\s*([=;+].*)$//s
1163 0 62 unless my($var_type, $var_addr, $var_name) = /^(.*?[^&\s])\s*(\&?)\s*\b(\w+)$/s
1169 0 62 if $self->{'arg_list'}{$var_name}++ or defined $self->{'argtype_seen'}{$var_name} and not $self->{'processing_arg_with_types'}
1178 0 62 if ($var_type =~ / \( \s* \* \s* \) /x) { }
1189 56 6 if ($self->{'var_num'})
1191 0 0 unless $typemap or $is_overridden_typemap
1195 0 62 if $var_addr
1196 5 57 if ($var_init =~ /^[=;]\s*NO_INIT\s*;?\s*$/ or $self->{'in_out'}{$var_name} and $self->{'in_out'}{$var_name} =~ /^OUT/ and not $var_init =~ /\S/) { }
2 55 elsif ($var_init =~ /\S/) { }
55 0 elsif ($self->{'var_num'}) { }
1199 0 5 if ($printed_name) { }
1235 19 31 unless /\S/
1236 0 31 if (/^\s*SETMAGIC\s*:\s*(ENABLE|DISABLE)\s*/)
1237 0 0 $1 eq 'ENABLE' ? :
1242 0 31 if $self->{'outargs'}{$outarg}++
1243 23 8 if (not $self->{'gotRETVAL'} and $outarg eq "RETVAL")
1250 0 8 unless defined $self->{'args_match'}{$outarg}
1252 0 8 unless defined $self->{'var_types'}{$outarg}
1254 0 8 if ($outcode) { }
1256 0 0 if $self->{'DoSetMagic'}
1268 0 8 if exists $self->{'in_out'}{$outarg} and $self->{'in_out'}{$outarg} =~ /OUT$/
1287 0 0 if ($in =~ /\s/) { }
1359 0 16 if not $is_symbolic and $value =~ /:/
1364 15 1 unless $alias =~ /::/
1366 0 16 if ($is_symbolic)
1368 0 0 unless $value =~ /::/
1369 0 0 if (defined $self->{'XsubAliases'}{$value}) { }
0 0 elsif ($value eq $fname) { }
1380 0 16 if (defined $prev_value)
1381 0 0 if ($prev_value eq $value) { }
1394 16 0 unless ($is_symbolic)
1395 16 0 unless $self->{'XsubAliasValues'}{$value}
1399 0 16 if $value eq 0 and not defined $self->{'XsubAlias'}{$fname}
1400 0 0 if (@keys and $self->{'author_warnings'})
1416 0 0 $value eq '0' ? :
0 0 !$self->{'XsubAliasValueClashHinted'}++ ? :
1427 0 16 if $line
1436 0 1 unless /\S/
1447 6 16 unless /\S/
1449 16 0 if $_
1458 0 1 unless /\S/
1482 0 1 unless exists $map{$setting}
1494 0 1 unless $ver
1498 0 1 unless $ver =~ /^\d+(\.\d*)?/
1501 0 1 unless $VERSION >= $ver
1513 0 1 unless $setting =~ /^(ENABLE|DISABLE)/i
1516 0 1 if $1 eq "ENABLE"
1517 1 0 if $1 eq "DISABLE"
1528 0 1 if $self->{'proto_in_this_xsub'}++
1531 0 1 unless /\S/
1534 0 1 if ($_ eq 'DISABLE') { }
0 1 elsif ($_ eq 'ENABLE') { }
1543 0 1 unless valid_proto_string($_)
1550 0 1 unless $specified
1560 0 1 if $self->{'scope_in_this_xsub'}++
1563 0 1 unless $setting =~ /^(ENABLE|DISABLE)\b/i
1576 0 8 unless $setting =~ /^(ENABLE|DISABLE)/i
1579 2 6 if $1 eq "ENABLE"
1580 6 2 if $1 eq "DISABLE"
1592 0 0 unless $setting =~ /^(ENABLE|DISABLE)/i
1595 0 0 $1 eq 'ENABLE' ? :
1636 0 1 unless $_
1639 0 1 if /^\s*\|/
1644 0 1 if $self->{'IncludedFiles'}{$_}
1646 1 0 unless /\|\s*$/
1648 0 1 if (/\|\s*$/ and /^\s*perl\s/)
1662 0 1 unless open $self->{'FH'}, $_
1673 0 1 $^O =~ /^mswin/i ? :
1680 1 1 unless /^\s*$/
1692 0 0 if not /^\"/ and length $_ > 0
1707 0 1 if (defined $command and $command =~ /\s/ and not $command =~ /[$quote]/)
1723 0 1 if $^O eq "VMS"
1725 0 1 unless $_
1728 0 1 if /^\s*\|/ or /\|\s*$/
1741 0 1 unless open $self->{'FH'}, "-|", $_
1760 1 1 unless /^\s*$/
1770 8 2 unless $self->{'XSStack'}[-1]{'type'} eq "file"
1777 1 1 unless $isPipe
1792 0 1 if ($isPipe and $?)
1821 8 0 defined $pkg ? :
1822 6 2 defined $prefix ? :
1827 8 0 if $self->{'Packprefix'} ne ""
1838 1 3 if $self->{'lastline'} =~ /^=cut\s*$/
1840 0 1 unless defined $self->{'lastline'}
1854 6 566 if ($self->{'lastline'} =~ /^TYPEMAP\s*:\s*<<\s*(?:(["'])(.+?)\1|([^\s'"]+?))\s*;?\s*$/)
1856 3 3 defined $1 ? :
1862 0 34 unless defined $self->{'lastline'}
1863 6 28 if $self->{'lastline'} =~ /^$end_marker\s*$/
1884 0 96 if not defined $self->{'lastline'} and $self->{'XSStack'}[-1]{'type'} eq "if"
1887 10 86 unless defined $self->{'lastline'}
1889 8 78 if ($self->{'lastline'} =~ /^MODULE\s*=\s*([\w:]+)(?:\s+PACKAGE\s*=\s*([\w:]+))?(?:\s+PREFIX\s*=\s*(\S+))?\s*$/)
1906 569 3 if (not $self->{'lastline'} =~ /^\s*#/ or $self->{'lastline'} =~ /^\#[ \t]* (?: (?:if|ifn?def|elif|else|endif|elifn?def| define|undef|pragma|error| warning|line\s+\d+|ident) \b | (?:include(?:_next)?|import) \s* ["<] .* [>"] ) /x)
1925 74 149 if $self->{'lastline'} =~ /^\S/ and @{$self->{'line'};} and $self->{'line'}[-1] eq ""
1926 3 492 if ($self->{'lastline'} =~ /^#[ \t]*(if|ifn?def|elif|else|endif|elifn?def)\b/)
1928 1 2 if ($type =~ /^if/) { }
1 1 elsif ($type eq 'endif') { }
1 0 elsif (not $if_level) { }
1929 0 1 if (@{$self->{'line'};}) { }
1936 0 1 if ($if_level) { }
1947 0 495 if ($final and @{$self->{'line'};})
1956 10 488 unless defined($self->{'lastline'} = readline $self->{'FH'})
1964 2 486 if ($final)
1984 1 1 $num ? :
1988 2 0 if ($init =~ /^=/) { }
1989 0 2 if ($printed_name) { }
1997 0 0 if ($init =~ s/^\+// and $num) { }
0 0 elsif ($printed_name) { }
2031 0 55 unless ($typemaps->get_typemap("ctype", $type))
2044 0 55 if $self->{'func_name'} =~ /DESTROY$/
2045 1 16 if ($xstype eq "T_PV" and exists $self->{'lengthof'}{$var})
2046 1 0 unless $printed_name
2049 0 1 if defined $self->{'defaults'}{$var}
2052 54 0 unless $self->{'RetainCplusplusHierarchicalTypes'}
2055 1 53 unless (defined $inputmap)
2062 0 53 if ($expr =~ /DO_ARRAY_ELEM/)
2064 0 0 unless ($subtypemap)
2070 0 0 unless ($subinputmap)
2084 0 53 if ($expr =~ m[/\*.*scope.*\*/]i)
2099 1 52 if (defined $self->{'defaults'}{$var}) { }
1 51 elsif ($self->{'ScopeThisXSUB'} or not $expr =~ /^\s*\$var =/) { }
2102 0 1 if ($printed_name) { }
2108 0 1 if ($self->{'defaults'}{$var} eq 'NO_INIT') { }
2122 0 1 if ($printed_name) { }
2132 0 51 if $printed_name
2151 0 17 if ($type =~ /^array\(([^,]*),(.*)\)/) { }
2154 0 0 if $do_setmagic
2158 0 17 unless ($typemap)
2164 0 17 unless ($outputmap)
2172 17 0 unless $self->{'RetainCplusplusHierarchicalTypes'}
2176 0 17 if ($expr =~ /DO_ARRAY_ELEM/) { }
5 12 elsif ($var eq 'RETVAL') { }
4 8 elsif ($do_push) { }
8 0 elsif ($arg =~ /^ST\(\d+\)$/) { }
2178 0 0 unless ($subtypemap)
2184 0 0 unless ($suboutputmap)
2196 0 0 if $do_setmagic
2208 0 5 if ($expr =~ /^\t\Q$arg\E = new/) { }
5 0 elsif ($evalexpr =~ /^\t\Q$arg\E\s*=\s*(boolSV\(|(&PL_sv_yes|&PL_sv_no|&PL_sv_undef)\s*;)/) { }
0 0 elsif ($evalexpr =~ /^\s*\Q$arg\E\s*=/) { }
2223 0 0 if $ntype eq "SVPtr"
2235 0 5 if ($use_RETVALSV) { }
2241 0 5 if $pre_expr
2243 0 5 if ($use_RETVALSV) { }
2253 0 5 if ($do_mortal or $do_setmagic) { }
2263 5 0 unless $evalexpr =~ /^\s*RETVAL = RETVAL;$/
2264 0 0 $use_RETVALSV ? :
0 0 $use_RETVALSV ? :
0 5 if $do_mortal
2266 0 0 $use_RETVALSV ? :
0 5 if $do_setmagic
2268 0 0 $use_RETVALSV ? :
0 5 if $do_mortal or $do_setmagic or $do_copy_tmp
2270 0 5 if $use_RETVALSV
2276 0 4 if $do_setmagic
2280 8 0 if $do_setmagic