]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/read-md.h
fix PR68343: disable fuse-*.c tests for isl 0.14 or earlier
[thirdparty/gcc.git] / gcc / read-md.h
CommitLineData
10692477 1/* MD reader definitions.
818ab71a 2 Copyright (C) 1987-2016 Free Software Foundation, Inc.
10692477
RS
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
f1717f8d
KC
20#ifndef GCC_READ_MD_H
21#define GCC_READ_MD_H
22
10692477 23#include "obstack.h"
9f418533 24
cc472607
RS
25/* Records a position in the file. */
26struct file_location {
27 file_location () {}
28 file_location (const char *, int);
29
30 const char *filename;
31 int lineno;
32};
33
34inline file_location::file_location (const char *filename_in, int lineno_in)
35 : filename (filename_in), lineno (lineno_in) {}
36
9f418533
RS
37/* Holds one symbol or number in the .md file. */
38struct md_name {
39 /* The name as it appeared in the .md file. Names are syntactically
40 limited to the length of this buffer. */
41 char buffer[256];
42
43 /* The name that should actually be used by the generator programs.
44 This is an expansion of NAME, after things like constant substitution. */
45 char *string;
46};
47
24609606
RS
48/* This structure represents a constant defined by define_constant,
49 define_enum, or such-like. */
9f418533 50struct md_constant {
24609606 51 /* The name of the constant. */
9f418533 52 char *name;
24609606
RS
53
54 /* The string to which the constants expands. */
9f418533 55 char *value;
24609606
RS
56
57 /* If the constant is associated with a enumeration, this field
58 points to that enumeration, otherwise it is null. */
59 struct enum_type *parent_enum;
60};
61
62/* This structure represents one value in an enum_type. */
63struct enum_value {
64 /* The next value in the enum, or null if this is the last. */
65 struct enum_value *next;
66
67 /* The name of the value as it appears in the .md file. */
68 char *name;
69
70 /* The definition of the related C value. */
71 struct md_constant *def;
72};
73
74/* This structure represents an enum defined by define_enum or the like. */
75struct enum_type {
76 /* The C name of the enumeration. */
77 char *name;
78
79 /* True if this is an md-style enum (DEFINE_ENUM) rather than
80 a C-style enum (DEFINE_C_ENUM). */
81 bool md_p;
82
83 /* The values of the enumeration. There is always at least one. */
84 struct enum_value *values;
85
86 /* A pointer to the null terminator in VALUES. */
87 struct enum_value **tail_ptr;
88
89 /* The number of enumeration values. */
90 unsigned int num_values;
9f418533 91};
10692477 92
600ab3fc 93/* A callback that handles a single .md-file directive, up to but not
cc472607
RS
94 including the closing ')'. It takes two arguments: the file position
95 at which the directive started, and the name of the directive. The next
600ab3fc 96 unread character is the optional space after the directive name. */
cc472607 97typedef void (*directive_handler_t) (file_location, const char *);
600ab3fc
RS
98
99extern const char *in_fname;
c5e88b39 100extern FILE *read_md_file;
d2a3ce4e
RS
101extern int read_md_lineno;
102extern const char *read_md_filename;
10692477 103extern struct obstack string_obstack;
600ab3fc 104extern void (*include_callback) (const char *);
10692477 105
c5e88b39
RS
106/* Read the next character from the MD file. */
107
108static inline int
109read_char (void)
110{
7f7c467f
RS
111 int ch;
112
113 ch = getc (read_md_file);
114 if (ch == '\n')
115 read_md_lineno++;
116 return ch;
c5e88b39
RS
117}
118
119/* Put back CH, which was the last character read from the MD file. */
120
121static inline void
122unread_char (int ch)
123{
7f7c467f
RS
124 if (ch == '\n')
125 read_md_lineno--;
c5e88b39
RS
126 ungetc (ch, read_md_file);
127}
128
9f418533
RS
129extern hashval_t leading_string_hash (const void *);
130extern int leading_string_eq_p (const void *, const void *);
d2a3ce4e
RS
131extern void copy_md_ptr_loc (const void *, const void *);
132extern void print_md_ptr_loc (const void *);
41723253 133extern void fprint_md_ptr_loc (FILE *, const void *);
10692477
RS
134extern const char *join_c_conditions (const char *, const char *);
135extern void print_c_condition (const char *);
41723253 136extern void fprint_c_condition (FILE *, const char *);
cc472607
RS
137extern void message_at (file_location, const char *, ...) ATTRIBUTE_PRINTF_2;
138extern void error_at (file_location, const char *, ...) ATTRIBUTE_PRINTF_2;
8f246310 139extern void fatal_at (file_location, const char *, ...) ATTRIBUTE_PRINTF_2;
c5e88b39
RS
140extern void fatal_with_file_and_line (const char *, ...)
141 ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
142extern void fatal_expected_char (int, int) ATTRIBUTE_NORETURN;
143extern int read_skip_spaces (void);
9f418533 144extern void read_name (struct md_name *);
c5e88b39
RS
145extern char *read_quoted_string (void);
146extern char *read_string (int);
10692477
RS
147extern int n_comma_elts (const char *);
148extern const char *scan_comma_elt (const char **);
24609606 149extern void upcase_string (char *);
9f418533 150extern void traverse_md_constants (htab_trav, void *);
24609606 151extern void traverse_enum_types (htab_trav, void *);
8f4fe86c 152extern struct enum_type *lookup_enum_type (const char *);
600ab3fc
RS
153extern bool read_md_files (int, char **, bool (*) (const char *),
154 directive_handler_t);
f1717f8d
KC
155
156#endif /* GCC_READ_MD_H */