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
This commit is contained in:
parent
121260258c
commit
3da3d587c5
2 changed files with 38 additions and 28 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
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,37 +1167,41 @@ do_pragma (cpp_reader *pfile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p && (p->is_internal || !CPP_OPTION (pfile, defer_pragmas)))
|
if (p)
|
||||||
{
|
{
|
||||||
/* Since the handler below doesn't get the line number, that it
|
if (p->is_internal || !CPP_OPTION (pfile, defer_pragmas))
|
||||||
might need for diagnostics, make sure it has the right
|
{
|
||||||
numbers in place. */
|
/* Since the handler below doesn't get the line number, that it
|
||||||
if (pfile->cb.line_change)
|
might need for diagnostics, make sure it has the right
|
||||||
(*pfile->cb.line_change) (pfile, pragma_token, false);
|
numbers in place. */
|
||||||
(*p->u.handler) (pfile);
|
if (pfile->cb.line_change)
|
||||||
}
|
(*pfile->cb.line_change) (pfile, pragma_token, false);
|
||||||
else if (CPP_OPTION (pfile, defer_pragmas))
|
(*p->u.handler) (pfile);
|
||||||
{
|
}
|
||||||
/* Squirrel away the pragma text. Pragmas are newline-terminated. */
|
else
|
||||||
const uchar *line_end;
|
{
|
||||||
uchar *s;
|
/* Squirrel away the pragma text. Pragmas are
|
||||||
cpp_string body;
|
newline-terminated. */
|
||||||
cpp_token *ptok;
|
const uchar *line_end;
|
||||||
|
uchar *s;
|
||||||
|
cpp_string body;
|
||||||
|
cpp_token *ptok;
|
||||||
|
|
||||||
line_end = ustrchr (line_start, '\n');
|
line_end = ustrchr (line_start, '\n');
|
||||||
|
|
||||||
body.len = (line_end - line_start) + 1;
|
body.len = (line_end - line_start) + 1;
|
||||||
s = _cpp_unaligned_alloc (pfile, body.len + 1);
|
s = _cpp_unaligned_alloc (pfile, body.len + 1);
|
||||||
memcpy (s, line_start, body.len);
|
memcpy (s, line_start, body.len);
|
||||||
s[body.len] = '\0';
|
s[body.len] = '\0';
|
||||||
body.text = s;
|
body.text = s;
|
||||||
|
|
||||||
/* Create a CPP_PRAGMA token. */
|
/* Create a CPP_PRAGMA token. */
|
||||||
ptok = &pfile->directive_result;
|
ptok = &pfile->directive_result;
|
||||||
ptok->src_loc = pragma_token->src_loc;
|
ptok->src_loc = pragma_token->src_loc;
|
||||||
ptok->type = CPP_PRAGMA;
|
ptok->type = CPP_PRAGMA;
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue