]>
Commit | Line | Data |
---|---|---|
e53b6e56 | 1 | /* Header file for modules that link with gcc.cc |
aeee4812 | 2 | Copyright (C) 1999-2023 Free Software Foundation, Inc. |
9257393c | 3 | |
1322177d | 4 | This file is part of GCC. |
9257393c | 5 | |
1322177d LB |
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 | |
9dcd6f09 | 8 | Software Foundation; either version 3, or (at your option) any later |
1322177d | 9 | version. |
9257393c | 10 | |
1322177d LB |
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. | |
9257393c KG |
15 | |
16 | You should have received a copy of the GNU General Public License | |
9dcd6f09 NC |
17 | along with GCC; see the file COPYING3. If not see |
18 | <http://www.gnu.org/licenses/>. */ | |
9257393c | 19 | |
88657302 RH |
20 | #ifndef GCC_GCC_H |
21 | #define GCC_GCC_H | |
9257393c | 22 | |
9f8f4efe | 23 | #include "version.h" |
6afbc885 | 24 | #include "diagnostic-core.h" |
9f8f4efe | 25 | |
2cb844ce DM |
26 | /* The top-level "main" within the driver would be ~1000 lines long. |
27 | This class breaks it up into smaller functions and contains some | |
28 | state shared by them. */ | |
29 | ||
30 | class driver | |
31 | { | |
32 | public: | |
9376dd63 DM |
33 | driver (bool can_finalize, bool debug); |
34 | ~driver (); | |
2cb844ce | 35 | int main (int argc, char **argv); |
9376dd63 | 36 | void finalize (); |
2cb844ce DM |
37 | |
38 | private: | |
39 | void set_progname (const char *argv0) const; | |
40 | void expand_at_files (int *argc, char ***argv) const; | |
41 | void decode_argv (int argc, const char **argv); | |
42 | void global_initializations (); | |
43 | void build_multilib_strings () const; | |
44 | void set_up_specs () const; | |
45 | void putenv_COLLECT_GCC (const char *argv0) const; | |
46 | void maybe_putenv_COLLECT_LTO_WRAPPER () const; | |
47 | void maybe_putenv_OFFLOAD_TARGETS () const; | |
61789eed | 48 | void handle_unrecognized_options (); |
2cb844ce DM |
49 | int maybe_print_and_exit () const; |
50 | bool prepare_infiles (); | |
51 | void do_spec_on_infiles () const; | |
52 | void maybe_run_linker (const char *argv0) const; | |
53 | void final_actions () const; | |
e006ead5 | 54 | void detect_jobserver () const; |
2cb844ce DM |
55 | int get_exit_code () const; |
56 | ||
57 | private: | |
58 | char *explicit_link_files; | |
59 | struct cl_decoded_option *decoded_options; | |
60 | unsigned int decoded_options_count; | |
98086b2b | 61 | option_proposer m_option_proposer; |
2cb844ce DM |
62 | }; |
63 | ||
f3226a90 JT |
64 | /* The mapping of a spec function name to the C function that |
65 | implements it. */ | |
66 | struct spec_function | |
1d088dee | 67 | { |
f3226a90 | 68 | const char *name; |
1d088dee | 69 | const char *(*func) (int, const char **); |
f3226a90 JT |
70 | }; |
71 | ||
e53b6e56 | 72 | /* These are exported by gcc.cc. */ |
1d088dee AJ |
73 | extern int do_spec (const char *); |
74 | extern void record_temp_file (const char *, int, int); | |
1d088dee | 75 | extern void set_input (const char *); |
9257393c | 76 | |
e53b6e56 | 77 | /* Spec files linked with gcc.cc must provide definitions for these. */ |
9257393c | 78 | |
2ba84f36 | 79 | /* Called before processing to change/add/remove arguments. */ |
d9d16a19 JM |
80 | extern void lang_specific_driver (struct cl_decoded_option **, |
81 | unsigned int *, int *); | |
9257393c | 82 | |
2ba84f36 | 83 | /* Called before linking. Returns 0 on success and -1 on failure. */ |
1d088dee | 84 | extern int lang_specific_pre_link (void); |
9257393c | 85 | |
3a5a9edc PB |
86 | extern int n_infiles; |
87 | ||
2ba84f36 | 88 | /* Number of extra output files that lang_specific_pre_link may generate. */ |
9257393c KG |
89 | extern int lang_specific_extra_outfiles; |
90 | ||
3a5a9edc PB |
91 | /* A vector of corresponding output files is made up later. */ |
92 | ||
93 | extern const char **outfiles; | |
94 | ||
2cb844ce DM |
95 | extern void |
96 | driver_get_configure_time_options (void (*cb)(const char *option, | |
97 | void *user_data), | |
98 | void *user_data); | |
99 | ||
88657302 | 100 | #endif /* ! GCC_GCC_H */ |