Ticket #577: no-line-directives.patch

File no-line-directives.patch, 5.2 KB (added by bsdz, 13 years ago)

patch adds new switch to Configure.pl

  • config/gen/makefiles/root.in

     
    618618        $(PERL) $(BUILD_TOOLS_DIR)/c2str.pl --all 
    619619 
    620620# classes PMC build utils and rules 
    621 PMC2CD := $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --dump 
    622 PMC2CC := $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --c 
    623 PMC2CV := $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --vtable 
     621PMC2CD := $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --dump @no_lines_flag@ 
     622PMC2CC := $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --c @no_lines_flag@ 
     623PMC2CV := $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --vtable @no_lines_flag@ 
    624624 
    625625.pmc.dump : # suffix rule (limited support) 
    626626        $(PMC2CD) $< 
     
    995995 
    996996$(INC_DIR)/oplib/ops.h lib/Parrot/OpLib/core.pm : $(OPS_FILES) $(BUILD_TOOLS_DIR)/ops2pm.pl \ 
    997997    lib/Parrot/OpsFile.pm lib/Parrot/Op.pm $(OPS_DIR)/ops.num $(OPS_DIR)/ops.skip 
    998         $(PERL) $(BUILD_TOOLS_DIR)/ops2pm.pl $(OPS_FILES) 
     998        $(PERL) $(BUILD_TOOLS_DIR)/ops2pm.pl @no_lines_flag@ $(OPS_FILES) 
    999999 
    10001000############################################################################### 
    10011001# 
     
    12371237        lib/Parrot/OpsFile.pm lib/Parrot/Op.pm $(INC_DIR)/config.h \ 
    12381238        lib/Parrot/OpLib/core.pm lib/Parrot/OpTrans/C.pm \ 
    12391239        $(SRC_DIR)/pmc/pmc_continuation.h 
    1240         $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl C --core 
     1240        $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl C --core @no_lines_flag@ 
    12411241 
    12421242$(OPS_DIR)/core_ops_switch$(O) : $(GENERAL_H_FILES) $(OPS_DIR)/core_ops_switch.c \ 
    12431243        $(SRC_DIR)/pmc/pmc_parrotlibrary.h 
     
    12481248        lib/Parrot/OpsFile.pm lib/Parrot/Op.pm $(INC_DIR)/config.h \ 
    12491249        lib/Parrot/OpLib/core.pm lib/Parrot/OpTrans/CSwitch.pm \ 
    12501250        lib/Parrot/OpTrans/CPrederef.pm 
    1251         $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CSwitch --core 
     1251        $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CSwitch --core @no_lines_flag@ 
    12521252 
    12531253@TEMP_cg_c@ 
    12541254 
  • config/init/defaults.pm

     
    239239        # Extra flags needed for libnci_test.so 
    240240        ncilib_link_extra => '', 
    241241 
     242        # Flag determines if pmc2c.pl and ops2c.pl also  
     243        # generate #line directives. These can confuse  
     244        # debugging internals. 
     245        no_lines_flag => $conf->options->get('no-line-directives') ? '--no-lines' : '', 
    242246    ); 
    243247 
    244248    # add profiling if needed 
  • Configure.pl

     
    297297 
    298298  --define=inet_aton 
    299299 
     300=item C<--no-line-directives> 
     301 
     302Disables the creation of C #line directives when generating C from PMCs and 
     303ops. Useful when debugging internals. 
     304   
    300305=back 
    301306 
    302307=head2 Parrot Options 
  • lib/Parrot/Configure/Options/Conf.pm

     
    7979   --lex=(lexer)        Use the given lexical analyzer generator 
    8080   --make=(make tool)   Use the given make utility 
    8181   --yacc=(parser)      Use the given parser generator 
     82    
     83   --no-line-directives Disable creation of C #line directives 
    8284 
    8385   --define=inet_aton   Quick hack to use inet_aton instead of inet_pton 
    8486 
  • lib/Parrot/Configure/Options/Conf/Shared.pm

     
    5252    maintainer 
    5353    mandir 
    5454    nomanicheck 
     55    no-line-directives 
    5556    oldincludedir 
    5657    opcode 
    5758    ops 
  • lib/Parrot/Pmc2c/Emitter.pm

     
    44use strict; 
    55use warnings; 
    66use Parrot::Pmc2c::UtilFunctions qw(count_newlines spew escape_filename); 
     7use Parrot::Pmc2c::Pmc2cMain; 
    78use overload '""'   => \&stringify; 
    89use overload 'bool' => \&boolify; 
    910 
     
    129130        else { 
    130131            $line = $self->{current_line} if $line == -1; 
    131132            my $filename_escaped = escape_filename($filename); 
    132             $data .= "#line $line \"$filename_escaped\"\n"; 
     133            if (!$Parrot::Pmc2c::Pmc2cMain::OPTIONS->{nolines}) { 
     134                $data .= "#line $line \"$filename_escaped\"\n"; 
     135            } 
    133136            $data .= $it->{data}; 
    134137        } 
    135138        $self->{output} .= $data; 
  • lib/Parrot/Pmc2c/Pmc2cMain.pm

     
    2020use Parrot::Pmc2c::PMC::Null (); 
    2121use Parrot::Pmc2c::PMC::Object (); 
    2222 
     23# put the options in a package var so it can be accessed from 
     24# Parrot::Pmc2c::Emitter. 
     25our $OPTIONS; 
     26 
    2327$SIG{'__WARN__'} = sub { use Carp; warn $_[0]; Carp::confess; }; 
    2428 
    2529=head1 NAME 
     
    9498            $allargsref->{opt}{$opt} = 0; 
    9599        } 
    96100    } 
     101     
     102    $OPTIONS = $allargsref->{opt}; 
    97103 
    98104    return bless( $allargsref, $class ); 
    99105}