[svn:parrot] r38414 - in trunk: . config/gen/makefiles config/init lib/Parrot/Configure/Options lib/Parrot/Configure/Options/Conf lib/Parrot/Pmc2c

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Thu Apr 30 11:22:23 UTC 2009


Author: jkeenan
Date: Thu Apr 30 11:22:20 2009
New Revision: 38414
URL: https://trac.parrot.org/parrot/changeset/38414

Log:
Applying patch supplied by bsdz in https://trac.parrot.org/parrot/ticket/577:  add '--no-line-directives' switch to Configure.pl.

Modified:
   trunk/Configure.pl
   trunk/config/gen/makefiles/root.in
   trunk/config/init/defaults.pm
   trunk/lib/Parrot/Configure/Options/Conf.pm
   trunk/lib/Parrot/Configure/Options/Conf/Shared.pm
   trunk/lib/Parrot/Pmc2c/Emitter.pm
   trunk/lib/Parrot/Pmc2c/Pmc2cMain.pm

Modified: trunk/Configure.pl
==============================================================================
--- trunk/Configure.pl	Thu Apr 30 06:40:56 2009	(r38413)
+++ trunk/Configure.pl	Thu Apr 30 11:22:20 2009	(r38414)
@@ -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

Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in	Thu Apr 30 06:40:56 2009	(r38413)
+++ trunk/config/gen/makefiles/root.in	Thu Apr 30 11:22:20 2009	(r38414)
@@ -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@
 

Modified: trunk/config/init/defaults.pm
==============================================================================
--- trunk/config/init/defaults.pm	Thu Apr 30 06:40:56 2009	(r38413)
+++ trunk/config/init/defaults.pm	Thu Apr 30 11:22:20 2009	(r38414)
@@ -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

Modified: trunk/lib/Parrot/Configure/Options/Conf.pm
==============================================================================
--- trunk/lib/Parrot/Configure/Options/Conf.pm	Thu Apr 30 06:40:56 2009	(r38413)
+++ trunk/lib/Parrot/Configure/Options/Conf.pm	Thu Apr 30 11:22:20 2009	(r38414)
@@ -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
 

Modified: trunk/lib/Parrot/Configure/Options/Conf/Shared.pm
==============================================================================
--- trunk/lib/Parrot/Configure/Options/Conf/Shared.pm	Thu Apr 30 06:40:56 2009	(r38413)
+++ trunk/lib/Parrot/Configure/Options/Conf/Shared.pm	Thu Apr 30 11:22:20 2009	(r38414)
@@ -52,6 +52,7 @@
     maintainer
     mandir
     nomanicheck
+    no-line-directives
     oldincludedir
     opcode
     ops

Modified: trunk/lib/Parrot/Pmc2c/Emitter.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/Emitter.pm	Thu Apr 30 06:40:56 2009	(r38413)
+++ trunk/lib/Parrot/Pmc2c/Emitter.pm	Thu Apr 30 11:22:20 2009	(r38414)
@@ -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;

Modified: trunk/lib/Parrot/Pmc2c/Pmc2cMain.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/Pmc2cMain.pm	Thu Apr 30 06:40:56 2009	(r38413)
+++ trunk/lib/Parrot/Pmc2c/Pmc2cMain.pm	Thu Apr 30 11:22:20 2009	(r38414)
@@ -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 );
 }


More information about the parrot-commits mailing list