Go to file
Diego Novillo 313465bbbd Add more C++ support in gengtype.
This patch combines the changes from
http://gcc.gnu.org/ml/gcc-patches/2012-08/msg02016.html with other
additions to support C++ inside GTY'd structures.

The main changes wrt Aaron's original patch are:

- Support for function declarations inside classes.

- Support scoping in identifiers.  This does not mean that gengtype
  supports scopes, it just knows that 'Foo::id' is a single entity.

- Explicit non-support for typedef and enum inside class/struct.
  Since gengtype does not really know about scopes, it cannot
  understand these types, but it knows enough to recognize and reject
  them.  GTY'd struct/class that need to typedef their own types
  should use GTY((user)).

- Documentation on what is and is not supported.

There is one check I needed to remove that gave me some trouble.
When a ctor is detected, we have already parsed the name of the
ctor as a type, which is then registered in the list of structures.

We go on to recognize it as a ctor *after* the type has been
registered.  We reject the field in declarator() and it is never
added to the list of fields for the class.

However, when we reach the end of the class, we find that the
type we created while parsing the ctor has line number
information in it (the line where the ctor was) and gengtype
thinks that it is a duplicate structure definition.

I took out this check for two reasons: (a) It is actually
unnecessary because if there were really duplicate definitions of
this structure, the code would not compile, and (b) all the other
alternatives required making the parser much more convoluted and
I'm trying hard not to make gengtype parser too smart.

2012-10-12  Aaron Gray <aaronngray.lists@gmail.com>
	    Diego Novillo <dnovillo@google.com>

        * gengtype-lex.l: Support for C++ single line comments.
        Support for classes.
	(CXX_KEYWORD): New.  Support C++ keywords inline, public,
	protected, private, template, operator, friend, &, ~.
	(TYPEDEF): New.  Support typedef.
        * gengtype-parser.c: updated 'token_names[]'
        (direct_declarator): Add support for parsing functions
	and ctors.

2012-10-12  Diego Novillo  <dnovillo@google.com>

	* doc/gty.texi: Document C++ limitations in gengtype.
	* gengtype-lex.l (CID): Rename from ID.
	(ID): Include scoping '::' as part of the identifier name.
	* gengtype-parse.c (token_names): Update.
	(token_value_format): Update.
	(consume_until_eos): Rename from consume_until_semi.
	Remove unused argument IMMEDIATE.  Update all callers.
	Also consider '}' as a finalizer.
	(consume_until_comma_or_eos): Rename from
	consume_until_comma_or_semi.
	Remove unused argument IMMEDIATE.  Update all callers.
	Also consider '}' as a finalizer.
	(direct_declarator): Add documentation on ctor support.
	Add argument IN_STRUCT.
	If the token following ID is a '(', consider ID a
	function and return NULL.
	If the token following '(' is not a '*', and IN_STRUCT is
	true, conclude that this is a ctor and return NULL.
	If the token is IGNORABLE_CXX_KEYWORD, return NULL.
	(inner_declarator): Add argument IN_STRUCT.
	Update all callers.
	(declarator): Add argument IN_STRUCT with default value
	false.  Update all callers.
	(type): Document argument NESTED.
	Skip over C++ inheritance specifiers.
	If a token TYPEDEF is found, emit an error.
	If an enum is found inside a class/structure, emit an
	error.
	(typedefs, structures, param_structs, variables): Initialize.
	(new_structure): Do not complain about duplicate
	structures if S has a line location set.
	* gengtype-state.c (write_state_type): Remove default
	handler.  Add handler for TYPE_NONE.
	(read_state_scalar_char_type):
	* gengtype.c: Fix spacing.
	* gengtype.h (enum gty_token): Add name.  Add token
	IGNORABLE_CXX_KEYWORD.

From-SVN: r192405
2012-10-12 11:17:17 -04:00
INSTALL README: Also refer to the online installation instructions. 2012-08-25 20:48:20 +00:00
boehm-gc * configure: Regenerated. 2012-09-14 19:25:07 -04:00
config mt-sde: Change -mcode-xonly to -mcode-readable=pcrel. 2012-09-19 20:42:01 +00:00
contrib x86_64-unknown-linux-gnu.xfail: Update. 2012-10-06 13:44:39 -04:00
fixincludes inclhack.def (AAB_aix_fcntl): New fix. 2012-09-29 17:02:42 -04:00
gcc Add more C++ support in gengtype. 2012-10-12 11:17:17 -04:00
gnattools Remove obsolete IRIX 6.5 support 2012-03-14 16:33:37 +00:00
include Allow dynamic initialization of thread_locals. 2012-10-08 10:45:37 -04:00
intl
libada Makefile.in (GNATLIBCFLAGS_FOR_C): Remove $(PIC_FLAG_FOR_TARGET). 2012-06-11 15:24:12 +00:00
libatomic re PR other/43620 ([4.3 Release Blocker] Uploading to gnu.org will fail due to automake security issue) 2012-09-20 16:41:17 +02:00
libbacktrace configure.ac: Do not use dl_iterate_phdr on Solaris 10. 2012-10-11 16:43:47 +00:00
libcpp Implement #pragma GCC warning/error 2012-10-04 17:33:11 +02:00
libdecnumber warnings.m4 (ACX_PROG_CC_WARNING_OPTS): Avoid leading dash in expr call. 2011-12-20 16:54:12 +00:00
libffi * configure: Regenerated. 2012-09-14 19:31:56 -04:00
libgcc sfp-exceptions.c (__sfp_handle_exceptions): Emit SSE instructions for 64bit targets only. 2012-10-11 13:44:51 +02:00
libgfortran re PR fortran/54878 (libgfortran issues found by the Coverity scanner) 2012-10-10 20:42:34 +02:00
libgo runtime: Fix __go_symbol_value val argument to backtrace_syminfo. 2012-10-08 04:29:47 +00:00
libgomp Allow dynamic initialization of thread_locals. 2012-10-08 10:45:37 -04:00
libiberty Allow dynamic initialization of thread_locals. 2012-10-08 10:45:37 -04:00
libitm target.h (struct gtm_jmpbuf): Merge x86_64 and ia32 declarations some more. 2012-10-02 09:50:36 +02:00
libjava tree-eh.c (goto_queue_node): New field. 2012-09-15 00:41:53 +00:00
libmudflap * configure: Regenerated. 2012-09-14 19:37:57 -04:00
libobjc * configure: Regenerated. 2012-09-14 19:38:45 -04:00
libquadmath * configure: Regenerated. 2012-09-14 19:39:34 -04:00
libssp * configure: Regenerated. 2012-09-14 19:40:25 -04:00
libstdc++-v3 Forgot the CL entry for the Hoyt and arcsine distributions. 2012-10-12 15:16:29 +00:00
lto-plugin * configure: Regenerated. 2012-09-14 19:42:24 -04:00
maintainer-scripts crontab: Disable snapshots from gcc-4_5-branch. 2012-07-02 09:16:29 +00:00
zlib * configure: Regenerated. 2012-09-14 19:43:33 -04:00
ABOUT-NLS
COPYING
COPYING.LIB
COPYING.RUNTIME
COPYING3
COPYING3.LIB
ChangeLog Revert r192297. 2012-10-12 10:57:06 +00:00
ChangeLog.tree-ssa
MAINTAINERS MAINTAINERS: Adjust for changed surename. 2012-10-10 08:50:20 +00:00
Makefile.def libgo: Use libbacktrace rather than debug/elf registration. 2012-09-28 14:48:30 +00:00
Makefile.in libgo: Use libbacktrace rather than debug/elf registration. 2012-09-28 14:48:30 +00:00
Makefile.tpl backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... 2012-08-14 21:56:07 -04:00
README * README: Document use of ranges of years in copyright notices. 2012-07-16 15:01:34 +01:00
compile
config-ml.in MAINTAINERS (crx port, [...]): Remove. 2011-03-22 19:58:18 +00:00
config.guess oops - omitted from previous delta. 2011-06-06 10:34:35 +00:00
config.rpath Remove freebsd1 from libtool.m4 macros and config.rpath. 2011-02-13 11:45:53 +00:00
config.sub Update config.sub to 2012-04-18 version from official repo. 2012-04-25 15:48:28 +00:00
configure Add tilegx to list of targets that support gold. 2012-09-20 19:17:51 +00:00
configure.ac Add tilegx to list of targets that support gold. 2012-09-20 19:17:51 +00:00
depcomp
install-sh
libtool-ldflags
libtool.m4 re PR bootstrap/38607 (AIX error messages about TOC during build) 2012-09-14 19:23:41 -04:00
ltgcc.m4
ltmain.sh backport: ltmain.sh (relink): Use absolute path when hardcoding with -L. 2011-01-13 18:51:10 +00:00
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
missing
mkdep
mkinstalldirs
move-if-change Import move-if-change script from gnulib. 2011-02-12 15:48:30 +00:00
symlink-tree
ylwrap

README

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.