Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Applying patch supplied by bsdz in https://trac.parrot.org/parrot/tic…

…ket/577:  add '--no-line-directives' switch to Configure.pl.

git-svn-id: https://svn.parrot.org/parrot/trunk@38414 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
commit a4c21ab800b3241383109ccbc5936ec6adeaf741 1 parent 353d0c6
@jkeenan jkeenan authored
View
5 Configure.pl
@@ -297,6 +297,11 @@ =head2 Compile Options
--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
View
12 config/gen/makefiles/root.in
@@ -618,9 +618,9 @@ $(SRC_DIR)/string/private_cstring.h : $(STR_FILES) $(BUILD_TOOLS_DIR)/c2str.pl
$(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 @@ $(IMCC_DIR)/main$(O) : $(IMCC_DIR)/main.c $(GENERAL_H_FILES) $(IMCC_H_FILES)
$(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 @@ $(OPS_DIR)/core_ops.c : $(OPS_FILES) $(BUILD_TOOLS_DIR)/ops2c.pl \
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 @@ $(OPS_DIR)/core_ops_switch.c : $(OPS_FILES) $(BUILD_TOOLS_DIR)/ops2c.pl \
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@
View
4 config/init/defaults.pm
@@ -239,6 +239,10 @@ sub runstep {
# 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
View
2  lib/Parrot/Configure/Options/Conf.pm
@@ -79,6 +79,8 @@ Compile Options:
--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
View
1  lib/Parrot/Configure/Options/Conf/Shared.pm
@@ -52,6 +52,7 @@ our @shared_valid_options = qw{
maintainer
mandir
nomanicheck
+ no-line-directives
oldincludedir
opcode
ops
View
5 lib/Parrot/Pmc2c/Emitter.pm
@@ -4,6 +4,7 @@ package Parrot::Pmc2c::Emitter;
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 @@ sub annotate_worker {
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;
View
6 lib/Parrot/Pmc2c/Pmc2cMain.pm
@@ -20,6 +20,10 @@ use Parrot::Pmc2c::PMC::default ();
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 @@ sub new {
$allargsref->{opt}{$opt} = 0;
}
}
+
+ $OPTIONS = $allargsref->{opt};
return bless( $allargsref, $class );
}
Please sign in to comment.
Something went wrong with that request. Please try again.