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 26169699Skan#include "options.h" 27169699Skan 2818334Speterenum debug_info_type 2918334Speter{ 3018334Speter NO_DEBUG, /* Write no debug info. */ 3118334Speter DBX_DEBUG, /* Write BSD .stabs for DBX (using dbxout.c). */ 3218334Speter SDB_DEBUG, /* Write COFF for (old) SDB (using sdbout.c). */ 3350506Sobrien DWARF2_DEBUG, /* Write Dwarf v2 debug info (using dwarf2out.c). */ 3490090Sobrien XCOFF_DEBUG, /* Write IBM/Xcoff debug info (using dbxout.c). */ 3590090Sobrien VMS_DEBUG, /* Write VMS debug info (using vmsdbgout.c). */ 3690090Sobrien VMS_AND_DWARF2_DEBUG /* Write VMS debug info (using vmsdbgout.c). 3790090Sobrien and DWARF v2 debug info (using dwarf2out.c). */ 3818334Speter}; 3918334Speter 4018334Speter/* Specify which kind of debugging info to generate. */ 4118334Speterextern enum debug_info_type write_symbols; 4218334Speter 43132727Skan/* Names of debug_info_type, for error messages. */ 44132727Skanextern const char *const debug_type_names[]; 45132727Skan 4618334Speterenum debug_info_level 4718334Speter{ 4818334Speter DINFO_LEVEL_NONE, /* Write no debugging info. */ 4918334Speter DINFO_LEVEL_TERSE, /* Write minimal info to support tracebacks only. */ 5090090Sobrien DINFO_LEVEL_NORMAL, /* Write info for all declarations (and line table). */ 5118334Speter DINFO_LEVEL_VERBOSE /* Write normal info plus #define/#undef info. */ 5218334Speter}; 5318334Speter 5418334Speter/* Specify how much debugging info to generate. */ 5518334Speterextern enum debug_info_level debug_info_level; 5618334Speter 5718334Speter/* Nonzero means use GNU-only extensions in the generated symbolic 5818334Speter debugging information. */ 59132727Skanextern bool use_gnu_debug_info_extensions; 6018334Speter 61169699Skan/* Enumerate visibility settings. This is deliberately ordered from most 62169699Skan to least visibility. */ 63169699Skan#ifndef SYMBOL_VISIBILITY_DEFINED 64169699Skan#define SYMBOL_VISIBILITY_DEFINED 65169699Skanenum symbol_visibility 66169699Skan{ 67169699Skan VISIBILITY_DEFAULT, 68169699Skan VISIBILITY_PROTECTED, 69169699Skan VISIBILITY_HIDDEN, 70169699Skan VISIBILITY_INTERNAL 71169699Skan}; 72169699Skan#endif 73132727Skan 74169699Skan/* The default visibility for all symbols (unless overridden). */ 75169699Skanextern enum symbol_visibility default_visibility; 76169699Skan 77169699Skanstruct visibility_flags 78169699Skan{ 79169699Skan unsigned inpragma : 1; /* True when in #pragma GCC visibility. */ 80169699Skan unsigned inlines_hidden : 1; /* True when -finlineshidden in effect. */ 81169699Skan}; 82169699Skan 83169699Skan/* Global visibility options. */ 84169699Skanextern struct visibility_flags visibility_options; 85169699Skan 8618334Speter/* Nonzero means do optimizations. -opt. */ 8718334Speter 8818334Speterextern int optimize; 8918334Speter 9050506Sobrien/* Nonzero means optimize for size. -Os. */ 9150506Sobrien 9250506Sobrienextern int optimize_size; 9350506Sobrien 94132727Skan/* Do print extra warnings (such as for uninitialized variables). 95132727Skan -W/-Wextra. */ 9618334Speter 97132727Skanextern bool extra_warnings; 9818334Speter 9990090Sobrien/* Nonzero to warn about unused variables, functions et.al. Use 10090090Sobrien set_Wunused() to update the -Wunused-* flags that correspond to the 10190090Sobrien -Wunused option. */ 10218334Speter 103132727Skanextern void set_Wunused (int setting); 10418334Speter 10518334Speter/* Nonzero means warn about any objects definitions whose size is larger 10618334Speter than N bytes. Also want about function definitions whose returned 10718334Speter values are larger than N bytes. The value N is in `larger_than_size'. */ 10818334Speter 109132727Skanextern bool warn_larger_than; 11090090Sobrienextern HOST_WIDE_INT larger_than_size; 11118334Speter 112117404Skan/* Nonzero means warn about constructs which might not be strict 113117404Skan aliasing safe. */ 114117404Skan 115169699Skanextern int warn_strict_aliasing; 116117404Skan 117169699Skan/* Nonzero means warn about optimizations which rely on undefined 118169699Skan signed overflow. */ 11918334Speter 120169699Skanextern int warn_strict_overflow; 12118334Speter 12218334Speter/* Temporarily suppress certain warnings. 12318334Speter This is set while reading code from a system header file. */ 12418334Speter 12518334Speterextern int in_system_header; 12618334Speter 12718334Speter/* Nonzero for -dp: annotate the assembly with a comment describing the 12818334Speter pattern and alternative used. */ 12918334Speter 13018334Speterextern int flag_print_asm_name; 13118334Speter 13218334Speter/* Now the symbols that are set with `-f' switches. */ 13318334Speter 13418334Speter/* Nonzero means `char' should be signed. */ 13518334Speter 13618334Speterextern int flag_signed_char; 13718334Speter 138169699Skan/* Nonzero means give an enum type only as many bytes as it needs. A value 139169699Skan of 2 means it has not yet been initialized. */ 14018334Speter 14118334Speterextern int flag_short_enums; 14218334Speter 14318334Speter/* Nonzero for -fpcc-struct-return: return values the same way PCC does. */ 14418334Speter 14518334Speterextern int flag_pcc_struct_return; 14618334Speter 14752516Sobrien/* 0 means straightforward implementation of complex divide acceptable. 14852516Sobrien 1 means wide ranges of inputs must work for complex divide. 149169699Skan 2 means C99-like requirements for complex multiply and divide. */ 15052516Sobrien 151169699Skanextern int flag_complex_method; 15252516Sobrien 15396282Sobrien/* Nonzero means that we don't want inlining by virtue of -fno-inline, 15496282Sobrien not just because the tree inliner turned us off. */ 15596282Sobrien 15696282Sobrienextern int flag_really_no_inline; 15796282Sobrien 15818334Speter/* Nonzero if we are only using compiler to check syntax errors. */ 15918334Speter 160169699Skanextern int rtl_dump_and_exit; 16118334Speter 16218334Speter/* Nonzero means we should save auxiliary info into a .X file. */ 16318334Speter 16418334Speterextern int flag_gen_aux_info; 16518334Speter 16652516Sobrien/* Nonzero means suppress output of instruction numbers and line number 16752516Sobrien notes in debugging dumps. */ 16852516Sobrien 16952516Sobrienextern int flag_dump_unnumbered; 17052516Sobrien 17118334Speter/* Nonzero means change certain warnings into errors. 17218334Speter Usually these are warnings about failure to conform to some standard. */ 17318334Speter 17418334Speterextern int flag_pedantic_errors; 17518334Speter 176132727Skan/* Nonzero if we are compiling code for a shared library, zero for 177132727Skan executable. */ 178132727Skan 179132727Skanextern int flag_shlib; 180132727Skan 18150506Sobrien/* -dA causes debug information to be produced in 18250506Sobrien the generated assembly code (to make it more readable). This option 18350506Sobrien is generally only of use to those who actually need to read the 18450506Sobrien generated assembly code (perhaps while debugging the compiler itself). 18550506Sobrien Currently, this switch is only used by dwarfout.c; however, it is intended 18650506Sobrien to be a catchall for printing debug information in the assembler file. */ 18750506Sobrien 18850506Sobrienextern int flag_debug_asm; 18950506Sobrien 190169699Skan/* Generate code for GNU or NeXT Objective-C runtime environment. */ 19190090Sobrien 192169699Skanextern int flag_next_runtime; 19318334Speter 194169699Skanextern int flag_dump_rtl_in_asm; 19538510Sbde 19690090Sobrien/* If one, renumber instruction UIDs to reduce the number of 19790090Sobrien unused UIDs if there are a lot of instructions. If greater than 19890090Sobrien one, unconditionally renumber instruction UIDs. */ 19990090Sobrienextern int flag_renumber_insns; 20018334Speter 20118334Speter/* Other basic status info about current function. */ 20218334Speter 20318334Speter/* Nonzero means current function must be given a frame pointer. 20418334Speter Set in stmt.c if anything is allocated on the stack there. 20518334Speter Set in reload1.c if anything is allocated on the stack there. */ 20618334Speter 20718334Speterextern int frame_pointer_needed; 20818334Speter 209132727Skan/* Nonzero if subexpressions must be evaluated from left-to-right. */ 210132727Skanextern int flag_evaluation_order; 211132727Skan 21250506Sobrien/* Value of the -G xx switch, and whether it was passed or not. */ 213132727Skanextern unsigned HOST_WIDE_INT g_switch_value; 214132727Skanextern bool g_switch_set; 21552516Sobrien 21690090Sobrien/* Values of the -falign-* flags: how much to align labels in code. 21790090Sobrien 0 means `use default', 1 means `don't align'. 21890090Sobrien For each variable, there is an _log variant which is the power 21990090Sobrien of two not less than the variable, for .align output. */ 22052516Sobrien 22190090Sobrienextern int align_loops_log; 22290090Sobrienextern int align_loops_max_skip; 22390090Sobrienextern int align_jumps_log; 22490090Sobrienextern int align_jumps_max_skip; 22590090Sobrienextern int align_labels_log; 22690090Sobrienextern int align_labels_max_skip; 22790090Sobrienextern int align_functions_log; 22852516Sobrien 229104764Skan/* Like align_functions_log above, but used by front-ends to force the 230104764Skan minimum function alignment. Zero means no alignment is forced. */ 231104764Skanextern int force_align_functions_log; 232104764Skan 23352516Sobrien/* Nonzero if we dump in VCG format, not plain text. */ 23452516Sobrienextern int dump_for_graph; 23552516Sobrien 23652516Sobrien/* Selection of the graph form. */ 23752516Sobrienenum graph_dump_types 23852516Sobrien{ 23952516Sobrien no_graph = 0, 24052516Sobrien vcg 24152516Sobrien}; 24252516Sobrienextern enum graph_dump_types graph_dump_format; 24352516Sobrien 244117404Skan/* Nonzero means to collect statistics which might be expensive 24590090Sobrien and to print them when we are done. */ 24690090Sobrienextern int flag_detailed_statistics; 24790090Sobrien 248132727Skan/* Nonzero means that we defer emitting functions until they are actually 249132727Skan used. */ 250132727Skanextern int flag_remove_unreachable_functions; 251132727Skan 252169699Skan/* Nonzero if we should track variables. */ 253169699Skanextern int flag_var_tracking; 254169699Skan 255169699Skan/* True if flag_speculative_prefetching was set by user. Used to suppress 256169699Skan warning message in case flag was set by -fprofile-{generate,use}. */ 257169699Skanextern bool flag_speculative_prefetching_set; 258169699Skan 259117404Skan/* A string that's used when a random name is required. NULL means 260117404Skan to make it really random. */ 261117404Skan 262117404Skanextern const char *flag_random_seed; 263117404Skan 264132727Skan/* Returns TRUE if generated code should match ABI version N or 265132727Skan greater is in use. */ 266132727Skan 267132727Skan#define abi_version_at_least(N) \ 268132727Skan (flag_abi_version == 0 || flag_abi_version >= (N)) 269132727Skan 270117404Skan/* True if the given mode has a NaN representation and the treatment of 271117404Skan NaN operands is important. Certain optimizations, such as folding 272169699Skan x * 0 into 0, are not correct for NaN operands, and are normally 273117404Skan disabled for modes with NaNs. The user can ask for them to be 274117404Skan done anyway using the -funsafe-math-optimizations switch. */ 275117404Skan#define HONOR_NANS(MODE) \ 276117404Skan (MODE_HAS_NANS (MODE) && !flag_finite_math_only) 277117404Skan 278117404Skan/* Like HONOR_NANs, but true if we honor signaling NaNs (or sNaNs). */ 279117404Skan#define HONOR_SNANS(MODE) (flag_signaling_nans && HONOR_NANS (MODE)) 280117404Skan 281117404Skan/* As for HONOR_NANS, but true if the mode can represent infinity and 282117404Skan the treatment of infinite values is important. */ 283117404Skan#define HONOR_INFINITIES(MODE) \ 284117404Skan (MODE_HAS_INFINITIES (MODE) && !flag_finite_math_only) 285117404Skan 286117404Skan/* Like HONOR_NANS, but true if the given mode distinguishes between 287132727Skan positive and negative zero, and the sign of zero is important. */ 288117404Skan#define HONOR_SIGNED_ZEROS(MODE) \ 289117404Skan (MODE_HAS_SIGNED_ZEROS (MODE) && !flag_unsafe_math_optimizations) 290117404Skan 291117404Skan/* Like HONOR_NANS, but true if given mode supports sign-dependent rounding, 292117404Skan and the rounding mode is important. */ 293117404Skan#define HONOR_SIGN_DEPENDENT_ROUNDING(MODE) \ 294132727Skan (MODE_HAS_SIGN_DEPENDENT_ROUNDING (MODE) && flag_rounding_math) 295117404Skan 296169699Skan/* True if overflow wraps around for the given integral type. That 297169699Skan is, TYPE_MAX + 1 == TYPE_MIN. */ 298169699Skan#define TYPE_OVERFLOW_WRAPS(TYPE) \ 299169699Skan (TYPE_UNSIGNED (TYPE) || flag_wrapv) 300169699Skan 301169699Skan/* True if overflow is undefined for the given integral type. We may 302169699Skan optimize on the assumption that values in the type never overflow. 303169699Skan 304169699Skan IMPORTANT NOTE: Any optimization based on TYPE_OVERFLOW_UNDEFINED 305169699Skan must issue a warning based on warn_strict_overflow. In some cases 306169699Skan it will be appropriate to issue the warning immediately, and in 307169699Skan other cases it will be appropriate to simply set a flag and let the 308169699Skan caller decide whether a warning is appropriate or not. */ 309169699Skan#define TYPE_OVERFLOW_UNDEFINED(TYPE) \ 310169699Skan (!TYPE_UNSIGNED (TYPE) && !flag_wrapv && !flag_trapv && flag_strict_overflow) 311169699Skan 312169699Skan/* True if overflow for the given integral type should issue a 313169699Skan trap. */ 314169699Skan#define TYPE_OVERFLOW_TRAPS(TYPE) \ 315169699Skan (!TYPE_UNSIGNED (TYPE) && flag_trapv) 316169699Skan 317169699Skan/* Names for the different levels of -Wstrict-overflow=N. The numeric 318169699Skan values here correspond to N. */ 319169699Skan 320169699Skanenum warn_strict_overflow_code 321169699Skan{ 322169699Skan /* Overflow warning that should be issued with -Wall: a questionable 323169699Skan construct that is easy to avoid even when using macros. Example: 324169699Skan folding (x + CONSTANT > x) to 1. */ 325169699Skan WARN_STRICT_OVERFLOW_ALL = 1, 326169699Skan /* Overflow warning about folding a comparison to a constant because 327169699Skan of undefined signed overflow, other than cases covered by 328169699Skan WARN_STRICT_OVERFLOW_ALL. Example: folding (abs (x) >= 0) to 1 329169699Skan (this is false when x == INT_MIN). */ 330169699Skan WARN_STRICT_OVERFLOW_CONDITIONAL = 2, 331169699Skan /* Overflow warning about changes to comparisons other than folding 332169699Skan them to a constant. Example: folding (x + 1 > 1) to (x > 0). */ 333169699Skan WARN_STRICT_OVERFLOW_COMPARISON = 3, 334169699Skan /* Overflow warnings not covered by the above cases. Example: 335169699Skan folding ((x * 10) / 5) to (x * 2). */ 336169699Skan WARN_STRICT_OVERFLOW_MISC = 4, 337169699Skan /* Overflow warnings about reducing magnitude of constants in 338169699Skan comparison. Example: folding (x + 2 > y) to (x + 1 >= y). */ 339169699Skan WARN_STRICT_OVERFLOW_MAGNITUDE = 5 340169699Skan}; 341169699Skan 342169699Skan/* Whether to emit an overflow warning whose code is C. */ 343169699Skan#define issue_strict_overflow_warning(c) (warn_strict_overflow >= (int) (c)) 344169699Skan 34590090Sobrien#endif /* ! GCC_FLAGS_H */ 346