for review: pragma_c_gen.m #line bug fix

Fergus Henderson fjh at cs.mu.oz.au
Tue Jan 6 17:45:16 AEDT 1998


Hi,

Zoltan, do you have a better fix for this in your branch?
If not, I'll commit this.

Estimated hours taken: 0.25

compiler/pragma_c_gen.m:
	Fix a bug with incorrect placement of `#line' directives
	for `may_call_mercury' pragma c_code.

Index: pragma_c_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pragma_c_gen.m,v
retrieving revision 1.10
diff -u -u -r1.10 pragma_c_gen.m
--- pragma_c_gen.m	1997/07/27 15:01:23	1.10
+++ pragma_c_gen.m	1998/01/06 06:41:58
@@ -162,7 +162,12 @@
 		{ Wrapped_C_Code = C_Code }
 	;
 		{ string__append_list([
-				"\tsave_registers();\n{\n",
+				%
+				% N.B. we must not put any newlines before
+				% the C_Code, otherwise it stuffs up the
+				% #line directives
+				%
+				"save_registers(); { ",
 				C_Code, "\n}\n",
 				"#ifndef CONSERVATIVE_GC\n",
 				"\trestore_registers();\n",

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list