PATCH: Make gengtype and c-parse.in get along

Ziemowit Laski zlaski@apple.com
Sat Mar 15 00:19:00 GMT 2003


The gengtype (GC/PCH) machinery parses the gcc/c-parse.in
file (among many others), and was successful thus far
due to blind luck.  This is because the 'ifc', 'end ifc',
'ifobjc' and 'end ifobjc' markers (used for extracting
the C and ObjC Yacc files) are lexically indistinguishable
from ordinary identifiers.  So, for example, upon seeing

     :
   %left <ttype> CLASSNAME OBJECTNAME
   end ifobjc
     :

gengtype would (and should!) treat 'end' and 'ifobjc'
as just two more left-associative terminal symbols.

The solution is to make these markers look different from
identifiers, and further to teach gengtype to ignore them.
This patch does just that; as an added bonus, include guards
were added to ggc.h.  :-)

OK for 3.3 and mainline?  I've built both compilers on
powerpc-apple-darwin6.4 without any problems.

Thank you,

--Zem

2003-03-14  Ziemowit Laski  <zlaski@apple.com>

         * Makefile.in (c-parse.y): Change demarcations searched for by 
sed
         from 'ifc', 'end ifc', 'ifobjc' and 'end ifobjc' to '@@ifc',
         '@@end_ifc', '@@ifobjc' and '@@end_ifobjc', respectively.
         * c-parse.in: Likewise.
         * objc/Make-lang.in (objc-parse.y): Likewise.
         * gengtype-lex.l (in_struct): Teach lexer to ignore lines 
starting
         with '@@'.
         * ggc.h: Guard with GCC_GGC_H.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gengtype-3.4.diff
Type: application/octet-stream
Size: 20562 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20030315/d04aa39a/attachment.obj>
-------------- next part --------------

--------------------------------------------------------------
Ziemowit Laski                 1 Infinite Loop, MS 301-2K
Mac OS X Compiler Group        Cupertino, CA USA  95014-2083
Apple Computer, Inc.           +1.408.974.6229  Fax .5477


More information about the Gcc-patches mailing list