190090Sobrien/* Compilation switch flag definitions for GCC.
2132727Skan   Copyright (C) 1987, 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002,
3169699Skan   2003, 2004, 2005, 2006, 2007
490090Sobrien   Free Software Foundation, Inc.
518334Speter
690090SobrienThis file is part of GCC.
718334Speter
890090SobrienGCC is free software; you can redistribute it and/or modify it under
990090Sobrienthe terms of the GNU General Public License as published by the Free
1090090SobrienSoftware Foundation; either version 2, or (at your option) any later
1190090Sobrienversion.
1218334Speter
1390090SobrienGCC is distributed in the hope that it will be useful, but WITHOUT ANY
1490090SobrienWARRANTY; without even the implied warranty of MERCHANTABILITY or
1590090SobrienFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1690090Sobrienfor more details.
1718334Speter
1818334SpeterYou should have received a copy of the GNU General Public License
1990090Sobrienalong with GCC; see the file COPYING.  If not, write to the Free
20169699SkanSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
21169699Skan02110-1301, USA.  */
2218334Speter
2390090Sobrien#ifndef GCC_FLAGS_H
2490090Sobrien#define GCC_FLAGS_H
2590090Sobrien
26259268Spfg#include "coretypes.h"
27169699Skan#include "options.h"
28169699Skan
2918334Speterenum debug_info_type
3018334Speter{
3118334Speter  NO_DEBUG,	    /* Write no debug info.  */
3218334Speter  DBX_DEBUG,	    /* Write BSD .stabs for DBX (using dbxout.c).  */
3318334Speter  SDB_DEBUG,	    /* Write COFF for (old) SDB (using sdbout.c).  */
3450506Sobrien  DWARF2_DEBUG,	    /* Write Dwarf v2 debug info (using dwarf2out.c).  */
3590090Sobrien  XCOFF_DEBUG,	    /* Write IBM/Xcoff debug info (using dbxout.c).  */
3690090Sobrien  VMS_DEBUG,        /* Write VMS debug info (using vmsdbgout.c).  */
3790090Sobrien  VMS_AND_DWARF2_DEBUG /* Write VMS debug info (using vmsdbgout.c).
3890090Sobrien                          and DWARF v2 debug info (using dwarf2out.c).  */
3918334Speter};
4018334Speter
4118334Speter/* Specify which kind of debugging info to generate.  */
4218334Speterextern enum debug_info_type write_symbols;
4318334Speter
44132727Skan/* Names of debug_info_type, for error messages.  */
45132727Skanextern const char *const debug_type_names[];
46132727Skan
4718334Speterenum debug_info_level
4818334Speter{
4918334Speter  DINFO_LEVEL_NONE,	/* Write no debugging info.  */
5018334Speter  DINFO_LEVEL_TERSE,	/* Write minimal info to support tracebacks only.  */
5190090Sobrien  DINFO_LEVEL_NORMAL,	/* Write info for all declarations (and line table).  */
5218334Speter  DINFO_LEVEL_VERBOSE	/* Write normal info plus #define/#undef info.  */
5318334Speter};
5418334Speter
5518334Speter/* Specify how much debugging info to generate.  */
5618334Speterextern enum debug_info_level debug_info_level;
5718334Speter
58259268Spfg/* A major contribution to object and executable size is debug
59259268Spfg   information size.  A major contribution to debug information
60259268Spfg   size is struct descriptions replicated in several object files.
61259268Spfg   The following function determines whether or not debug information
62259268Spfg   should be generated for a given struct.  The indirect parameter
63259268Spfg   indicates that the struct is being handled indirectly, via
64259268Spfg   a pointer.  See opts.c for the implementation. */
65259268Spfg
66259268Spfgenum debug_info_usage
67259268Spfg{
68259268Spfg  DINFO_USAGE_DFN,	/* A struct definition. */
69259268Spfg  DINFO_USAGE_DIR_USE,	/* A direct use, such as the type of a variable. */
70259268Spfg  DINFO_USAGE_IND_USE,	/* An indirect use, such as through a pointer. */
71259268Spfg  DINFO_USAGE_NUM_ENUMS	/* The number of enumerators. */
72259268Spfg};
73259268Spfg
74259268Spfgextern bool should_emit_struct_debug (tree type_decl, enum debug_info_usage);
75259268Spfgextern void set_struct_debug_option (const char *value);
76259268Spfg
7718334Speter/* Nonzero means use GNU-only extensions in the generated symbolic
7818334Speter   debugging information.  */
79132727Skanextern bool use_gnu_debug_info_extensions;
8018334Speter
81169699Skan/* Enumerate visibility settings.  This is deliberately ordered from most
82169699Skan   to least visibility.  */
83169699Skan#ifndef SYMBOL_VISIBILITY_DEFINED
84169699Skan#define SYMBOL_VISIBILITY_DEFINED
85169699Skanenum symbol_visibility
86169699Skan{
87169699Skan  VISIBILITY_DEFAULT,
88169699Skan  VISIBILITY_PROTECTED,
89169699Skan  VISIBILITY_HIDDEN,
90169699Skan  VISIBILITY_INTERNAL
91169699Skan};
92169699Skan#endif
93132727Skan
94169699Skan/* The default visibility for all symbols (unless overridden).  */
95169699Skanextern enum symbol_visibility default_visibility;
96169699Skan
97169699Skanstruct visibility_flags
98169699Skan{
99169699Skan  unsigned inpragma : 1;	/* True when in #pragma GCC visibility.  */
100169699Skan  unsigned inlines_hidden : 1;	/* True when -finlineshidden in effect.  */
101169699Skan};
102169699Skan
103169699Skan/* Global visibility options.  */
104169699Skanextern struct visibility_flags visibility_options;
105169699Skan
10618334Speter/* Nonzero means do optimizations.  -opt.  */
10718334Speter
10818334Speterextern int optimize;
10918334Speter
11050506Sobrien/* Nonzero means optimize for size.  -Os.  */
11150506Sobrien
11250506Sobrienextern int optimize_size;
11350506Sobrien
114132727Skan/* Do print extra warnings (such as for uninitialized variables).
115132727Skan   -W/-Wextra.  */
11618334Speter
117132727Skanextern bool extra_warnings;
11818334Speter
11990090Sobrien/* Nonzero to warn about unused variables, functions et.al.  Use
12090090Sobrien   set_Wunused() to update the -Wunused-* flags that correspond to the
12190090Sobrien   -Wunused option.  */
12218334Speter
123132727Skanextern void set_Wunused (int setting);
12418334Speter
125259405Spfg/* Used to set the level of -Wstrict-aliasing, when no level is specified.
126259405Spfg   The external way to set the default level is to use
127259405Spfg   -Wstrict-aliasing=level.
128259405Spfg   ONOFF is assumed to take value 1 when -Wstrict-aliasing is specified,
129259405Spfg   and 0 otherwise.  After calling this function, wstrict_aliasing will be
130259405Spfg   set to the default value of -Wstrict_aliasing=level.  */
131259405Spfg
132259405Spfgextern void set_warn_strict_aliasing (int onoff);
133259405Spfg
13418334Speter/* Nonzero means warn about any objects definitions whose size is larger
13518334Speter   than N bytes.  Also want about function definitions whose returned
13618334Speter   values are larger than N bytes. The value N is in `larger_than_size'.  */
13718334Speter
138132727Skanextern bool warn_larger_than;
13990090Sobrienextern HOST_WIDE_INT larger_than_size;
14018334Speter
141259405Spfg/* Nonzero means warn about any function whose frame size is larger
142259405Spfg   than N bytes. */
143259405Spfg
144259405Spfgextern bool warn_frame_larger_than;
145259405Spfgextern HOST_WIDE_INT frame_larger_than_size;
146259405Spfg
147117404Skan/* Nonzero means warn about constructs which might not be strict
148117404Skan   aliasing safe.  */
149117404Skan
150169699Skanextern int warn_strict_aliasing;
151117404Skan
152169699Skan/* Nonzero means warn about optimizations which rely on undefined
153169699Skan   signed overflow.  */
15418334Speter
155169699Skanextern int warn_strict_overflow;
15618334Speter
15718334Speter/* Temporarily suppress certain warnings.
15818334Speter   This is set while reading code from a system header file.  */
15918334Speter
16018334Speterextern int in_system_header;
16118334Speter
16218334Speter/* Nonzero for -dp: annotate the assembly with a comment describing the
16318334Speter   pattern and alternative used.  */
16418334Speter
16518334Speterextern int flag_print_asm_name;
16618334Speter
16718334Speter/* Now the symbols that are set with `-f' switches.  */
16818334Speter
16918334Speter/* Nonzero means `char' should be signed.  */
17018334Speter
17118334Speterextern int flag_signed_char;
17218334Speter
173169699Skan/* Nonzero means give an enum type only as many bytes as it needs.  A value
174169699Skan   of 2 means it has not yet been initialized.  */
17518334Speter
17618334Speterextern int flag_short_enums;
17718334Speter
17818334Speter/* Nonzero for -fpcc-struct-return: return values the same way PCC does.  */
17918334Speter
18018334Speterextern int flag_pcc_struct_return;
18118334Speter
18252516Sobrien/* 0 means straightforward implementation of complex divide acceptable.
18352516Sobrien   1 means wide ranges of inputs must work for complex divide.
184169699Skan   2 means C99-like requirements for complex multiply and divide.  */
18552516Sobrien
186169699Skanextern int flag_complex_method;
18752516Sobrien
18896282Sobrien/* Nonzero means that we don't want inlining by virtue of -fno-inline,
18996282Sobrien   not just because the tree inliner turned us off.  */
19096282Sobrien
19196282Sobrienextern int flag_really_no_inline;
19296282Sobrien
19318334Speter/* Nonzero if we are only using compiler to check syntax errors.  */
19418334Speter
195169699Skanextern int rtl_dump_and_exit;
19618334Speter
19718334Speter/* Nonzero means we should save auxiliary info into a .X file.  */
19818334Speter
19918334Speterextern int flag_gen_aux_info;
20018334Speter
20152516Sobrien/* Nonzero means suppress output of instruction numbers and line number
20252516Sobrien   notes in debugging dumps.  */
20352516Sobrien
20452516Sobrienextern int flag_dump_unnumbered;
20552516Sobrien
20618334Speter/* Nonzero means change certain warnings into errors.
20718334Speter   Usually these are warnings about failure to conform to some standard.  */
20818334Speter
20918334Speterextern int flag_pedantic_errors;
21018334Speter
211132727Skan/* Nonzero if we are compiling code for a shared library, zero for
212132727Skan   executable.  */
213132727Skan
214132727Skanextern int flag_shlib;
215132727Skan
21650506Sobrien/* -dA causes debug information to be produced in
21750506Sobrien   the generated assembly code (to make it more readable).  This option
21850506Sobrien   is generally only of use to those who actually need to read the
21950506Sobrien   generated assembly code (perhaps while debugging the compiler itself).
22050506Sobrien   Currently, this switch is only used by dwarfout.c; however, it is intended
22150506Sobrien   to be a catchall for printing debug information in the assembler file.  */
22250506Sobrien
22350506Sobrienextern int flag_debug_asm;
22450506Sobrien
225169699Skan/* Generate code for GNU or NeXT Objective-C runtime environment.  */
22690090Sobrien
227169699Skanextern int flag_next_runtime;
22818334Speter
229169699Skanextern int flag_dump_rtl_in_asm;
23038510Sbde
23190090Sobrien/* If one, renumber instruction UIDs to reduce the number of
23290090Sobrien   unused UIDs if there are a lot of instructions.  If greater than
23390090Sobrien   one, unconditionally renumber instruction UIDs.  */
23490090Sobrienextern int flag_renumber_insns;
23518334Speter
23618334Speter/* Other basic status info about current function.  */
23718334Speter
23818334Speter/* Nonzero means current function must be given a frame pointer.
23918334Speter   Set in stmt.c if anything is allocated on the stack there.
24018334Speter   Set in reload1.c if anything is allocated on the stack there.  */
24118334Speter
24218334Speterextern int frame_pointer_needed;
24318334Speter
244132727Skan/* Nonzero if subexpressions must be evaluated from left-to-right.  */
245132727Skanextern int flag_evaluation_order;
246132727Skan
24750506Sobrien/* Value of the -G xx switch, and whether it was passed or not.  */
248132727Skanextern unsigned HOST_WIDE_INT g_switch_value;
249132727Skanextern bool g_switch_set;
25052516Sobrien
25190090Sobrien/* Values of the -falign-* flags: how much to align labels in code.
25290090Sobrien   0 means `use default', 1 means `don't align'.
25390090Sobrien   For each variable, there is an _log variant which is the power
25490090Sobrien   of two not less than the variable, for .align output.  */
25552516Sobrien
25690090Sobrienextern int align_loops_log;
25790090Sobrienextern int align_loops_max_skip;
25890090Sobrienextern int align_jumps_log;
25990090Sobrienextern int align_jumps_max_skip;
26090090Sobrienextern int align_labels_log;
26190090Sobrienextern int align_labels_max_skip;
26290090Sobrienextern int align_functions_log;
26352516Sobrien
26452516Sobrien/* Nonzero if we dump in VCG format, not plain text.  */
26552516Sobrienextern int dump_for_graph;
26652516Sobrien
26752516Sobrien/* Selection of the graph form.  */
26852516Sobrienenum graph_dump_types
26952516Sobrien{
27052516Sobrien  no_graph = 0,
27152516Sobrien  vcg
27252516Sobrien};
27352516Sobrienextern enum graph_dump_types graph_dump_format;
27452516Sobrien
275117404Skan/* Nonzero means to collect statistics which might be expensive
27690090Sobrien   and to print them when we are done.  */
27790090Sobrienextern int flag_detailed_statistics;
27890090Sobrien
279132727Skan/* Nonzero means that we defer emitting functions until they are actually
280132727Skan   used.  */
281132727Skanextern int flag_remove_unreachable_functions;
282132727Skan
283169699Skan/* Nonzero if we should track variables.  */
284169699Skanextern int flag_var_tracking;
285169699Skan
286169699Skan/* True if flag_speculative_prefetching was set by user.  Used to suppress
287169699Skan   warning message in case flag was set by -fprofile-{generate,use}.  */
288169699Skanextern bool flag_speculative_prefetching_set;
289169699Skan
290117404Skan/* A string that's used when a random name is required.  NULL means
291117404Skan   to make it really random.  */
292117404Skan
293117404Skanextern const char *flag_random_seed;
294117404Skan
295132727Skan/* Returns TRUE if generated code should match ABI version N or
296132727Skan   greater is in use.  */
297132727Skan
298132727Skan#define abi_version_at_least(N) \
299132727Skan  (flag_abi_version == 0 || flag_abi_version >= (N))
300132727Skan
301259405Spfg/* Return whether the function should be excluded from
302259405Spfg   instrumentation.  */
303259405Spfgextern bool flag_instrument_functions_exclude_p (tree fndecl);
304259405Spfg
305117404Skan/* True if the given mode has a NaN representation and the treatment of
306117404Skan   NaN operands is important.  Certain optimizations, such as folding
307169699Skan   x * 0 into 0, are not correct for NaN operands, and are normally
308117404Skan   disabled for modes with NaNs.  The user can ask for them to be
309117404Skan   done anyway using the -funsafe-math-optimizations switch.  */
310117404Skan#define HONOR_NANS(MODE) \
311117404Skan  (MODE_HAS_NANS (MODE) && !flag_finite_math_only)
312117404Skan
313117404Skan/* Like HONOR_NANs, but true if we honor signaling NaNs (or sNaNs).  */
314117404Skan#define HONOR_SNANS(MODE) (flag_signaling_nans && HONOR_NANS (MODE))
315117404Skan
316117404Skan/* As for HONOR_NANS, but true if the mode can represent infinity and
317117404Skan   the treatment of infinite values is important.  */
318117404Skan#define HONOR_INFINITIES(MODE) \
319117404Skan  (MODE_HAS_INFINITIES (MODE) && !flag_finite_math_only)
320117404Skan
321117404Skan/* Like HONOR_NANS, but true if the given mode distinguishes between
322132727Skan   positive and negative zero, and the sign of zero is important.  */
323117404Skan#define HONOR_SIGNED_ZEROS(MODE) \
324117404Skan  (MODE_HAS_SIGNED_ZEROS (MODE) && !flag_unsafe_math_optimizations)
325117404Skan
326117404Skan/* Like HONOR_NANS, but true if given mode supports sign-dependent rounding,
327117404Skan   and the rounding mode is important.  */
328117404Skan#define HONOR_SIGN_DEPENDENT_ROUNDING(MODE) \
329132727Skan  (MODE_HAS_SIGN_DEPENDENT_ROUNDING (MODE) && flag_rounding_math)
330117404Skan
331169699Skan/* True if overflow wraps around for the given integral type.  That
332169699Skan   is, TYPE_MAX + 1 == TYPE_MIN.  */
333169699Skan#define TYPE_OVERFLOW_WRAPS(TYPE) \
334169699Skan  (TYPE_UNSIGNED (TYPE) || flag_wrapv)
335169699Skan
336169699Skan/* True if overflow is undefined for the given integral type.  We may
337169699Skan   optimize on the assumption that values in the type never overflow.
338169699Skan
339169699Skan   IMPORTANT NOTE: Any optimization based on TYPE_OVERFLOW_UNDEFINED
340169699Skan   must issue a warning based on warn_strict_overflow.  In some cases
341169699Skan   it will be appropriate to issue the warning immediately, and in
342169699Skan   other cases it will be appropriate to simply set a flag and let the
343169699Skan   caller decide whether a warning is appropriate or not.  */
344169699Skan#define TYPE_OVERFLOW_UNDEFINED(TYPE) \
345169699Skan  (!TYPE_UNSIGNED (TYPE) && !flag_wrapv && !flag_trapv && flag_strict_overflow)
346169699Skan
347169699Skan/* True if overflow for the given integral type should issue a
348169699Skan   trap.  */
349169699Skan#define TYPE_OVERFLOW_TRAPS(TYPE) \
350169699Skan  (!TYPE_UNSIGNED (TYPE) && flag_trapv)
351169699Skan
352169699Skan/* Names for the different levels of -Wstrict-overflow=N.  The numeric
353169699Skan   values here correspond to N.  */
354169699Skan
355169699Skanenum warn_strict_overflow_code
356169699Skan{
357169699Skan  /* Overflow warning that should be issued with -Wall: a questionable
358169699Skan     construct that is easy to avoid even when using macros.  Example:
359169699Skan     folding (x + CONSTANT > x) to 1.  */
360169699Skan  WARN_STRICT_OVERFLOW_ALL = 1,
361169699Skan  /* Overflow warning about folding a comparison to a constant because
362169699Skan     of undefined signed overflow, other than cases covered by
363169699Skan     WARN_STRICT_OVERFLOW_ALL.  Example: folding (abs (x) >= 0) to 1
364169699Skan     (this is false when x == INT_MIN).  */
365169699Skan  WARN_STRICT_OVERFLOW_CONDITIONAL = 2,
366169699Skan  /* Overflow warning about changes to comparisons other than folding
367169699Skan     them to a constant.  Example: folding (x + 1 > 1) to (x > 0).  */
368169699Skan  WARN_STRICT_OVERFLOW_COMPARISON = 3,
369169699Skan  /* Overflow warnings not covered by the above cases.  Example:
370169699Skan     folding ((x * 10) / 5) to (x * 2).  */
371169699Skan  WARN_STRICT_OVERFLOW_MISC = 4,
372169699Skan  /* Overflow warnings about reducing magnitude of constants in
373169699Skan     comparison.  Example: folding (x + 2 > y) to (x + 1 >= y).  */
374169699Skan  WARN_STRICT_OVERFLOW_MAGNITUDE = 5
375169699Skan};
376169699Skan
377169699Skan/* Whether to emit an overflow warning whose code is C.  */
378169699Skan#define issue_strict_overflow_warning(c) (warn_strict_overflow >= (int) (c))
379169699Skan
38090090Sobrien#endif /* ! GCC_FLAGS_H */
381