xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/gcc.h (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1 /* Header file for modules that link with gcc.c
2    Copyright (C) 1999-2015 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 3, 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 COPYING3.  If not see
18 <http://www.gnu.org/licenses/>.  */
19 
20 #ifndef GCC_GCC_H
21 #define GCC_GCC_H
22 
23 #include "version.h"
24 #include "diagnostic-core.h"
25 
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:
33   int main (int argc, char **argv);
34 
35  private:
36   void set_progname (const char *argv0) const;
37   void expand_at_files (int *argc, char ***argv) const;
38   void decode_argv (int argc, const char **argv);
39   void global_initializations ();
40   void build_multilib_strings () const;
41   void set_up_specs () const;
42   void putenv_COLLECT_GCC (const char *argv0) const;
43   void maybe_putenv_COLLECT_LTO_WRAPPER () const;
44   void maybe_putenv_OFFLOAD_TARGETS () const;
45   void handle_unrecognized_options () const;
46   int maybe_print_and_exit () const;
47   bool prepare_infiles ();
48   void do_spec_on_infiles () const;
49   void maybe_run_linker (const char *argv0) const;
50   void final_actions () const;
51   int get_exit_code () const;
52 
53  private:
54   char *explicit_link_files;
55   struct cl_decoded_option *decoded_options;
56   unsigned int decoded_options_count;
57 };
58 
59 /* The mapping of a spec function name to the C function that
60    implements it.  */
61 struct spec_function
62 {
63   const char *name;
64   const char *(*func) (int, const char **);
65 };
66 
67 /* This defines which switch letters take arguments.  */
68 
69 #define DEFAULT_SWITCH_TAKES_ARG(CHAR) \
70   ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
71    || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
72    || (CHAR) == 'I' || (CHAR) == 'J' || (CHAR) == 'm' \
73    || (CHAR) == 'x' || (CHAR) == 'L' || (CHAR) == 'A' \
74    || (CHAR) == 'V' || (CHAR) == 'B' || (CHAR) == 'b')
75 
76 /* This defines which multi-letter switches take arguments.  */
77 
78 #define DEFAULT_WORD_SWITCH_TAKES_ARG(STR)		\
79  (!strcmp (STR, "Tdata") || !strcmp (STR, "Ttext")	\
80   || !strcmp (STR, "Tbss") || !strcmp (STR, "include")	\
81   || !strcmp (STR, "imacros") || !strcmp (STR, "aux-info") \
82   || !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \
83   || !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \
84   || !strcmp (STR, "iquote") || !strcmp (STR, "isystem") \
85   || !strcmp (STR, "isysroot") \
86   || !strcmp (STR, "cxx-isystem") || !strcmp (STR, "-iremap") \
87   || !strcmp (STR, "-param") || !strcmp (STR, "specs") \
88   || !strcmp (STR, "MF") || !strcmp (STR, "MT") || !strcmp (STR, "MQ") \
89   || !strcmp (STR, "fintrinsic-modules-path") \
90   || !strcmp (STR, "dumpbase") || !strcmp (STR, "dumpdir"))
91 
92 
93 /* These are exported by gcc.c.  */
94 extern int do_spec (const char *);
95 extern void record_temp_file (const char *, int, int);
96 extern void pfatal_with_name (const char *) ATTRIBUTE_NORETURN;
97 extern void set_input (const char *);
98 
99 /* Spec files linked with gcc.c must provide definitions for these.  */
100 
101 /* Called before processing to change/add/remove arguments.  */
102 extern void lang_specific_driver (struct cl_decoded_option **,
103 				  unsigned int *, int *);
104 
105 /* Called before linking.  Returns 0 on success and -1 on failure.  */
106 extern int lang_specific_pre_link (void);
107 
108 extern int n_infiles;
109 
110 /* Number of extra output files that lang_specific_pre_link may generate.  */
111 extern int lang_specific_extra_outfiles;
112 
113 /* A vector of corresponding output files is made up later.  */
114 
115 extern const char **outfiles;
116 
117 extern void
118 driver_get_configure_time_options (void (*cb)(const char *option,
119 					      void *user_data),
120 				   void *user_data);
121 
122 #endif /* ! GCC_GCC_H */
123