The way configuration step auto::gc's runstep() method is structured
strikes me as peculiar.  Can I get some second opinions?

Starts out ordinarily enough (I've eliminated some whitespace and comments):

    if ( !defined($gc) ) {
        $gc = 'gc';
    }
    elsif ( $gc eq 'libc' ) {
        if ( $conf->data->get('i_malloc') ) {
            $conf->data->set( malloc_header => 'malloc.h' );
        }
        else {
            $conf->data->set( malloc_header => 'stdlib.h' );
        }
    }

Note that there's no 'else' stanza.  So we don't yet know how to handle
the case where $gc might be defined but something other than 'libc'. 
But let's continue:

    if ( $gc =~ /^malloc(?:-trace)?$/ ) {
        $conf->data->set(
            TEMP_gc_c => # a long heredoc
            TEMP_gc_o => # another heredoc
            gc_flag   => '-DGC_IS_MALLOC',
        );
    }
    elsif ( $gc eq 'libc' ) {

We're testing "$gc eq 'libc'" a *second* time??  Why?

        $conf->data->set(
            TEMP_gc_c => # a long heredoc
            TEMP_gc_o => "\$(SRC_DIR)/gc/res_lea\$(O)",
            gc_flag   => '-DGC_IS_MALLOC',
        );
    }
    else {
        $gc = 'gc';

Wait a minute!  Did'nt we deal with the case where we assign 'gc' to $gc
above??

        $conf->data->set(
            TEMP_gc_c => <<"EOF",
\$(SRC_DIR)/gc/resources\$(O):  \$(GENERAL_H_FILES)
\$(SRC_DIR)/gc/resources.c
EOF
            TEMP_gc_o => "\$(SRC_DIR)/gc/resources\$(O)",
            gc_flag   => '',
        );
    }

Can anyone tell me why this is so bass-ackwards?

Thank you very much.
kid51

Reply via email to