cselib.c (entry_and_rtx_equal_p): Constify.
[platform/upstream/gcc.git] / gcc / gengtype.h
1 /* Process source files and output type information.
2    Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
3
4 This file is part of GCC.
5
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
9 version.
10
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING.  If not, write to the Free
18 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301, USA.  */
20
21 #ifndef GCC_GENGTYPE_H
22 #define GCC_GENGTYPE_H
23
24 /* A file position, mostly for error messages.  
25    The FILE element may be compared using pointer equality.  */
26 struct fileloc {
27   const char *file;
28   int line;
29 };
30
31 /* Data types handed around within, but opaque to, the lexer and parser.  */
32 typedef struct pair *pair_p;
33 typedef struct type *type_p;
34 typedef const struct type *const_type_p;
35 typedef struct options *options_p;
36
37 /* Variables used to communicate between the lexer and the parser.  */
38 extern int lexer_toplevel_done;
39 extern struct fileloc lexer_line;
40
41 /* Print an error message.  */
42 extern void error_at_line 
43   (struct fileloc *pos, const char *msg, ...) ATTRIBUTE_PRINTF_2;
44
45 /* Like asprintf, but calls fatal() on out of memory.  */
46 extern char *xasprintf(const char *, ...) ATTRIBUTE_PRINTF_1;
47
48 /* Constructor routines for types.  */
49 extern void do_typedef (const char *s, type_p t, struct fileloc *pos);
50 extern void do_scalar_typedef (const char *s, struct fileloc *pos);
51 extern type_p resolve_typedef (const char *s, struct fileloc *pos);
52 extern type_p new_structure (const char *name, int isunion,
53                              struct fileloc *pos, pair_p fields,
54                              options_p o);
55 extern type_p find_structure (const char *s, int isunion);
56 extern type_p create_scalar_type (const char *name);
57 extern type_p create_pointer (type_p t);
58 extern type_p create_array (type_p t, const char *len);
59 extern options_p create_option (options_p, const char *name, const void *info);
60 extern options_p create_nested_ptr_option (options_p, type_p t,
61                                            const char *from, const char *to);
62 extern pair_p create_field_at (pair_p next, type_p type, const char *name,
63                                options_p opt, struct fileloc *pos);
64 extern pair_p nreverse_pairs (pair_p list);
65 extern type_p adjust_field_type (type_p, options_p);
66 extern void note_variable (const char *s, type_p t, options_p o,
67                            struct fileloc *pos);
68 extern void note_def_vec (const char *typename, bool is_scalar,
69                           struct fileloc *pos);
70 extern void note_def_vec_alloc (const char *type, const char *astrat,
71                                 struct fileloc *pos);
72
73 /* Lexer and parser routines.  */
74 extern int yylex (const char **yylval);
75 extern void yybegin (const char *fname);
76 extern void yyend (void);
77 extern void parse_file (const char *name);
78 extern bool hit_error;
79
80 /* Token codes.  */
81 enum {
82   EOF_TOKEN = 0,
83
84   /* Per standard convention, codes in the range (0, UCHAR_MAX]
85      represent single characters with those character codes.  */
86
87   CHAR_TOKEN_OFFSET = UCHAR_MAX + 1,
88   GTY_TOKEN = CHAR_TOKEN_OFFSET,
89   TYPEDEF,
90   EXTERN,
91   STATIC,
92   UNION,
93   STRUCT,
94   ENUM,
95   VEC_TOKEN,
96   DEFVEC_OP,
97   DEFVEC_I,
98   DEFVEC_ALLOC,
99   ELLIPSIS,
100   PTR_ALIAS,
101   NESTED_PTR,
102   PARAM_IS,
103   NUM,
104   SCALAR,
105   ID,
106   STRING,
107   CHAR,
108   ARRAY,
109
110   /* print_token assumes that any token >= FIRST_TOKEN_WITH_VALUE may have
111      a meaningful value to be printed.  */
112   FIRST_TOKEN_WITH_VALUE = PARAM_IS
113 };
114 #endif