Index: config/gen/makefiles/root.in =================================================================== --- config/gen/makefiles/root.in (revision 38282) +++ config/gen/makefiles/root.in (working copy) @@ -618,9 +618,9 @@ $(PERL) $(BUILD_TOOLS_DIR)/c2str.pl --all # classes PMC build utils and rules -PMC2CD := $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --dump -PMC2CC := $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --c -PMC2CV := $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --vtable +PMC2CD := $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --dump @no_lines_flag@ +PMC2CC := $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --c @no_lines_flag@ +PMC2CV := $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --vtable @no_lines_flag@ .pmc.dump : # suffix rule (limited support) $(PMC2CD) $< @@ -995,7 +995,7 @@ $(INC_DIR)/oplib/ops.h lib/Parrot/OpLib/core.pm : $(OPS_FILES) $(BUILD_TOOLS_DIR)/ops2pm.pl \ lib/Parrot/OpsFile.pm lib/Parrot/Op.pm $(OPS_DIR)/ops.num $(OPS_DIR)/ops.skip - $(PERL) $(BUILD_TOOLS_DIR)/ops2pm.pl $(OPS_FILES) + $(PERL) $(BUILD_TOOLS_DIR)/ops2pm.pl @no_lines_flag@ $(OPS_FILES) ############################################################################### # @@ -1237,7 +1237,7 @@ lib/Parrot/OpsFile.pm lib/Parrot/Op.pm $(INC_DIR)/config.h \ lib/Parrot/OpLib/core.pm lib/Parrot/OpTrans/C.pm \ $(SRC_DIR)/pmc/pmc_continuation.h - $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl C --core + $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl C --core @no_lines_flag@ $(OPS_DIR)/core_ops_switch$(O) : $(GENERAL_H_FILES) $(OPS_DIR)/core_ops_switch.c \ $(SRC_DIR)/pmc/pmc_parrotlibrary.h @@ -1248,7 +1248,7 @@ lib/Parrot/OpsFile.pm lib/Parrot/Op.pm $(INC_DIR)/config.h \ lib/Parrot/OpLib/core.pm lib/Parrot/OpTrans/CSwitch.pm \ lib/Parrot/OpTrans/CPrederef.pm - $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CSwitch --core + $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CSwitch --core @no_lines_flag@ @TEMP_cg_c@ Index: config/init/defaults.pm =================================================================== --- config/init/defaults.pm (revision 38282) +++ config/init/defaults.pm (working copy) @@ -239,6 +239,10 @@ # Extra flags needed for libnci_test.so ncilib_link_extra => '', + # Flag determines if pmc2c.pl and ops2c.pl also + # generate #line directives. These can confuse + # debugging internals. + no_lines_flag => $conf->options->get('no-line-directives') ? '--no-lines' : '', ); # add profiling if needed Index: Configure.pl =================================================================== --- Configure.pl (revision 38282) +++ Configure.pl (working copy) @@ -297,6 +297,11 @@ --define=inet_aton +=item C<--no-line-directives> + +Disables the creation of C #line directives when generating C from PMCs and +ops. Useful when debugging internals. + =back =head2 Parrot Options Index: lib/Parrot/Configure/Options/Conf.pm =================================================================== --- lib/Parrot/Configure/Options/Conf.pm (revision 38282) +++ lib/Parrot/Configure/Options/Conf.pm (working copy) @@ -79,6 +79,8 @@ --lex=(lexer) Use the given lexical analyzer generator --make=(make tool) Use the given make utility --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 Index: lib/Parrot/Configure/Options/Conf/Shared.pm =================================================================== --- lib/Parrot/Configure/Options/Conf/Shared.pm (revision 38282) +++ lib/Parrot/Configure/Options/Conf/Shared.pm (working copy) @@ -52,6 +52,7 @@ maintainer mandir nomanicheck + no-line-directives oldincludedir opcode ops Index: lib/Parrot/Pmc2c/Emitter.pm =================================================================== --- lib/Parrot/Pmc2c/Emitter.pm (revision 38282) +++ lib/Parrot/Pmc2c/Emitter.pm (working copy) @@ -4,6 +4,7 @@ use strict; use warnings; use Parrot::Pmc2c::UtilFunctions qw(count_newlines spew escape_filename); +use Parrot::Pmc2c::Pmc2cMain; use overload '""' => \&stringify; use overload 'bool' => \&boolify; @@ -129,7 +130,9 @@ else { $line = $self->{current_line} if $line == -1; my $filename_escaped = escape_filename($filename); - $data .= "#line $line \"$filename_escaped\"\n"; + if (!$Parrot::Pmc2c::Pmc2cMain::OPTIONS->{nolines}) { + $data .= "#line $line \"$filename_escaped\"\n"; + } $data .= $it->{data}; } $self->{output} .= $data; Index: lib/Parrot/Pmc2c/Pmc2cMain.pm =================================================================== --- lib/Parrot/Pmc2c/Pmc2cMain.pm (revision 38282) +++ lib/Parrot/Pmc2c/Pmc2cMain.pm (working copy) @@ -20,6 +20,10 @@ use Parrot::Pmc2c::PMC::Null (); use Parrot::Pmc2c::PMC::Object (); +# put the options in a package var so it can be accessed from +# Parrot::Pmc2c::Emitter. +our $OPTIONS; + $SIG{'__WARN__'} = sub { use Carp; warn $_[0]; Carp::confess; }; =head1 NAME @@ -94,6 +98,8 @@ $allargsref->{opt}{$opt} = 0; } } + + $OPTIONS = $allargsref->{opt}; return bless( $allargsref, $class ); }