aboutsummaryrefslogtreecommitdiff
path: root/gcc/gengtype.h
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2007-03-26 21:18:43 +0000
committerZack Weinberg <zackw@panix.com>2007-03-26 21:18:43 +0000
commit4930cda2e5c69994bfd244e7dec7c1af52bd077f (patch)
tree92672610b9effb039afa4b4273d36d385aff54d8 /gcc/gengtype.h
parent587d2c0ac497c5c420f4b44d446f2ffd2b0a26c7 (diff)
* gengtype-parse.c: New file.
* gengtype-yacc.y: Delete. * gengtype-lex.l: Don't include gengtype-yacc.h. Define YY_DECL and yyterminate appropriately for recursive descent parser. yylval is now a string out-parameter to yylex. (HWS, EOID): New shorthand. (IWORD): Add a couple more types. (yylex): Add a setup stanza. Remove the complex rules for detecting GTY'ed types and typedefs; replace with simple keyword detectors. Adjust everything for the changed definition of yylval. Ignore all pp-directives, not just #define. (yyerror): Delete. (parse_file): Rename yybegin; do not call yyparse. (yyend): New. * gengtype.c (xasprintf): Export again. (this_file): New. Use everywhere __FILE__ was being used. (get_lang_bitmap): Special case types defined in gengtype.c. (do_typedef, new_structure): Suppress definition of certain types. (new_structure): Improve diagnostics of duplicate definitions. Make sure location_s is associated with input.h. (nreverse_pairs, define_location_structures): New functions. (main): Improve tagging of kludge types. Remove old kludges for input.h types; use define_location_structures. * gengtype.h: Update prototypes. Define token codes here. * Makefile.in: Remove all references to gengtype-yacc. Add rules for gengtype-parse.o. Adjust rules for gengtype-lex.o and gengtype. * bitmap.h (struct bitmap_head_def): Coalesce definitions, add GTY((skip)) to the field that's only conditionally there. * doc/install.texi: Document that Bison is no longer required unless building treelang. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@123235 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gengtype.h')
-rw-r--r--gcc/gengtype.h47
1 files changed, 43 insertions, 4 deletions
diff --git a/gcc/gengtype.h b/gcc/gengtype.h
index 345d80d9022..a23e2778e93 100644
--- a/gcc/gengtype.h
+++ b/gcc/gengtype.h
@@ -41,6 +41,9 @@ extern struct fileloc lexer_line;
extern void error_at_line
(struct fileloc *pos, const char *msg, ...) ATTRIBUTE_PRINTF_2;
+/* Like asprintf, but calls fatal() on out of memory. */
+extern char *xasprintf(const char *, ...) ATTRIBUTE_PRINTF_1;
+
/* Constructor routines for types. */
extern void do_typedef (const char *s, type_p t, struct fileloc *pos);
extern void do_scalar_typedef (const char *s, struct fileloc *pos);
@@ -57,6 +60,7 @@ extern options_p create_nested_ptr_option (options_p, type_p t,
const char *from, const char *to);
extern pair_p create_field_at (pair_p next, type_p type, const char *name,
options_p opt, struct fileloc *pos);
+extern pair_p nreverse_pairs (pair_p list);
extern type_p adjust_field_type (type_p, options_p);
extern void note_variable (const char *s, type_p t, options_p o,
struct fileloc *pos);
@@ -65,10 +69,45 @@ extern void note_def_vec (const char *typename, bool is_scalar,
extern void note_def_vec_alloc (const char *type, const char *astrat,
struct fileloc *pos);
-/* Lexer and parser routines, most automatically generated. */
-extern int yylex (void);
-extern void yyerror (const char *);
-extern int yyparse (void);
+/* Lexer and parser routines. */
+extern int yylex (const char **yylval);
+extern void yybegin (const char *fname);
+extern void yyend (void);
extern void parse_file (const char *name);
+extern bool hit_error;
+
+/* Token codes. */
+enum {
+ EOF_TOKEN = 0,
+
+ /* Per standard convention, codes in the range (0, UCHAR_MAX]
+ represent single characters with those character codes. */
+ CHAR_TOKEN_OFFSET = UCHAR_MAX + 1,
+ GTY_TOKEN = CHAR_TOKEN_OFFSET,
+ TYPEDEF,
+ EXTERN,
+ STATIC,
+ UNION,
+ STRUCT,
+ ENUM,
+ VEC_TOKEN,
+ DEFVEC_OP,
+ DEFVEC_I,
+ DEFVEC_ALLOC,
+ ELLIPSIS,
+ PTR_ALIAS,
+ NESTED_PTR,
+ PARAM_IS,
+ NUM,
+ SCALAR,
+ ID,
+ STRING,
+ CHAR,
+ ARRAY,
+
+ /* print_token assumes that any token >= FIRST_TOKEN_WITH_VALUE may have
+ a meaningful value to be printed. */
+ FIRST_TOKEN_WITH_VALUE = PARAM_IS
+};
#endif