ChangeLog for libcpp
2009-11-11 Kai Tietz <kai.tietz@onevision.com> * directives.c (do_pragma_push_macro): New pragma handler. (do_pragma_pop_macro): Likewise. (_cpp_init_internal_pragmas): Add push_macro and pop_macro handler to internal pragmas. (lex_macro_node_from_str): Removed. (cpp_push_definition): Replace lex_macro_node_from_str by _cpp_lex_identifier. (cpp_pop_definition): Likewise. * internal.h (_cpp_lex_identifier): New prototype. (def_pragma_macro): New structure. (cpp_reader): New member pushed_macros. * lex.c (_cpp_lex_identifier): New function. (lex_identifier_intern): New function. * init.c (cpp_create_reader): Initialize pushed_macros member. (cpp_destroy): Free elements in pushed_macros member. * pch.c (_cpp_save_pushed_macros): New function. (_cpp_restore_pushed_macros): Likewise. (_cpp_restore_pushed_macros): Use _cpp_save_pushed_macros. (cpp_read_state): Use _cpp_restore_pushed_macros. ChangeLog for gcc 2009-11-11 Kai Tietz <kai.tietz@onevision.com> * config/i386/cygming.h (HANDLE_PRAGMA_PUSH_POP_MACRO): Removed. * c-pragma.c (def_pragma_macro_value): Likewise. (def_pragma_macro): Likewise. (pushed_macro_table): Likewise. (HANDLE_PRAGMA_PUSH_POP_MACRO): Remove guarded code. * doc/tm.texi (HANDLE_PRAGMA_PUSH_POP_MACRO): Removed. ChangeLog for gcc/testsuite 2009-11-11 Kai Tietz <kai.tietz@onevision.com> * g++.dg/torture/pushpop_macro.C: New testcase. * gcc.c-torture/execute/pushpop_macro.c: New testcase. * gcc.dg/cpp/pragma-pop_macro-1.c: Allow test for all targets. From-SVN: r154098
This commit is contained in:
parent
110532c838
commit
17e7cb8550
16 changed files with 411 additions and 177 deletions
|
@ -216,6 +216,9 @@ cpp_create_reader (enum c_lang lang, hash_table *table,
|
|||
pfile->a_buff = _cpp_get_buff (pfile, 0);
|
||||
pfile->u_buff = _cpp_get_buff (pfile, 0);
|
||||
|
||||
/* Initialize table for push_macro/pop_macro. */
|
||||
pfile->pushed_macros = 0;
|
||||
|
||||
/* The expression parser stack. */
|
||||
_cpp_expand_op_stack (pfile);
|
||||
|
||||
|
@ -245,6 +248,7 @@ void
|
|||
cpp_destroy (cpp_reader *pfile)
|
||||
{
|
||||
cpp_context *context, *contextn;
|
||||
struct def_pragma_macro *pmacro;
|
||||
tokenrun *run, *runn;
|
||||
int i;
|
||||
|
||||
|
@ -296,6 +300,17 @@ cpp_destroy (cpp_reader *pfile)
|
|||
|
||||
free (pfile->comments.entries);
|
||||
}
|
||||
if (pfile->pushed_macros)
|
||||
{
|
||||
do
|
||||
{
|
||||
pmacro = pfile->pushed_macros;
|
||||
pfile->pushed_macros = pmacro->next;
|
||||
free (pmacro->name);
|
||||
free (pmacro);
|
||||
}
|
||||
while (pfile->pushed_macros);
|
||||
}
|
||||
|
||||
free (pfile);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue