Fix error when selecting number of memory pools
[official-gcc.git] / include / gcc-interface.h
blobee968af9651ca3d4a0789571e7a08a2791af76ae
1 /* Generic interface between GCC and GDB
3 Copyright (C) 2014-2018 Free Software Foundation, Inc.
5 This file is part of GCC.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_INTERFACE_H
21 #define GCC_INTERFACE_H
23 /* This header defines the interface to the GCC API. It must be both
24 valid C and valid C++, because it is included by both programs. */
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
30 /* Opaque typedefs for objects passed through the interface. */
32 typedef unsigned long long gcc_type;
33 typedef unsigned long long gcc_decl;
35 /* An address in the inferior. */
37 typedef unsigned long long gcc_address;
39 /* Forward declaration. */
41 struct gcc_base_context;
43 /* Defined versions of the generic API. */
45 enum gcc_base_api_version
47 GCC_FE_VERSION_0 = 0,
49 /* Deprecated methods set_arguments_v0 and compile_v0. Added methods
50 set_arguments, set_triplet_regexp, set_driver_filename, set_verbose and
51 compile. */
52 GCC_FE_VERSION_1 = 1,
55 /* The operations defined by the GCC base API. This is the vtable for
56 the real context structure which is passed around.
58 The "base" API is concerned with basics shared by all compiler
59 front ends: setting command-line arguments, the file names, etc.
61 Front-end-specific interfaces inherit from this one. */
63 struct gcc_base_vtable
65 /* The actual version implemented in this interface. This field can
66 be relied on not to move, so users can always check it if they
67 desire. The value is one of the gcc_base_api_version constants.
70 unsigned int version;
72 /* Deprecated GCC_FE_VERSION_0 variant of the GCC_FE_VERSION_1
73 methods set_triplet_regexp and set_arguments. */
75 char *(*set_arguments_v0) (struct gcc_base_context *self,
76 const char *triplet_regexp,
77 int argc, char **argv);
79 /* Set the file name of the program to compile. The string is
80 copied by the method implementation, but the caller must
81 guarantee that the file exists through the compilation. */
83 void (*set_source_file) (struct gcc_base_context *self, const char *file);
85 /* Set a callback to use for printing error messages. DATUM is
86 passed through to the callback unchanged. */
88 void (*set_print_callback) (struct gcc_base_context *self,
89 void (*print_function) (void *datum,
90 const char *message),
91 void *datum);
93 /* Deprecated GCC_FE_VERSION_0 variant of the GCC_FE_VERSION_1
94 compile method. GCC_FE_VERSION_0 version verbose parameter has
95 been replaced by the set_verbose method. */
97 int /* bool */ (*compile_v0) (struct gcc_base_context *self,
98 const char *filename,
99 int /* bool */ verbose);
101 /* Destroy this object. */
103 void (*destroy) (struct gcc_base_context *self);
105 /* VERBOSE can be set to non-zero to cause GCC to print some
106 information as it works. Calling this method overrides its
107 possible previous calls.
109 This method is only available since GCC_FE_VERSION_1. */
111 void (*set_verbose) (struct gcc_base_context *self,
112 int /* bool */ verbose);
114 /* Perform the compilation. FILENAME is the name of the resulting
115 object file. Either set_triplet_regexp or set_driver_filename must
116 be called before. Returns true on success, false on error.
118 This method is only available since GCC_FE_VERSION_1. */
120 int /* bool */ (*compile) (struct gcc_base_context *self,
121 const char *filename);
123 /* Set the compiler's command-line options for the next compilation.
124 The arguments are copied by GCC. ARGV need not be
125 NULL-terminated. The arguments must be set separately for each
126 compilation; that is, after a compile is requested, the
127 previously-set arguments cannot be reused.
129 This returns NULL on success. On failure, returns a malloc()d
130 error message. The caller is responsible for freeing it.
132 This method is only available since GCC_FE_VERSION_1. */
134 char *(*set_arguments) (struct gcc_base_context *self,
135 int argc, char **argv);
137 /* Set TRIPLET_REGEXP as a regular expression that is used to match
138 the configury triplet prefix to the compiler. Calling this method
139 overrides possible previous call of itself or set_driver_filename.
141 This returns NULL on success. On failure, returns a malloc()d
142 error message. The caller is responsible for freeing it.
144 This method is only available since GCC_FE_VERSION_1. */
146 char *(*set_triplet_regexp) (struct gcc_base_context *self,
147 const char *triplet_regexp);
149 /* DRIVER_FILENAME should be filename of the gcc compiler driver
150 program. It will be searched in PATH components like
151 TRIPLET_REGEXP. Calling this method overrides possible previous
152 call of itself or set_triplet_regexp.
154 This returns NULL on success. On failure, returns a malloc()d
155 error message. The caller is responsible for freeing it.
157 This method is only available since GCC_FE_VERSION_1. */
159 char *(*set_driver_filename) (struct gcc_base_context *self,
160 const char *driver_filename);
163 /* The GCC object. */
165 struct gcc_base_context
167 /* The virtual table. */
169 const struct gcc_base_vtable *ops;
172 /* An array of types used for creating function types in multiple
173 languages. */
175 struct gcc_type_array
177 /* Number of elements. */
179 int n_elements;
181 /* The elements. */
183 gcc_type *elements;
186 /* The name of the dummy wrapper function generated by gdb. */
188 #define GCC_FE_WRAPPER_FUNCTION "_gdb_expr"
190 #ifdef __cplusplus
192 #endif
194 #endif /* GCC_INTERFACE_H */