Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Change auto::gc step to do something useful: actually switch GC in co…
…mpile time
  • Loading branch information
bacek committed Feb 15, 2011
1 parent ecd3869 commit e0a4faf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
16 changes: 5 additions & 11 deletions config/auto/gc.pm
Expand Up @@ -27,8 +27,6 @@ use warnings;

use base qw(Parrot::Configure::Step);

use Parrot::Configure::Utils ':auto';

sub _init {
my $self = shift;
my %data;
Expand All @@ -40,17 +38,13 @@ sub _init {
sub runstep {
my ( $self, $conf ) = @_;

my $gc = 'gc';

$conf->data->set(
TEMP_gc_c => <<"EOF",
src/gc/alloc_resources\$(O): \$(GEN_HEADERS) src/gc/alloc_resources.c
EOF
TEMP_gc_o => "src/gc/alloc_resources\$(O)",
gc_flag => '',
);
my $gc = $conf->options->get('gc') || '';
$conf->debug(" ($gc) ");

if ($gc) {
$conf->data->set(gc_flag => '-DPARROT_GC_DEFAULT_TYPE=' . uc($gc));
}

return 1;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Parrot/Configure/Options/Conf.pm
Expand Up @@ -80,8 +80,8 @@ Compile Options:
--yacc=(parser) Use the given parser generator
--no-line-directives Disable creation of C #line directives
--define=inet_aton Quick hack to use inet_aton instead of inet_pton
--gc=(type) Which implementation of GC to use. One of ms, ms2 or gms.
Parrot Options:
Expand Down
1 change: 1 addition & 0 deletions lib/Parrot/Configure/Options/Conf/Shared.pm
Expand Up @@ -29,6 +29,7 @@ our @shared_valid_options = qw{
fatal
fatal-step
floatval
gc
help
hintsfile
icu-config
Expand Down
7 changes: 4 additions & 3 deletions t/steps/auto/gc-01.t
Expand Up @@ -18,7 +18,7 @@ use IO::CaptureOutput qw| capture |;

my ($args, $step_list_ref) = process_options(
{
argv => [ q{--verbose} ],
argv => [ q{--verbose --gc=ms2} ],
mode => q{configure},
}
);
Expand All @@ -41,8 +41,9 @@ my $step = test_step_constructor_and_description($conf);
\$stdout,
);
ok( $ret, "runstep() returned true value" );
like( $stdout, qr/\(gc\)/, "Got expected verbose output");
is($conf->data->get('gc_flag'), q{},
note $stdout;
like( $stdout, qr/\(ms2\)/, "Got expected verbose output");
is($conf->data->get('gc_flag'), q{-DPARROT_GC_DEFAULT_TYPE=MS2},
"Got expected value for 'gc_flag'");
}

Expand Down

0 comments on commit e0a4faf

Please sign in to comment.