Commit 3da3d587 by Zack Weinberg Committed by Zack Weinberg

re PR c++/18075 (#pragma implementation broken in presence of #pragma ident)

	PR 18075
	* directives.c (do_pragma): Do not defer pragmas which are unknown.
	(cpp_handle_deferred_pragma): Add cast to silence warning.

From-SVN: r89693
parent 12126025
2004-10-27 Zack Weinberg <zack@codesourcery.com>
PR 18075
* directives.c (do_pragma): Do not defer pragmas which are unknown.
(cpp_handle_deferred_pragma): Add cast to silence warning.
2004-10-14 Joseph S. Myers <jsm@polyomino.org.uk> 2004-10-14 Joseph S. Myers <jsm@polyomino.org.uk>
* errors.c (_cpp_begin_message): Print "error: " for errors. * errors.c (_cpp_begin_message): Print "error: " for errors.
......
...@@ -1167,7 +1167,9 @@ do_pragma (cpp_reader *pfile) ...@@ -1167,7 +1167,9 @@ do_pragma (cpp_reader *pfile)
} }
} }
if (p && (p->is_internal || !CPP_OPTION (pfile, defer_pragmas))) if (p)
{
if (p->is_internal || !CPP_OPTION (pfile, defer_pragmas))
{ {
/* Since the handler below doesn't get the line number, that it /* Since the handler below doesn't get the line number, that it
might need for diagnostics, make sure it has the right might need for diagnostics, make sure it has the right
...@@ -1176,9 +1178,10 @@ do_pragma (cpp_reader *pfile) ...@@ -1176,9 +1178,10 @@ do_pragma (cpp_reader *pfile)
(*pfile->cb.line_change) (pfile, pragma_token, false); (*pfile->cb.line_change) (pfile, pragma_token, false);
(*p->u.handler) (pfile); (*p->u.handler) (pfile);
} }
else if (CPP_OPTION (pfile, defer_pragmas)) else
{ {
/* Squirrel away the pragma text. Pragmas are newline-terminated. */ /* Squirrel away the pragma text. Pragmas are
newline-terminated. */
const uchar *line_end; const uchar *line_end;
uchar *s; uchar *s;
cpp_string body; cpp_string body;
...@@ -1199,6 +1202,7 @@ do_pragma (cpp_reader *pfile) ...@@ -1199,6 +1202,7 @@ do_pragma (cpp_reader *pfile)
ptok->flags = pragma_token->flags | NO_EXPAND; ptok->flags = pragma_token->flags | NO_EXPAND;
ptok->val.str = body; ptok->val.str = body;
} }
}
else if (pfile->cb.def_pragma) else if (pfile->cb.def_pragma)
{ {
_cpp_backup_tokens (pfile, count); _cpp_backup_tokens (pfile, count);
...@@ -1428,7 +1432,7 @@ cpp_handle_deferred_pragma (cpp_reader *pfile, const cpp_string *s) ...@@ -1428,7 +1432,7 @@ cpp_handle_deferred_pragma (cpp_reader *pfile, const cpp_string *s)
pfile->cb.line_change = NULL; pfile->cb.line_change = NULL;
CPP_OPTION (pfile, defer_pragmas) = false; CPP_OPTION (pfile, defer_pragmas) = false;
run_directive (pfile, T_PRAGMA, s->text, s->len); run_directive (pfile, T_PRAGMA, (const char *)s->text, s->len);
XDELETE (pfile->context); XDELETE (pfile->context);
pfile->context = saved_context; pfile->context = saved_context;
......
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