diff options
author | geoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-09 20:10:13 +0000 |
---|---|---|
committer | geoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-06-09 20:10:13 +0000 |
commit | c39ed964c8cd9aec2fe6060830804416b0856b60 (patch) | |
tree | 1238be7fc80d74d8323d5f6c4344a6bb2be0f854 /libcpp/directives.c | |
parent | f5efe504032463d907b2eb0f4f76a5d68ce45429 (diff) | |
download | gcc-c39ed964c8cd9aec2fe6060830804416b0856b60.tar.gz |
Index: gcc/ChangeLog
2004-06-09 Geoffrey Keating <geoffk@apple.com>
* Makefile.in (CPPLIB_H): Put files in order of inclusion.
(CPP_ID_DATA_H): New.
(gtype-desc.o): Update dependencies.
(GTFILES): Use CPP_ID_DATA_H.
Index: gcc/testsuite/ChangeLog
2004-06-09 Geoffrey Keating <geoffk@apple.com>
* gcc.dg/pch/macro-4.c: New.
* gcc.dg/pch/macro-4.hs: New.
Index: libcpp/ChangeLog
2004-06-09 Geoffrey Keating <geoffk@apple.com>
* traditional.c (push_replacement_text): Set macro->traditional.
(save_replacement_text): Likewise.
* pch.c (cpp_write_pch_state): Don't write list of defined macros.
(struct save_macro_item): Delete.
(struct save_macro_data): Use a character array not the previous
structured format.
(save_macros): Save macro as text not as internal structures.
(cpp_prepare_state): Update for changes to save_macro_data.
(cpp_read_state): Don't read macros defined in PCH. Restore
-D macros as text.
* macro.c (create_iso_definition): Honour alloc_subobject.
Clear traditional flag.
(_cpp_create_definition): Honour alloc_subobject.
* lex.c (cpp_token_val_index): New.
* internal.h: Include cpp-id-data.h.
(uchar): Move definition to cpp-id-data.h.
(U): Likewise.
(cpp_macro): Likewise.
* directives.c (struct answer): Move to cpp-id-data.h.
(do_assert): Honour alloc_subobject.
Index: libcpp/include/ChangeLog
2004-06-09 Geoffrey Keating <geoffk@apple.com>
* symtab.h (struct ht): Add field 'alloc_subobject'.
* cpplib.h (struct cpp_string): Add GTY marker.
(enum cpp_token_fld_kind): New.
(struct cpp_token): Add GTY markers.
(cpp_token_val_index): Prototype.
(CPP_HASHNODE_VALUE_IDX): New.
(struct cpp_hashnode): Don't skip fields of 'value' when marking.
* cpp-id-data.h: New file.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@82851 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp/directives.c')
-rw-r--r-- | libcpp/directives.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/libcpp/directives.c b/libcpp/directives.c index 5a6a342bea5..16873dadecf 100644 --- a/libcpp/directives.c +++ b/libcpp/directives.c @@ -26,14 +26,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "mkdeps.h" #include "obstack.h" -/* Chained list of answers to an assertion. */ -struct answer -{ - struct answer *next; - unsigned int count; - cpp_token first[1]; -}; - /* Stack of conditionals currently in progress (including both successful and failing conditionals). */ struct if_stack @@ -1727,6 +1719,8 @@ do_assert (cpp_reader *pfile) node = parse_assertion (pfile, &new_answer, T_ASSERT); if (node) { + size_t answer_size; + /* Place the new answer in the answer list. First check there is not a duplicate. */ new_answer->next = 0; @@ -1741,11 +1735,20 @@ do_assert (cpp_reader *pfile) new_answer->next = node->value.answers; } + answer_size = sizeof (struct answer) + ((new_answer->count - 1) + * sizeof (cpp_token)); + /* Commit or allocate storage for the object. */ + if (pfile->hash_table->alloc_subobject) + { + struct answer *temp_answer = new_answer; + new_answer = pfile->hash_table->alloc_subobject (answer_size); + memcpy (new_answer, temp_answer, answer_size); + } + else + BUFF_FRONT (pfile->a_buff) += answer_size; + node->type = NT_ASSERTION; node->value.answers = new_answer; - BUFF_FRONT (pfile->a_buff) += (sizeof (struct answer) - + (new_answer->count - 1) - * sizeof (cpp_token)); check_eol (pfile); } } |