This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch]: Add push_macro/pop_macro feature for all targets by moving it from C frontent into libcpp


2009/11/4 Tom Tromey <tromey@redhat.com>:
>>>>>> "Kai" == Kai Tietz <ktietz70@googlemail.com> writes:
>
> Tom> I would prefer that all new errors pass an explicit location.
> Tom> This occurs a couple of times.
>
> Kai> This is didn't got. What you mean here about explicit location? You
> Kai> mean special messages for syntactical errors here?
>
> What I meant is, for a new error, use the cpp_error_with_line function
> and pass in the proper location explicitly. ?Sometimes (I didn't check
> this code) this is not easy, in which case it is ok to skip it.
>
> Kai> -/* Like lex_macro_node, but read the input from STR. ?*/
> Kai> -static cpp_hashnode *
> Kai> -lex_macro_node_from_str (cpp_reader *pfile, const char *str)
>
> What is the rationale for this part of the change?
>
> Kai> -static GTY((param_is (struct def_pragma_macro))) htab_t pushed_macro_table;
>
> Do pushed macros work properly with PCH after this patch?
>
> This is looking pretty good.
>
> Tom
>

I changed the error output from cpp_error to cpp_error_with_line as
you suggested. And it works pretty well.

ChangeLog for libcpp

2009-11-03  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.

ChangeLog for gcc

2009-11-03  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-03  Kai Tietz  <kai.tietz@onevision.com>

	* g++.dg/torture/pushpop_macro.C: New testcase.
	* gcc.c-torture/execute/pushpop_macro.c: New testcase.

Tested for i686-pc-linux, i686-pc-mingw32, and x86_64-pc-mingw32. Ok
for apply to trunk? And possibly a back-merge to 4.4 branch, too?

Cheers,
Kai

-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination

Attachment: mvpushpop.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]