Branch Coverage

blib/lib/ExtUtils/ParseXS.pm
Criterion Covered Total %
branch 352 556 63.3


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 152 if (/^=/)
209 1 4 if (/^=cut\s*$/)
225 1 0 if $self->{'WantLineNumbers'}
234 0 0 unless $self->{'lastline'}
236 8 144 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 69 unless @{$self->{'line'};}
275 1 68 if ($XSS_work_idx and not $self->{'XSStack'}[$XSS_work_idx]{'varname'})
287 0 69 if $self->{'line'}[0] =~ /^\s/
311 14 0 unless @{$self->{'line'};}
315 1 54 if ($self->check_keyword('BOOT'))
319 1 0 if $self->{'WantLineNumbers'} and not $self->{'line'}[0] =~ /^\s*#\s*line\b/
326 0 54 if $self->{'ret_type'} =~ s/^NO_OUTPUT\s+//
331 0 54 if $self->{'argtypes'} and $self->{'ret_type'} =~ s/^(.*?\w.*?)\s*\b(\w+\s*\(.*)/$1/s
335 0 54 unless @{$self->{'line'};}
337 0 54 if $self->{'ret_type'} =~ s/^extern "C"\s+//
338 0 54 if $self->{'ret_type'} =~ s/^static\s+//
341 0 54 unless $func_header =~ /^(?:([\w:]*)::)?(\w+)\s*\(\s*(.*?)\s*\)\s*(const)?\s*(;\s*)?$/s
346 0 54 if $4
351 0 54 if ($Is_VMS)
357 57 0 unless defined $tmp->{'functions'}{$self->{'Full_func_name'}}
374 45 9 if ($self->{'argtypes'} and $orig_args =~ /\S/) { }
377 45 0 if ($args =~ /^( (??{ $C_arg; }) , )* $ /x) { }
387 57 7 unless defined $pre and length $pre
390 3 4 if ($self->{'inout'} and s/^(IN|IN_OUTLIST|OUTLIST|OUT|IN_OUT)\b\s*//)
392 2 1 if $type ne 'IN'
397 1 6 if ($len_name =~ /^length\( \s* (\w+) \s* \)\z/x)
400 0 1 if length $default
403 7 0 if (length $pre or $islength)
404 1 6 if ($islength) { }
414 3 4 if $out_type eq 'OUTLIST' or $islength
415 2 5 if $out_type =~ /OUTLIST$/
416 2 5 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 54 if (defined $class)
440 0 0 defined $static || $self->{'func_name'} eq 'new' ? :
450 4 60 if ($args[$i] =~ s/\.\.\.//)
452 4 0 if ($args[$i] eq '' and $i == $#args)
458 3 57 if ($$only_C_inlist_ref{$args[$i]}) { }
465 1 59 if ($args[$i] =~ /^([^=]*[^\s=])\s*=\s*(.*)/s)
471 57 3 unless $$only_C_inlist_ref{$args[$i]}
490 0 54 if $EXPLICIT_RETURN
492 0 54 $externC ? :
502 6 48 if $self->{'ALIAS'}
505 1 53 if $INTERFACE
511 0 54 if $self->{'except'}
516 52 2 if ($self->{'cond'}) { }
535 4 50 if $PPCODE
539 4 50 if $PPCODE
553 2 53 if $self->check_keyword('CASE')
567 0 55 if $self->{'ScopeThisXSUB'}
572 0 55 if (not $self->{'thisdone'} and defined $class)
573 0 0 if (defined $static or $self->{'func_name'} eq 'new') { }
600 0 55 if (/^\s*NOT_IMPLEMENTED_YET/) { }
605 34 21 if ($self->{'ret_type'} ne 'void')
607 34 0 unless $self->{'retvaldone'}
612 26 8 if $self->{'optimize'} and $outputmap and $outputmap->targetable
615 5 50 if (@fake_INPUT or @fake_INPUT_pre)
625 4 51 if ($self->check_keyword('PPCODE')) { }
35 16 elsif ($self->check_keyword('CODE')) { }
0 16 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 7 9 if ($self->{'ret_type'} ne 'void')
647 0 16 if (defined $static) { }
0 16 elsif (defined $class) { }
648 0 0 if ($self->{'func_name'} eq 'new') { }
656 0 0 if ($self->{'func_name'} eq 'new') { }
664 0 16 if defined $strip
666 1 15 if $self->{'interface'}
675 0 55 if $RETVAL_no_return
681 0 27 if ($self->{'have_CODE_with_RETVAL'} and not $self->{'have_OUTPUT'} and $self->{'ret_type'} ne 'void')
695 0 55 if ($self->{'gotRETVAL'} and $self->{'RETVAL_code'}) { }
30 25 elsif ($self->{'gotRETVAL'} or $wantRETVAL) { }
704 26 4 if ($trgt) { }
709 0 26 if (not $trgt->{'with_size'} and $trgt->{'type'} eq 'p') { }
716 26 0 unless defined $tsize
737 34 21 if $self->{'ret_type'} ne 'void'
740 1 54 if $c and not $prepush_done
741 1 54 if $c
754 0 55 if $self->{'ScopeThisXSUB'}
757 0 55 if $self->{'ScopeThisXSUB'} and not $PPCODE
765 0 55 if $self->{'except'}
771 1 54 if ($self->check_keyword('CASE'))
773 0 1 unless $self->{'condnum'}
777 54 0 if $_ eq "${END}:"
778 0 0 /^$BLOCK_regexp/o ? :
781 0 54 if $self->{'except'}
786 34 20 if ($xsreturn) { }
787 34 0 unless $PPCODE
792 16 4 unless $PPCODE
803 15 39 if ($self->{'ProtoThisXSUB'}) { }
812 0 15 if ($self->{'ProtoThisXSUB'} eq 2) { }
14 1 elsif ($self->{'ProtoThisXSUB'} eq 1) { }
817 0 14 if ($min_args < $num_args)
821 2 12 if $ellipsis
833 6 48 if ($self->{'XsubAliases'} and keys %{$$self{'XsubAliases'};}) { }
1 47 elsif (@{$self->{'Attributes'};}) { }
1 46 elsif ($self->{'interface'}) { }
33 13 elsif ($self->{'newXS'} eq 'newXS_deffile') { }
835 5 1 unless defined $self->{'XsubAliases'}{$self->{'pname'}}
853 1 0 unless $yname =~ /::/
870 1 7 if ($self->{'Overload'})
905 7 1 $self->{'WantVersionChk'} ? :
914 8 0 if $self->{'Full_func_name'}
931 7 1 if ($self->{'WantVersionChk'}) { }
950 1 7 if defined $self->{'XsubAliases'} or defined $self->{'interfaces'}
956 1 7 if $self->{'Overload'}
972 1 7 if defined $self->{'XsubAliases'} or defined $self->{'interfaces'}
976 1 7 if (@{$BootCode_ref;})
998 0 8 unless $self->{'ProtoUsed'}
1002 6 2 if tied *PSEUDO_STDOUT
1009 1 1 if (@_) { }
1024 110 503 if s/^(\s*)($_[0])\s*:\s*(?:#.*)?/$1/s
1037 33 1 if $self->{'WantLineNumbers'} and not /^\s*#\s*line\b/ and not /^#if XSubPPtmp/
1042 34 14 if $self->{'WantLineNumbers'}
1075 0 2 if $self->{'condnum'} and $self->{'cond'} eq ''
1078 1 1 $self->{'condnum'}++ ? :
2 0 $self->{'cond'} ? :
1086 0 63 if /^\s*NOT_IMPLEMENTED_YET/
1087 7 56 unless /\S/
1093 54 2 unless /[=;+].*\S/
1096 1 55 if (s/^([^=]*)\blength\(\s*(\w+)\s*\)\s*$/$1 XSauto_length_of_$2=NO_INIT/x)
1104 3 53 if s/\s*([=;+].*)$//s
1110 0 56 unless my($var_type, $var_addr, $var_name) = /^(.*?[^&\s])\s*(\&?)\s*\b(\w+)$/s
1116 0 56 if $self->{'arg_list'}{$var_name}++ or defined $self->{'argtype_seen'}{$var_name} and not $self->{'processing_arg_with_types'}
1125 0 56 if ($var_type =~ / \( \s* \* \s* \) /x) { }
1136 52 4 if ($self->{'var_num'})
1138 0 0 unless $typemap or $is_overridden_typemap
1142 0 56 if $var_addr
1143 3 53 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 51 elsif ($var_init =~ /\S/) { }
51 0 elsif ($self->{'var_num'}) { }
1146 0 3 if ($printed_name) { }
1182 19 31 unless /\S/
1183 0 31 if (/^\s*SETMAGIC\s*:\s*(ENABLE|DISABLE)\s*/)
1184 0 0 $1 eq 'ENABLE' ? :
1189 0 31 if $self->{'outargs'}{$outarg}++
1190 23 8 if (not $self->{'gotRETVAL'} and $outarg eq 'RETVAL')
1197 0 8 unless defined $self->{'args_match'}{$outarg}
1199 0 8 unless defined $self->{'var_types'}{$outarg}
1201 0 8 if ($outcode) { }
1203 0 0 if $self->{'DoSetMagic'}
1215 0 8 if exists $self->{'in_out'}{$outarg} and $self->{'in_out'}{$outarg} =~ /OUT$/
1234 0 0 if ($in =~ /\s/) { }
1298 15 1 unless $alias =~ /::/
1302 0 16 if defined $self->{'XsubAliases'}{$alias}
1305 0 16 if $self->{'XsubAliasValues'}{$value}
1311 0 16 if $line
1320 0 1 unless /\S/
1331 6 16 unless /\S/
1333 16 0 if $_
1342 0 1 unless /\S/
1345 1 0 unless $self->{'Overload'}
1369 0 1 unless exists $map{$setting}
1381 0 1 unless $ver
1385 0 1 unless $ver =~ /^\d+(\.\d*)?/
1388 0 1 unless $VERSION >= $ver
1400 0 1 unless $setting =~ /^(ENABLE|DISABLE)/i
1403 0 1 if $1 eq 'ENABLE'
1404 1 0 if $1 eq 'DISABLE'
1415 0 1 if $self->{'proto_in_this_xsub'}++
1418 0 1 unless /\S/
1421 0 1 if ($_ eq 'DISABLE') { }
0 1 elsif ($_ eq 'ENABLE') { }
1430 0 1 unless valid_proto_string($_)
1437 0 1 unless $specified
1447 0 1 if $self->{'scope_in_this_xsub'}++
1450 0 1 unless $setting =~ /^(ENABLE|DISABLE)\b/i
1463 0 8 unless $setting =~ /^(ENABLE|DISABLE)/i
1466 2 6 if $1 eq 'ENABLE'
1467 6 2 if $1 eq 'DISABLE'
1479 0 0 unless $setting =~ /^(ENABLE|DISABLE)/i
1482 0 0 $1 eq 'ENABLE' ? :
1523 0 1 unless $_
1526 0 1 if /^\s*\|/
1531 0 1 if $self->{'IncludedFiles'}{$_}
1533 1 0 unless /\|\s*$/
1535 0 1 if (/\|\s*$/ and /^\s*perl\s/)
1549 0 1 unless open $self->{'FH'}, $_
1560 0 1 $^O =~ /^mswin/i ? :
1567 1 1 unless /^\s*$/
1579 0 0 if not /^\"/ and length $_ > 0
1594 0 1 if (defined $command and $command =~ /\s/ and not $command =~ /[$quote]/)
1610 0 1 if $^O eq 'VMS'
1612 0 1 unless $_
1615 0 1 if /^\s*\|/ or /\|\s*$/
1628 0 1 unless open $self->{'FH'}, '-|', $_
1647 1 1 unless /^\s*$/
1657 8 2 unless $self->{'XSStack'}[-1]{'type'} eq 'file'
1664 1 1 unless $isPipe
1679 0 1 if ($isPipe and $?)
1708 8 0 defined $pkg ? :
1709 6 2 defined $prefix ? :
1714 8 0 if $self->{'Packprefix'} ne ''
1725 1 3 if $self->{'lastline'} =~ /^=cut\s*$/
1727 0 1 unless defined $self->{'lastline'}
1741 6 558 if ($self->{'lastline'} =~ /^TYPEMAP\s*:\s*<<\s*(?:(["'])(.+?)\1|([^\s'"]+?))\s*;?\s*$/)
1743 3 3 defined $1 ? :
1749 0 34 unless defined $self->{'lastline'}
1750 6 28 if $self->{'lastline'} =~ /^$end_marker\s*$/
1771 0 92 if not defined $self->{'lastline'} and $self->{'XSStack'}[-1]{'type'} eq 'if'
1774 10 82 unless defined $self->{'lastline'}
1776 8 74 if ($self->{'lastline'} =~ /^MODULE\s*=\s*([\w:]+)(?:\s+PACKAGE\s*=\s*([\w:]+))?(?:\s+PREFIX\s*=\s*(\S+))?\s*$/)
1787 561 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)
1806 72 145 if $self->{'lastline'} =~ /^\S/ and @{$self->{'line'};} and $self->{'line'}[-1] eq ''
1812 10 482 unless defined($self->{'lastline'} = readline $self->{'FH'})
1837 1 1 $num ? :
1841 2 0 if ($init =~ /^=/) { }
1842 0 2 if ($printed_name) { }
1850 0 0 if ($init =~ s/^\+// and $num) { }
0 0 elsif ($printed_name) { }
1884 0 51 unless ($typemaps->get_typemap('ctype', $type))
1897 0 51 if $self->{'func_name'} =~ /DESTROY$/
1898 1 12 if ($xstype eq 'T_PV' and exists $self->{'lengthof'}{$var})
1899 1 0 unless $printed_name
1902 0 1 if defined $self->{'defaults'}{$var}
1905 50 0 unless $self->{'RetainCplusplusHierarchicalTypes'}
1908 1 49 unless (defined $inputmap)
1915 0 49 if ($expr =~ /DO_ARRAY_ELEM/)
1917 0 0 unless ($subtypemap)
1923 0 0 unless ($subinputmap)
1937 0 49 if ($expr =~ m[/\*.*scope.*\*/]i)
1952 1 48 if (defined $self->{'defaults'}{$var}) { }
1 47 elsif ($self->{'ScopeThisXSUB'} or not $expr =~ /^\s*\$var =/) { }
1955 0 1 if ($printed_name) { }
1961 0 1 if ($self->{'defaults'}{$var} eq 'NO_INIT') { }
1975 0 1 if ($printed_name) { }
1985 0 47 if $printed_name
2004 0 14 if ($type =~ /^array\(([^,]*),(.*)\)/) { }
2007 0 0 if $do_setmagic
2011 0 14 unless ($typemap)
2017 0 14 unless ($outputmap)
2028 0 14 if ($expr =~ /DO_ARRAY_ELEM/) { }
4 10 elsif ($var eq 'RETVAL') { }
2 8 elsif ($do_push) { }
8 0 elsif ($arg =~ /^ST\(\d+\)$/) { }
2030 0 0 unless ($subtypemap)
2036 0 0 unless ($suboutputmap)
2048 0 0 if $do_setmagic
2060 0 4 if ($expr =~ /^\t\Q$arg\E = new/) { }
4 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*=/) { }
2075 0 0 if $ntype eq 'SVPtr'
2087 0 4 if ($use_RETVALSV) { }
2093 0 4 if $pre_expr
2095 0 4 if ($use_RETVALSV) { }
2105 0 4 if ($do_mortal or $do_setmagic) { }
2115 4 0 unless $evalexpr =~ /^\s*RETVAL = RETVAL;$/
2116 0 0 $use_RETVALSV ? :
0 0 $use_RETVALSV ? :
0 4 if $do_mortal
2118 0 0 $use_RETVALSV ? :
0 4 if $do_setmagic
2120 0 0 $use_RETVALSV ? :
0 4 if $do_mortal or $do_setmagic or $do_copy_tmp
2122 0 4 if $use_RETVALSV
2128 0 2 if $do_setmagic
2132 8 0 if $do_setmagic