Commit cd98faa1 by Neil Booth Committed by Neil Booth

cpperror.c (cpp_error): Default to directive_line within directives here.

	* cpperror.c (cpp_error): Default to directive_line within
	directives here.
	* cppexp.c (cpp_interpret_integer): Only use traditional
	number semantics in directives.
	* cpplib.c (prepare_directive_trad): Don't reset pfile->line.
	(do_include_common): Similarly.
	* cpptrad.c (scan_out_logical_line): Implement accurate
	quoting of <> in #include.
	* doc/cpp.texi: Update.

From-SVN: r55347
parent 2ad65b0e
2002-07-09 Neil Booth <neil@daikokuya.co.uk>
* cpperror.c (cpp_error): Default to directive_line within
directives here.
* cppexp.c (cpp_interpret_integer): Only use traditional
number semantics in directives.
* cpplib.c (prepare_directive_trad): Don't reset pfile->line.
(do_include_common): Similarly.
* cpptrad.c (scan_out_logical_line): Implement accurate
quoting of <> in #include.
* doc/cpp.texi: Update.
Tue Jul 9 22:37:44 2002 Stephen Clarke <stephen.clarke@superh.com> Tue Jul 9 22:37:44 2002 Stephen Clarke <stephen.clarke@superh.com>
J"orn Rennecke <joern.rennecke@superh.com> J"orn Rennecke <joern.rennecke@superh.com>
......
...@@ -139,7 +139,10 @@ cpp_error VPARAMS ((cpp_reader * pfile, int level, const char *msgid, ...)) ...@@ -139,7 +139,10 @@ cpp_error VPARAMS ((cpp_reader * pfile, int level, const char *msgid, ...))
{ {
if (CPP_OPTION (pfile, traditional)) if (CPP_OPTION (pfile, traditional))
{ {
line = pfile->line; if (pfile->state.in_directive)
line = pfile->directive_line;
else
line = pfile->line;
column = 0; column = 0;
} }
else else
......
...@@ -377,9 +377,11 @@ cpp_interpret_integer (pfile, token, type) ...@@ -377,9 +377,11 @@ cpp_interpret_integer (pfile, token, type)
"integer constant is too large for its type"); "integer constant is too large for its type");
/* If too big to be signed, consider it unsigned. Only warn for /* If too big to be signed, consider it unsigned. Only warn for
decimal numbers. Traditional numbers were always signed (but decimal numbers. Traditional numbers were always signed (but
we still honour an explicit U suffix). */ we still honour an explicit U suffix); but we only have
traditional semantics in directives. */
else if (!result.unsignedp else if (!result.unsignedp
&& !CPP_OPTION (pfile, traditional) && !(CPP_OPTION (pfile, traditional)
&& pfile->state.in_directive)
&& !num_positive (result, precision)) && !num_positive (result, precision))
{ {
if (base == 10) if (base == 10)
......
...@@ -303,9 +303,6 @@ prepare_directive_trad (pfile) ...@@ -303,9 +303,6 @@ prepare_directive_trad (pfile)
pfile->out.cur - pfile->out.base); pfile->out.cur - pfile->out.base);
} }
/* Report diagnostics on the line of the directive. */
pfile->line = pfile->directive_line;
/* Stop ISO C from expanding anything. */ /* Stop ISO C from expanding anything. */
pfile->state.prevent_expansion++; pfile->state.prevent_expansion++;
} }
...@@ -689,10 +686,6 @@ do_include_common (pfile, type) ...@@ -689,10 +686,6 @@ do_include_common (pfile, type)
if (pfile->cb.include) if (pfile->cb.include)
(*pfile->cb.include) (pfile, pfile->directive_line, (*pfile->cb.include) (pfile, pfile->directive_line,
pfile->directive->name, header); pfile->directive->name, header);
/* Revert to the correct line if traditional. */
if (CPP_OPTION (pfile, traditional))
pfile->line = pfile->saved_line;
_cpp_execute_include (pfile, header, type); _cpp_execute_include (pfile, header, type);
} }
} }
......
...@@ -437,11 +437,13 @@ scan_out_logical_line (pfile, macro) ...@@ -437,11 +437,13 @@ scan_out_logical_line (pfile, macro)
struct fun_macro fmacro; struct fun_macro fmacro;
unsigned int c, paren_depth = 0, quote; unsigned int c, paren_depth = 0, quote;
enum ls lex_state = ls_none; enum ls lex_state = ls_none;
bool header_ok;
fmacro.buff = NULL; fmacro.buff = NULL;
start_logical_line: start_logical_line:
quote = 0; quote = 0;
header_ok = pfile->state.angled_headers;
CUR (pfile->context) = pfile->buffer->cur; CUR (pfile->context) = pfile->buffer->cur;
RLIMIT (pfile->context) = pfile->buffer->rlimit; RLIMIT (pfile->context) = pfile->buffer->rlimit;
pfile->out.cur = pfile->out.base; pfile->out.cur = pfile->out.base;
...@@ -500,15 +502,12 @@ scan_out_logical_line (pfile, macro) ...@@ -500,15 +502,12 @@ scan_out_logical_line (pfile, macro)
goto done; goto done;
case '<': case '<':
if (pfile->state.angled_headers && !quote) if (header_ok)
quote = '>'; quote = '>';
break; break;
case '>': case '>':
if (c == quote) if (c == quote)
{ quote = 0;
pfile->state.angled_headers = false;
quote = 0;
}
break; break;
case '"': case '"':
...@@ -736,7 +735,9 @@ scan_out_logical_line (pfile, macro) ...@@ -736,7 +735,9 @@ scan_out_logical_line (pfile, macro)
break; break;
} }
/* Non-whitespace disables MI optimization. */ /* Non-whitespace disables MI optimization and stops treating
'<' as a quote in #include. */
header_ok = false;
if (!pfile->state.in_directive) if (!pfile->state.in_directive)
pfile->mi_valid = false; pfile->mi_valid = false;
......
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