From a17aa0baf3e31479e34744e42d2ed893d387063f Mon Sep 17 00:00:00 2001
From: partain <unknown>
Date: Tue, 13 Jun 2000 15:35:29 +0000
Subject: [PATCH] [project @ 2000-06-13 15:35:29 by partain] Alleged
 post-Sansom 0.27+ code

---
 ghc/driver/split/ghc-split.lprl | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/ghc/driver/split/ghc-split.lprl b/ghc/driver/split/ghc-split.lprl
index 267315c344b2..00c116e314ed 100644
--- a/ghc/driver/split/ghc-split.lprl
+++ b/ghc/driver/split/ghc-split.lprl
@@ -24,10 +24,14 @@ sub inject_split_markers {
 	$_ = <TMPI>;
     }
     print TMPO "__STG_SPLIT_MARKER(1)\n";
-    print TMPO $_ if ! /\/\* SPLIT \*\//;
+    print TMPO $_ if ! /^\s*\/\* SPLIT \*\/\s*$/;
+
+	# Have to be a bit careful detecting /* SPLIT */ comments
+	# since a progam may use a string containing "/* SPLIT */"
+	# We check that there is nothing else on the line
 
     while (<TMPI>) {
-	if (/\/\* SPLIT \*\//) {
+	if (/^\s*\/\* SPLIT \*\/\s*$/) {
 	    $marker_no++;
 	    print TMPO "__STG_SPLIT_MARKER($marker_no)\n";
  	    next;
@@ -195,7 +199,7 @@ sub process_asm_block_sparc {
     $str =~ s/^\.stabs "(ghc\d+\.c)"/.stabs "$ifile_root.hc"/g; # HACK HACK
 
     # remove/record any literal constants defined here
-    while ( $str =~ /(\t\.align .\n(LC\d+):\n\t\.ascii.*\n)/ ) {
+    while ( $str =~ /(\t\.align .\n(LC\d+):\n(\t\.ascii.*\n)+)/ ) {
 	local($label) = $2;
 	local($body)  = $1;
 
@@ -204,7 +208,7 @@ sub process_asm_block_sparc {
 
 	$LocalConstant{$label} = $body;
 	
-	$str =~ s/\t\.align .\nLC\d+:\n\t\.ascii.*\n//;
+	$str =~ s/\t\.align .\nLC\d+:\n(\t\.ascii.*\n)+//;
     }
 
     # inject definitions for any local constants now used herein
-- 
GitLab