| File: | config/auto/va_ptr.pm |
| Coverage: | 73.5% |
| line | stmt | bran | cond | sub | code |
|---|---|---|---|---|---|
| 1 | # Copyright (C) 2001-2007, Parrot Foundation. | ||||
| 2 | |||||
| 3 - 11 | =head1 NAME config/auto/va_ptr.pm - va_list to va_ptr conversion test =head1 DESCRIPTION Tests which kind of PARROT_VA_TO_VAPTR to use. =cut | ||||
| 12 | |||||
| 13 | package auto::va_ptr; | ||||
| 14 | |||||
| 15 | 2 2 2 | use strict; | |||
| 16 | 2 2 2 | use warnings; | |||
| 17 | |||||
| 18 | 2 2 2 | use base qw(Parrot::Configure::Step); | |||
| 19 | |||||
| 20 | 2 2 2 | use Parrot::Configure::Utils ':auto'; | |||
| 21 | |||||
| 22 | |||||
| 23 | sub _init { | ||||
| 24 | 2 | my $self = shift; | |||
| 25 | 2 | my %data; | |||
| 26 | 2 | $data{description} = q{Test the type of va_ptr}; | |||
| 27 | 2 | $data{result} = q{}; | |||
| 28 | 2 | return \%data; | |||
| 29 | } | ||||
| 30 | |||||
| 31 | sub runstep { | ||||
| 32 | 1 | my ( $self, $conf ) = @_; | |||
| 33 | |||||
| 34 | 1 | my $va_type; | |||
| 35 | 1 | $conf->cc_gen('config/auto/va_ptr/test_c.in'); | |||
| 36 | 1 1 | eval { $conf->cc_build('-DVA_TYPE_STACK'); }; | |||
| 37 | |||||
| 38 | 1 | if ( $@ || $conf->cc_run() !~ /^ok/ ) { | |||
| 39 | 0 0 | eval { $conf->cc_build('-DVA_TYPE_REGISTER'); }; | |||
| 40 | 0 | if ( $@ || $conf->cc_run() !~ /^ok/ ) { | |||
| 41 | 0 | die "Unknown va_ptr type"; | |||
| 42 | } | ||||
| 43 | 0 | $va_type = 'register'; | |||
| 44 | } | ||||
| 45 | else { | ||||
| 46 | 1 | $va_type = 'stack'; | |||
| 47 | } | ||||
| 48 | 1 | $conf->cc_clean(); | |||
| 49 | 1 | $self->set_result($va_type); | |||
| 50 | 1 | $conf->data->set( va_ptr_type => $va_type ); | |||
| 51 | |||||
| 52 | 1 | return 1; | |||
| 53 | } | ||||
| 54 | |||||
| 55 | 1; | ||||
| 56 | |||||
| 57 | # Local Variables: | ||||
| 58 | # mode: cperl | ||||
| 59 | # cperl-indent-level: 4 | ||||
| 60 | # fill-column: 100 | ||||
| 61 | # End: | ||||
| 62 | # vim: expandtab shiftwidth=4: | ||||