[pph] Remove code to handle lexing from arbitrary offsets (issue4078044)

dnovillo@google.com dnovillo@google.com
Fri Jan 28 00:43:00 GMT 2011


Reviewers: crowl_google.com,

Description:
This patch removes the code that used to handle mixing token hunks
coming from text files with those coming from images.  This simplifies
some of the logic since the idea is to only tolerate header files
that can be completely converted into images.

In addition, it XFAILs 3 tests that are currently triggering this
error.  Lawrence, I believe these are due to the hunk verifier getting
somehow confuesd by __need_size_t in /usr/include/sys/types.h.  I've
looked at the failure with -fpth-debug=1 and I don't see why it
gets confused.  It's expecting __need_size_t to *not* be defined, but
it is defined by the file a few lines above the failure:


[ ... /usr/include/sys/types.h ... ]
...
#define	__need_size_t
#include <stddef.h>

#ifdef __USE_MISC
/* Old compatibility names for C types.  */
typedef unsigned long int ulong;
typedef unsigned short int ushort;
typedef unsigned int uint;
#endif
...

The hunk starting with 'typedef unsigned long int ulong' fails with

PTH: _usr_include_sys_types_h.pth failed verification: __need_size_t :
<__need_size_t > -> <(null)>
/home/dnovillo/pph/src/gcc/testsuite/g++.dg/pph/mean.cc:1:0: fatal
error: Found an invalid hunk in /usr/include/sys/types.h.  This header
file cannot be converted into a pre-parsed image.

To reproduce, do 'make check-g++ RUNTESTFLAGS=pph.exp' and search for
'^XFAIL' in testsuite/g++/g++.log, that will give you the command line
to reproduce the failure.

No failures other than those.  Tested on x86_64.


Diego.

libcpp/ChangeLog.pph

2011-01-27  Diego Novillo  <dnovillo@google.com>

	* include/cpplib.h (cpp_reset_lexer_state,
	cpp_restore_lexer_state): Remove.
	* lex.c: Likewise.
	Update all users.


gcc/cp/ChangeLog.pph

2011-01-27  Diego Novillo  <dnovillo@google.com>

	* Make-lang.in (cp/parser.o): Fix dependencies.
	* pph.c (pth_process_text_file): Do not try to start reading the file
	at an arbitrary offset.
	Remove OFFSET argument.  Update all users.
	(pth_image_to_lexer): Emit a fatal error if a hunk fails
	validation.
	(pth_lexer_to_image):
	(pth_enter_file):
	* pph.h	(struct cp_token_hunk): Remove fields text_offset and
	text_length.
	Update all users.
	(struct pth_image): Remove field hunk_text_offset.
	Update all users.


testsuite/ChangeLog.pph

2011-01-27  Diego Novillo  <dnovillo@google.com>

	* g++.dg/pph/system-include.cc: xfail for invalid hunks.
	* g++.dg/pph/mean.cc: Likewise.
	* g++.dg/pph/sys-types.cc: Likewise.
	* g++.dg/pph/variables.cc: Fix error about initializing an
	extern.



Please review this at http://codereview.appspot.com/4078044/

Affected files:
   M     gcc/cp/Make-lang.in
   M     gcc/cp/pph.c
   M     gcc/cp/pph.h
   M     gcc/testsuite/g++.dg/pph/mean.cc
   M     gcc/testsuite/g++.dg/pph/sys-types.cc
   M     gcc/testsuite/g++.dg/pph/system-include.cc
   M     gcc/testsuite/g++.dg/pph/variables.cc
   M     libcpp/include/cpplib.h
   M     libcpp/lex.c




More information about the Gcc-patches mailing list