Branch Coverage

blib/lib/ExtUtils/ParseXS.pm
Criterion Covered Total %
branch 356 564 63.1


line true false branch
81 7 1 if (@_ % 2) { }
83 5 2 ref $invocant ? :
108 0 8 $args{'except'} ? :
113 0 8 if ($^O eq "VMS")
136 0 8 unless $args{'filename'}
145 4 4 unless (ref $args{'output'})
146 0 4 unless open my $fh, "> $args{'output'}"
160 6 2 if ($self->{'WantLineNumbers'}) { }
162 3 3 if ($args{'outfile'}) { }
167 0 3 unless $cfile =~ s/\.xs$/$csuffix/i
198 6 2 if $self->{'WantLineNumbers'}
202 0 8 unless open $self->{'FH'}, "<", $self->{'filename'}
206 1 182 if (/^=/)
209 1 4 if (/^=cut\s*$/)
225 1 0 if $self->{'WantLineNumbers'}
234 0 0 unless $self->{'lastline'}
236 8 174 if ($self->{'Package'}, $self->{'Prefix'}) = /^MODULE\s*=\s*[\w:]+(?:\s+PACKAGE\s*=\s*([\w:]+))?(?:\s+PREFIX\s*=\s*(\S+))?\s*$/
241 0 8 unless (defined $_)
246 6 2 if $self->{'WantLineNumbers'}
250 6 2 if $self->{'WantLineNumbers'}
265 2 3 unless $ln =~ /^\#\s*((if)(?:n?def)?|elsif|else|endif)\b/
273 15 71 unless @{$self->{'line'};}
275 1 70 if ($XSS_work_idx and not $self->{'XSStack'}[$XSS_work_idx]{'varname'})
287 0 71 if $self->{'line'}[0] =~ /^\s/
311 14 0 unless @{$self->{'line'};}
315 1 56 if ($self->check_keyword("BOOT"))
319 1 0 if $self->{'WantLineNumbers'} and not $self->{'line'}[0] =~ /^\s*#\s*line\b/
326 0 56 if $self->{'ret_type'} =~ s/^NO_OUTPUT\s+//
331 0 56 if $self->{'argtypes'} and $self->{'ret_type'} =~ s/^(.*?\w.*?)\s*\b(\w+\s*\(.*)/$1/s
335 0 56 unless @{$self->{'line'};}
337 0 56 if $self->{'ret_type'} =~ s/^extern "C"\s+//
338 0 56 if $self->{'ret_type'} =~ s/^static\s+//
341 0 56 unless $func_header =~ /^(?:([\w:]*)::)?(\w+)\s*\(\s*(.*?)\s*\)\s*(const)?\s*(;\s*)?$/s
346 0 56 if $4
351 0 56 if ($Is_VMS)
357 59 0 unless defined $tmp->{'functions'}{$self->{'Full_func_name'}}
374 47 9 if ($self->{'argtypes'} and $orig_args =~ /\S/) { }
377 47 0 if ($args =~ /^( (??{ $C_arg; }) , )* $ /x) { }
387 57 13 unless defined $pre and length $pre
390 5 8 if ($self->{'inout'} and s/^(IN|IN_OUTLIST|OUTLIST|OUT|IN_OUT)\b\s*//)
392 4 1 if $type ne "IN"
397 1 12 if ($len_name =~ /^length\( \s* (\w+) \s* \)\z/x)
400 0 1 if length $default
403 13 0 if (length $pre or $islength)
404 1 12 if ($islength) { }
414 5 8 if $out_type eq "OUTLIST" or $islength
415 4 9 if $out_type =~ /OUTLIST$/
416 4 9 if $out_type
428 0 0 if ($self->{'inout'} and s/^(IN|IN_OUTLIST|OUTLIST|IN_OUT|OUT)\b\s*//)
430 0 0 if $out_type eq "IN"
431 0 0 if $out_type eq "OUTLIST"
432 0 0 if ($out_type =~ /OUTLIST$/)
439 0 56 if (defined $class)
440 0 0 defined $static || $self->{'func_name'} eq 'new' ? :
450 4 66 if ($args[$i] =~ s/\.\.\.//)
452 4 0 if ($args[$i] eq "" and $i == $#args)
458 5 61 if ($$only_C_inlist_ref{$args[$i]}) { }
465 1 65 if ($args[$i] =~ /^([^=]*[^\s=])\s*=\s*(.*)/s)
471 61 5 unless $$only_C_inlist_ref{$args[$i]}
490 0 56 if $EXPLICIT_RETURN
492 0 56 $externC ? :
502 6 50 if $self->{'ALIAS'}
505 1 55 if $INTERFACE
511 0 56 if $self->{'except'}
516 54 2 if ($self->{'cond'}) { }
535 4 52 if $PPCODE
539 4 52 if $PPCODE
553 2 55 if $self->check_keyword("CASE")
567 0 57 if $self->{'ScopeThisXSUB'}
572 0 57 if (not $self->{'thisdone'} and defined $class)
573 0 0 if (defined $static or $self->{'func_name'} eq 'new') { }
600 0 57 if (/^\s*NOT_IMPLEMENTED_YET/) { }
605 36 21 if ($self->{'ret_type'} ne "void")
607 36 0 unless $self->{'retvaldone'}
612 27 9 if $self->{'optimize'} and $outputmap and $outputmap->targetable
615 7 50 if (@fake_INPUT or @fake_INPUT_pre)
625 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') { }
627 0 4 if @{$self->{'line'};}
628 0 4 if $self->{'ScopeThisXSUB'}
633 27 8 if ($consumed_code =~ /\bRETVAL\b/)
643 9 9 if ($self->{'ret_type'} ne "void")
647 0 18 if (defined $static) { }
0 18 elsif (defined $class) { }
648 0 0 if ($self->{'func_name'} eq 'new') { }
656 0 0 if ($self->{'func_name'} eq 'new') { }
664 0 18 if defined $strip
666 1 17 if $self->{'interface'}
675 0 57 if $RETVAL_no_return
681 0 27 if ($self->{'have_CODE_with_RETVAL'} and not $self->{'have_OUTPUT'} and $self->{'ret_type'} ne "void")
694 3 54 if ($outlist_count)
696 2 1 if $self->{'gotRETVAL'} or $wantRETVAL
701 0 57 if ($self->{'gotRETVAL'} and $self->{'RETVAL_code'}) { }
32 25 elsif ($self->{'gotRETVAL'} or $wantRETVAL) { }
703 0 0 if $outlist_count
711 27 5 if ($trgt) { }
716 0 27 if (not $trgt->{'with_size'} and $trgt->{'type'} eq 'p') { }
719 0 0 unless $outlist_count
724 27 0 unless defined $tsize
729 26 1 unless $outlist_count
742 1 4 if $outlist_count
746 36 21 if $self->{'ret_type'} ne "void"
760 0 57 if $self->{'ScopeThisXSUB'}
763 0 57 if $self->{'ScopeThisXSUB'} and not $PPCODE
771 0 57 if $self->{'except'}
777 1 56 if ($self->check_keyword("CASE"))
779 0 1 unless $self->{'condnum'}
783 56 0 if $_ eq "${END}:"
784 0 0 /^$BLOCK_regexp/o ? :
787 0 56 if $self->{'except'}
792 36 20 if ($xsreturn) { }
793 36 0 unless $PPCODE
798 16 4 unless $PPCODE
809 17 39 if ($self->{'ProtoThisXSUB'}) { }
818 0 17 if ($self->{'ProtoThisXSUB'} eq 2) { }
16 1 elsif ($self->{'ProtoThisXSUB'} eq 1) { }
823 0 16 if ($min_args < $num_args)
827 2 14 if $ellipsis
839 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') { }
841 5 1 unless defined $self->{'XsubAliases'}{$self->{'pname'}}
859 1 0 unless $yname =~ /::/
876 1 7 if ($self->{'Overload'})
911 7 1 $self->{'WantVersionChk'} ? :
920 8 0 if $self->{'Full_func_name'}
937 7 1 if ($self->{'WantVersionChk'}) { }
956 1 7 if defined $self->{'XsubAliases'} or defined $self->{'interfaces'}
962 1 7 if $self->{'Overload'}
978 1 7 if defined $self->{'XsubAliases'} or defined $self->{'interfaces'}
982 1 7 if (@{$BootCode_ref;})
1004 0 8 unless $self->{'ProtoUsed'}
1008 6 2 if tied *PSEUDO_STDOUT
1015 1 1 if (@_) { }
1030 110 523 if s/^(\s*)($_[0])\s*:\s*(?:#.*)?/$1/s
1043 33 1 if $self->{'WantLineNumbers'} and not /^\s*#\s*line\b/ and not /^#if XSubPPtmp/
1048 34 14 if $self->{'WantLineNumbers'}
1081 0 2 if $self->{'condnum'} and $self->{'cond'} eq ""
1084 1 1 $self->{'condnum'}++ ? :
2 0 $self->{'cond'} ? :
1092 0 71 if /^\s*NOT_IMPLEMENTED_YET/
1093 9 62 unless /\S/
1099 60 2 unless /[=;+].*\S/
1102 1 61 if (s/^([^=]*)\blength\(\s*(\w+)\s*\)\s*$/$1 XSauto_length_of_$2=NO_INIT/x)
1110 3 59 if s/\s*([=;+].*)$//s
1116 0 62 unless my($var_type, $var_addr, $var_name) = /^(.*?[^&\s])\s*(\&?)\s*\b(\w+)$/s
1122 0 62 if $self->{'arg_list'}{$var_name}++ or defined $self->{'argtype_seen'}{$var_name} and not $self->{'processing_arg_with_types'}
1131 0 62 if ($var_type =~ / \( \s* \* \s* \) /x) { }
1142 56 6 if ($self->{'var_num'})
1144 0 0 unless $typemap or $is_overridden_typemap
1148 0 62 if $var_addr
1149 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'}) { }
1152 0 5 if ($printed_name) { }
1188 19 31 unless /\S/
1189 0 31 if (/^\s*SETMAGIC\s*:\s*(ENABLE|DISABLE)\s*/)
1190 0 0 $1 eq 'ENABLE' ? :
1195 0 31 if $self->{'outargs'}{$outarg}++
1196 23 8 if (not $self->{'gotRETVAL'} and $outarg eq "RETVAL")
1203 0 8 unless defined $self->{'args_match'}{$outarg}
1205 0 8 unless defined $self->{'var_types'}{$outarg}
1207 0 8 if ($outcode) { }
1209 0 0 if $self->{'DoSetMagic'}
1221 0 8 if exists $self->{'in_out'}{$outarg} and $self->{'in_out'}{$outarg} =~ /OUT$/
1240 0 0 if ($in =~ /\s/) { }
1304 15 1 unless $alias =~ /::/
1308 0 16 if defined $self->{'XsubAliases'}{$alias}
1311 0 16 if $self->{'XsubAliasValues'}{$value}
1317 0 16 if $line
1326 0 1 unless /\S/
1337 6 16 unless /\S/
1339 16 0 if $_
1348 0 1 unless /\S/
1351 1 0 unless $self->{'Overload'}
1375 0 1 unless exists $map{$setting}
1387 0 1 unless $ver
1391 0 1 unless $ver =~ /^\d+(\.\d*)?/
1394 0 1 unless $VERSION >= $ver
1406 0 1 unless $setting =~ /^(ENABLE|DISABLE)/i
1409 0 1 if $1 eq "ENABLE"
1410 1 0 if $1 eq "DISABLE"
1421 0 1 if $self->{'proto_in_this_xsub'}++
1424 0 1 unless /\S/
1427 0 1 if ($_ eq 'DISABLE') { }
0 1 elsif ($_ eq 'ENABLE') { }
1436 0 1 unless valid_proto_string($_)
1443 0 1 unless $specified
1453 0 1 if $self->{'scope_in_this_xsub'}++
1456 0 1 unless $setting =~ /^(ENABLE|DISABLE)\b/i
1469 0 8 unless $setting =~ /^(ENABLE|DISABLE)/i
1472 2 6 if $1 eq "ENABLE"
1473 6 2 if $1 eq "DISABLE"
1485 0 0 unless $setting =~ /^(ENABLE|DISABLE)/i
1488 0 0 $1 eq 'ENABLE' ? :
1529 0 1 unless $_
1532 0 1 if /^\s*\|/
1537 0 1 if $self->{'IncludedFiles'}{$_}
1539 1 0 unless /\|\s*$/
1541 0 1 if (/\|\s*$/ and /^\s*perl\s/)
1555 0 1 unless open $self->{'FH'}, $_
1566 0 1 $^O =~ /^mswin/i ? :
1573 1 1 unless /^\s*$/
1585 0 0 if not /^\"/ and length $_ > 0
1600 0 1 if (defined $command and $command =~ /\s/ and not $command =~ /[$quote]/)
1616 0 1 if $^O eq "VMS"
1618 0 1 unless $_
1621 0 1 if /^\s*\|/ or /\|\s*$/
1634 0 1 unless open $self->{'FH'}, "-|", $_
1653 1 1 unless /^\s*$/
1663 8 2 unless $self->{'XSStack'}[-1]{'type'} eq "file"
1670 1 1 unless $isPipe
1685 0 1 if ($isPipe and $?)
1714 8 0 defined $pkg ? :
1715 6 2 defined $prefix ? :
1720 8 0 if $self->{'Packprefix'} ne ""
1731 1 3 if $self->{'lastline'} =~ /^=cut\s*$/
1733 0 1 unless defined $self->{'lastline'}
1747 6 566 if ($self->{'lastline'} =~ /^TYPEMAP\s*:\s*<<\s*(?:(["'])(.+?)\1|([^\s'"]+?))\s*;?\s*$/)
1749 3 3 defined $1 ? :
1755 0 34 unless defined $self->{'lastline'}
1756 6 28 if $self->{'lastline'} =~ /^$end_marker\s*$/
1777 0 94 if not defined $self->{'lastline'} and $self->{'XSStack'}[-1]{'type'} eq "if"
1780 10 84 unless defined $self->{'lastline'}
1782 8 76 if ($self->{'lastline'} =~ /^MODULE\s*=\s*([\w:]+)(?:\s+PACKAGE\s*=\s*([\w:]+))?(?:\s+PREFIX\s*=\s*(\S+))?\s*$/)
1793 569 3 if (not $self->{'lastline'} =~ /^\s*#/ or $self->{'lastline'} =~ /^\#[ \t]* (?: (?:if|ifn?def|elif|else|endif| define|undef|pragma|error| warning|line\s+\d+|ident) \b | (?:include(?:_next)?|import) \s* ["<] .* [>"] ) /x)
1812 74 149 if $self->{'lastline'} =~ /^\S/ and @{$self->{'line'};} and $self->{'line'}[-1] eq ""
1818 10 488 unless defined($self->{'lastline'} = readline $self->{'FH'})
1843 1 1 $num ? :
1847 2 0 if ($init =~ /^=/) { }
1848 0 2 if ($printed_name) { }
1856 0 0 if ($init =~ s/^\+// and $num) { }
0 0 elsif ($printed_name) { }
1890 0 55 unless ($typemaps->get_typemap("ctype", $type))
1903 0 55 if $self->{'func_name'} =~ /DESTROY$/
1904 1 16 if ($xstype eq "T_PV" and exists $self->{'lengthof'}{$var})
1905 1 0 unless $printed_name
1908 0 1 if defined $self->{'defaults'}{$var}
1911 54 0 unless $self->{'RetainCplusplusHierarchicalTypes'}
1914 1 53 unless (defined $inputmap)
1921 0 53 if ($expr =~ /DO_ARRAY_ELEM/)
1923 0 0 unless ($subtypemap)
1929 0 0 unless ($subinputmap)
1943 0 53 if ($expr =~ m[/\*.*scope.*\*/]i)
1958 1 52 if (defined $self->{'defaults'}{$var}) { }
1 51 elsif ($self->{'ScopeThisXSUB'} or not $expr =~ /^\s*\$var =/) { }
1961 0 1 if ($printed_name) { }
1967 0 1 if ($self->{'defaults'}{$var} eq 'NO_INIT') { }
1981 0 1 if ($printed_name) { }
1991 0 51 if $printed_name
2010 0 17 if ($type =~ /^array\(([^,]*),(.*)\)/) { }
2013 0 0 if $do_setmagic
2017 0 17 unless ($typemap)
2023 0 17 unless ($outputmap)
2034 0 17 if ($expr =~ /DO_ARRAY_ELEM/) { }
5 12 elsif ($var eq 'RETVAL') { }
4 8 elsif ($do_push) { }
8 0 elsif ($arg =~ /^ST\(\d+\)$/) { }
2036 0 0 unless ($subtypemap)
2042 0 0 unless ($suboutputmap)
2054 0 0 if $do_setmagic
2066 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*=/) { }
2081 0 0 if $ntype eq "SVPtr"
2093 0 5 if ($use_RETVALSV) { }
2099 0 5 if $pre_expr
2101 0 5 if ($use_RETVALSV) { }
2111 0 5 if ($do_mortal or $do_setmagic) { }
2121 5 0 unless $evalexpr =~ /^\s*RETVAL = RETVAL;$/
2122 0 0 $use_RETVALSV ? :
0 0 $use_RETVALSV ? :
0 5 if $do_mortal
2124 0 0 $use_RETVALSV ? :
0 5 if $do_setmagic
2126 0 0 $use_RETVALSV ? :
0 5 if $do_mortal or $do_setmagic or $do_copy_tmp
2128 0 5 if $use_RETVALSV
2134 0 4 if $do_setmagic
2138 8 0 if $do_setmagic