Commit c1980f1d authored by simonmar's avatar simonmar
Browse files

[project @ 2002-01-22 13:09:36 by simonmar]

Fix for a change in CPP's behaviour in gcc 2.96 relative to 2.95.
Unlit used to inject '# <line> <file>' at the beginning of the output
file, but in gcc 2.96 this is ignored.  Instead we have to inject
'#line <line> <file>', which in turn means that GHC's lexer has to
understand this kind of pragma in addition to the plain '#' form, in
the case when we aren't running CPP after unlitting.
parent 0da14097
......@@ -455,9 +455,15 @@ lexer cont buf s@(PState{
-- special GHC extension: we grok cpp-style #line pragmas
'#'# | lexemeIndex buf ==# bol -> -- the '#' must be in column 0
case expandWhile# is_space (stepOn buf) of { buf1 ->
if is_digit (currentChar# buf1)
then line_prag next_line buf1 s'
let buf1 | lookAhead# buf 1# `eqChar#` 'l'# &&
lookAhead# buf 2# `eqChar#` 'i'# &&
lookAhead# buf 3# `eqChar#` 'n'# &&
lookAhead# buf 4# `eqChar#` 'e'# = stepOnBy# buf 5#
| otherwise = stepOn buf
in
case expandWhile# is_space buf1 of { buf2 ->
if is_digit (currentChar# buf2)
then line_prag next_line buf2 s'
else is_a_token
}
where
......
......@@ -348,8 +348,8 @@ char **argv; {
}
/* Prefix the output with line pragmas */
if (prefix_str) {
fprintf(ostream, "# 1 \"%s\"\n{-# LINE 1 \"%s\" #-}\n", prefix_str, prefix_str);
if (add_line_prag_long) {
fprintf(ostream, "# 1 \"%s\"\n");{-# LINE 1 \"%s\" #-}\n", prefix_str, prefix_str);
}
unlit(file, istream, ostream);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment