[m-rev.] diff: fix #line bug
Fergus Henderson
fjh at cs.mu.OZ.AU
Sat Mar 15 03:41:26 AEDT 2003
Estimated hours taken: 0.5
Branches: main
compiler/c_util.m:
Change set_line_num so that if we do not have a valid context,
it calls reset_line_num.
Previous it would just not emit any #line directive, but that is wrong,
because it causes the C compiler to assume that such lines come from
the next line in the source file after wherever the previous line
in the C file came from. This is incorrect and can lead to confusing
results.
Workspace: /home/ceres/fjh/mercury
Index: compiler/c_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/c_util.m,v
retrieving revision 1.12
diff -u -d -r1.12 c_util.m
--- compiler/c_util.m 24 Nov 2002 03:57:22 -0000 1.12
+++ compiler/c_util.m 14 Mar 2003 15:48:44 -0000
@@ -147,16 +147,19 @@
c_util__set_line_num(File, Line) -->
globals__io_lookup_bool_option(line_numbers, LineNumbers),
- (
- { Line > 0 },
- { File \= "" },
- { LineNumbers = yes }
- ->
- io__write_string("#line "),
- io__write_int(Line),
- io__write_string(" """),
- c_util__output_quoted_string(File),
- io__write_string("""\n")
+ ( { LineNumbers = yes } ->
+ (
+ { Line > 0 },
+ { File \= "" }
+ ->
+ io__write_string("#line "),
+ io__write_int(Line),
+ io__write_string(" """),
+ c_util__output_quoted_string(File),
+ io__write_string("""\n")
+ ;
+ c_util__reset_line_num
+ )
;
[]
).
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list