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 for C++ bug 24009


Joseph S. Myers wrote:

2006-08-25 Joseph S. Myers <joseph@codesourcery.com>

	PR c++/24009
	* input.h (restore_input_file_stack): Declare.
	* toplev.c (fs_p, input_file_stack_history,
	input_file_stack_restored, restore_input_file_stack): New.
	(push_srcloc, pop_srcloc): Check for input_file_stack_tick
	overflowing 31 bits.  Save new state of stack.
	(pop_srcloc): Don't free old state of stack.

cp:
2006-08-25  Joseph S. Myers  <joseph@codesourcery.com>

	PR c++/24009
	* parser.c (struct cp_token): Add input_file_stack_index.
	(eof_token): Update.
	(cp_lexer_get_preprocessor_token): Save input_file_stack_tick.
	(cp_lexer_set_source_position_from_token): Restore input file
	stack.

Thank you for addressing this issue!


This is OK.

I think the comments about arbitrary limits are specious; as you say, the compiler is full of assumptions about host integers not overflowing. When someone runs into the sorry, we'll figure out what to do.

+  /* The input file stack index at which this token was found.  */
+  unsigned input_file_stack_index : 31;

I do think it would be better if you would use a macro for "31", which you could then also use in the test above the sorry, thereby avoiding two not-entirely-obviously related magic numbers. Please make this change, and check in.


Thanks,

--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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