Makefile.in (TM_H): Include $(FLAGS_H) instead of options.h.
[gcc.git] / gcc / flags.h
1 /* Compilation switch flag definitions for GCC.
2 Copyright (C) 1987, 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002,
3 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 Free Software Foundation, Inc.
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
21
22 #ifndef GCC_FLAGS_H
23 #define GCC_FLAGS_H
24
25 #include "coretypes.h"
26
27 #if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS)
28
29 enum debug_info_type
30 {
31 NO_DEBUG, /* Write no debug info. */
32 DBX_DEBUG, /* Write BSD .stabs for DBX (using dbxout.c). */
33 SDB_DEBUG, /* Write COFF for (old) SDB (using sdbout.c). */
34 DWARF2_DEBUG, /* Write Dwarf v2 debug info (using dwarf2out.c). */
35 XCOFF_DEBUG, /* Write IBM/Xcoff debug info (using dbxout.c). */
36 VMS_DEBUG, /* Write VMS debug info (using vmsdbgout.c). */
37 VMS_AND_DWARF2_DEBUG /* Write VMS debug info (using vmsdbgout.c).
38 and DWARF v2 debug info (using dwarf2out.c). */
39 };
40
41 /* Specify which kind of debugging info to generate. */
42 extern enum debug_info_type write_symbols;
43
44 /* Names of debug_info_type, for error messages. */
45 extern const char *const debug_type_names[];
46
47 enum debug_info_level
48 {
49 DINFO_LEVEL_NONE, /* Write no debugging info. */
50 DINFO_LEVEL_TERSE, /* Write minimal info to support tracebacks only. */
51 DINFO_LEVEL_NORMAL, /* Write info for all declarations (and line table). */
52 DINFO_LEVEL_VERBOSE /* Write normal info plus #define/#undef info. */
53 };
54
55 /* Specify how much debugging info to generate. */
56 extern enum debug_info_level debug_info_level;
57
58 /* A major contribution to object and executable size is debug
59 information size. A major contribution to debug information
60 size is struct descriptions replicated in several object files.
61 The following function determines whether or not debug information
62 should be generated for a given struct. The indirect parameter
63 indicates that the struct is being handled indirectly, via
64 a pointer. See opts.c for the implementation. */
65
66 enum debug_info_usage
67 {
68 DINFO_USAGE_DFN, /* A struct definition. */
69 DINFO_USAGE_DIR_USE, /* A direct use, such as the type of a variable. */
70 DINFO_USAGE_IND_USE, /* An indirect use, such as through a pointer. */
71 DINFO_USAGE_NUM_ENUMS /* The number of enumerators. */
72 };
73
74 extern bool should_emit_struct_debug (tree type_decl, enum debug_info_usage);
75 extern void set_struct_debug_option (const char *value);
76
77 /* Nonzero means use GNU-only extensions in the generated symbolic
78 debugging information. */
79 extern bool use_gnu_debug_info_extensions;
80
81 /* Run the second compilation of -fcompare-debug. Not defined using
82 Var in common.opt because this is used in Ada code and so must be
83 an actual variable not a macro. */
84 extern int flag_compare_debug;
85
86 /* Enumerate visibility settings. This is deliberately ordered from most
87 to least visibility. */
88 #ifndef SYMBOL_VISIBILITY_DEFINED
89 #define SYMBOL_VISIBILITY_DEFINED
90 enum symbol_visibility
91 {
92 VISIBILITY_DEFAULT,
93 VISIBILITY_PROTECTED,
94 VISIBILITY_HIDDEN,
95 VISIBILITY_INTERNAL
96 };
97 #endif
98
99 /* The default visibility for all symbols (unless overridden). */
100 extern enum symbol_visibility default_visibility;
101
102 struct visibility_flags
103 {
104 unsigned inpragma : 1; /* True when in #pragma GCC visibility. */
105 unsigned inlines_hidden : 1; /* True when -finlineshidden in effect. */
106 };
107
108 /* Global visibility options. */
109 extern struct visibility_flags visibility_options;
110
111 /* True if this is the LTO front end (lto1). This is used to disable
112 gimple generation and lowering passes that are normally run on the
113 output of a front end. These passes must be bypassed for lto since
114 they have already been done before the gimple was written. */
115
116 extern bool in_lto_p;
117
118 /* Nonzero if we should write GIMPLE bytecode for link-time optimization. */
119
120 extern int flag_generate_lto;
121
122 /* Used to set the level of -Wstrict-aliasing, when no level is specified.
123 The external way to set the default level is to use
124 -Wstrict-aliasing=level.
125 ONOFF is assumed to take value 1 when -Wstrict-aliasing is specified,
126 and 0 otherwise. After calling this function, wstrict_aliasing will be
127 set to the default value of -Wstrict_aliasing=level. */
128
129 extern void set_Wstrict_aliasing (int onoff);
130
131 /* Nonzero means warn about any objects definitions whose size is larger
132 than N bytes. Also want about function definitions whose returned
133 values are larger than N bytes. The value N is in `larger_than_size'. */
134
135 extern bool warn_larger_than;
136 extern HOST_WIDE_INT larger_than_size;
137
138 /* Nonzero means warn about any function whose frame size is larger
139 than N bytes. */
140
141 extern bool warn_frame_larger_than;
142 extern HOST_WIDE_INT frame_larger_than_size;
143
144 /* Nonzero for -dp: annotate the assembly with a comment describing the
145 pattern and alternative used. */
146
147 extern int flag_print_asm_name;
148 \f
149 /* Now the symbols that are set with `-f' switches. */
150
151 /* Nonzero if we are only using compiler to check syntax errors. */
152
153 extern int rtl_dump_and_exit;
154
155 /* Nonzero means we should save auxiliary info into a .X file. */
156
157 extern int flag_gen_aux_info;
158
159 /* True if printing into -fdump-final-insns= dump. */
160
161 extern bool final_insns_dump_p;
162
163 /* Nonzero means change certain warnings into errors.
164 Usually these are warnings about failure to conform to some standard. */
165
166 extern int flag_pedantic_errors;
167
168 /* Nonzero means make permerror produce warnings instead of errors. */
169
170 extern int flag_permissive;
171
172 /* Nonzero if we are compiling code for a shared library, zero for
173 executable. */
174
175 extern int flag_shlib;
176
177 /* -dA causes debug information to be produced in
178 the generated assembly code (to make it more readable). This option
179 is generally only of use to those who actually need to read the
180 generated assembly code (perhaps while debugging the compiler itself).
181 Currently, this switch is only used by dwarfout.c; however, it is intended
182 to be a catchall for printing debug information in the assembler file. */
183
184 extern int flag_debug_asm;
185
186 /* Generate code for GNU or NeXT Objective-C runtime environment. */
187
188 extern int flag_next_runtime;
189
190 extern int flag_dump_rtl_in_asm;
191
192 /* The algorithm used for the integrated register allocator (IRA). */
193 enum ira_algorithm
194 {
195 IRA_ALGORITHM_CB,
196 IRA_ALGORITHM_PRIORITY
197 };
198
199 /* The regions used for the integrated register allocator (IRA). */
200 enum ira_region
201 {
202 IRA_REGION_ONE,
203 IRA_REGION_ALL,
204 IRA_REGION_MIXED
205 };
206
207 /* The options for excess precision. */
208 enum excess_precision
209 {
210 EXCESS_PRECISION_DEFAULT,
211 EXCESS_PRECISION_FAST,
212 EXCESS_PRECISION_STANDARD
213 };
214
215 /* The excess precision specified on the command line, or defaulted by
216 the front end. */
217 extern enum excess_precision flag_excess_precision_cmdline;
218 \f
219 /* Other basic status info about current function. */
220
221 /* Target-dependent global state. */
222 struct target_flag_state {
223 /* Values of the -falign-* flags: how much to align labels in code.
224 0 means `use default', 1 means `don't align'.
225 For each variable, there is an _log variant which is the power
226 of two not less than the variable, for .align output. */
227 int x_align_loops_log;
228 int x_align_loops_max_skip;
229 int x_align_jumps_log;
230 int x_align_jumps_max_skip;
231 int x_align_labels_log;
232 int x_align_labels_max_skip;
233 int x_align_functions_log;
234
235 /* The excess precision currently in effect. */
236 enum excess_precision x_flag_excess_precision;
237 };
238
239 extern struct target_flag_state default_target_flag_state;
240 #if SWITCHABLE_TARGET
241 extern struct target_flag_state *this_target_flag_state;
242 #else
243 #define this_target_flag_state (&default_target_flag_state)
244 #endif
245
246 #define align_loops_log \
247 (this_target_flag_state->x_align_loops_log)
248 #define align_loops_max_skip \
249 (this_target_flag_state->x_align_loops_max_skip)
250 #define align_jumps_log \
251 (this_target_flag_state->x_align_jumps_log)
252 #define align_jumps_max_skip \
253 (this_target_flag_state->x_align_jumps_max_skip)
254 #define align_labels_log \
255 (this_target_flag_state->x_align_labels_log)
256 #define align_labels_max_skip \
257 (this_target_flag_state->x_align_labels_max_skip)
258 #define align_functions_log \
259 (this_target_flag_state->x_align_functions_log)
260 #define flag_excess_precision \
261 (this_target_flag_state->x_flag_excess_precision)
262
263 /* Nonzero if we dump in VCG format, not plain text. */
264 extern int dump_for_graph;
265
266 /* Selection of the graph form. */
267 enum graph_dump_types
268 {
269 no_graph = 0,
270 vcg
271 };
272 extern enum graph_dump_types graph_dump_format;
273
274 /* Type of stack check. */
275 enum stack_check_type
276 {
277 /* Do not check the stack. */
278 NO_STACK_CHECK = 0,
279
280 /* Check the stack generically, i.e. assume no specific support
281 from the target configuration files. */
282 GENERIC_STACK_CHECK,
283
284 /* Check the stack and rely on the target configuration files to
285 check the static frame of functions, i.e. use the generic
286 mechanism only for dynamic stack allocations. */
287 STATIC_BUILTIN_STACK_CHECK,
288
289 /* Check the stack and entirely rely on the target configuration
290 files, i.e. do not use the generic mechanism at all. */
291 FULL_BUILTIN_STACK_CHECK
292 };
293 extern enum stack_check_type flag_stack_check;
294
295 /* Returns TRUE if generated code should match ABI version N or
296 greater is in use. */
297
298 #define abi_version_at_least(N) \
299 (flag_abi_version == 0 || flag_abi_version >= (N))
300
301 /* Return whether the function should be excluded from
302 instrumentation. */
303 extern bool flag_instrument_functions_exclude_p (tree fndecl);
304
305 /* True if overflow wraps around for the given integral type. That
306 is, TYPE_MAX + 1 == TYPE_MIN. */
307 #define TYPE_OVERFLOW_WRAPS(TYPE) \
308 (TYPE_UNSIGNED (TYPE) || flag_wrapv)
309
310 /* True if overflow is undefined for the given integral type. We may
311 optimize on the assumption that values in the type never overflow.
312
313 IMPORTANT NOTE: Any optimization based on TYPE_OVERFLOW_UNDEFINED
314 must issue a warning based on warn_strict_overflow. In some cases
315 it will be appropriate to issue the warning immediately, and in
316 other cases it will be appropriate to simply set a flag and let the
317 caller decide whether a warning is appropriate or not. */
318 #define TYPE_OVERFLOW_UNDEFINED(TYPE) \
319 (!TYPE_UNSIGNED (TYPE) && !flag_wrapv && !flag_trapv && flag_strict_overflow)
320
321 /* True if overflow for the given integral type should issue a
322 trap. */
323 #define TYPE_OVERFLOW_TRAPS(TYPE) \
324 (!TYPE_UNSIGNED (TYPE) && flag_trapv)
325
326 /* True if pointer types have undefined overflow. */
327 #define POINTER_TYPE_OVERFLOW_UNDEFINED (flag_strict_overflow)
328
329 /* Names for the different levels of -Wstrict-overflow=N. The numeric
330 values here correspond to N. */
331
332 enum warn_strict_overflow_code
333 {
334 /* Overflow warning that should be issued with -Wall: a questionable
335 construct that is easy to avoid even when using macros. Example:
336 folding (x + CONSTANT > x) to 1. */
337 WARN_STRICT_OVERFLOW_ALL = 1,
338 /* Overflow warning about folding a comparison to a constant because
339 of undefined signed overflow, other than cases covered by
340 WARN_STRICT_OVERFLOW_ALL. Example: folding (abs (x) >= 0) to 1
341 (this is false when x == INT_MIN). */
342 WARN_STRICT_OVERFLOW_CONDITIONAL = 2,
343 /* Overflow warning about changes to comparisons other than folding
344 them to a constant. Example: folding (x + 1 > 1) to (x > 0). */
345 WARN_STRICT_OVERFLOW_COMPARISON = 3,
346 /* Overflow warnings not covered by the above cases. Example:
347 folding ((x * 10) / 5) to (x * 2). */
348 WARN_STRICT_OVERFLOW_MISC = 4,
349 /* Overflow warnings about reducing magnitude of constants in
350 comparison. Example: folding (x + 2 > y) to (x + 1 >= y). */
351 WARN_STRICT_OVERFLOW_MAGNITUDE = 5
352 };
353
354 /* Whether to emit an overflow warning whose code is C. */
355 #define issue_strict_overflow_warning(c) (warn_strict_overflow >= (int) (c))
356
357 #endif
358
359 /* This is included last because options may use types declared
360 above. */
361 #include "options.h"
362
363 #endif /* ! GCC_FLAGS_H */