1*e4b17023SJohn Marino /* Compilation switch flag definitions for GCC. 2*e4b17023SJohn Marino Copyright (C) 1987, 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 3*e4b17023SJohn Marino 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 4*e4b17023SJohn Marino Free Software Foundation, Inc. 5*e4b17023SJohn Marino 6*e4b17023SJohn Marino This file is part of GCC. 7*e4b17023SJohn Marino 8*e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify it under 9*e4b17023SJohn Marino the terms of the GNU General Public License as published by the Free 10*e4b17023SJohn Marino Software Foundation; either version 3, or (at your option) any later 11*e4b17023SJohn Marino version. 12*e4b17023SJohn Marino 13*e4b17023SJohn Marino GCC is distributed in the hope that it will be useful, but WITHOUT ANY 14*e4b17023SJohn Marino WARRANTY; without even the implied warranty of MERCHANTABILITY or 15*e4b17023SJohn Marino FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16*e4b17023SJohn Marino for more details. 17*e4b17023SJohn Marino 18*e4b17023SJohn Marino You should have received a copy of the GNU General Public License 19*e4b17023SJohn Marino along with GCC; see the file COPYING3. If not see 20*e4b17023SJohn Marino <http://www.gnu.org/licenses/>. */ 21*e4b17023SJohn Marino 22*e4b17023SJohn Marino #ifndef GCC_FLAGS_H 23*e4b17023SJohn Marino #define GCC_FLAGS_H 24*e4b17023SJohn Marino 25*e4b17023SJohn Marino #include "coretypes.h" 26*e4b17023SJohn Marino #include "flag-types.h" 27*e4b17023SJohn Marino #include "options.h" 28*e4b17023SJohn Marino 29*e4b17023SJohn Marino #if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS) 30*e4b17023SJohn Marino 31*e4b17023SJohn Marino /* Names of debug_info_type, for error messages. */ 32*e4b17023SJohn Marino extern const char *const debug_type_names[]; 33*e4b17023SJohn Marino 34*e4b17023SJohn Marino extern void strip_off_ending (char *, int); 35*e4b17023SJohn Marino extern int base_of_path (const char *path, const char **base_out); 36*e4b17023SJohn Marino 37*e4b17023SJohn Marino /* Return true iff flags are set as if -ffast-math. */ 38*e4b17023SJohn Marino extern bool fast_math_flags_set_p (const struct gcc_options *); 39*e4b17023SJohn Marino extern bool fast_math_flags_struct_set_p (struct cl_optimization *); 40*e4b17023SJohn Marino 41*e4b17023SJohn Marino /* Used to set the level of -Wstrict-aliasing in OPTS, when no level 42*e4b17023SJohn Marino is specified. The external way to set the default level is to use 43*e4b17023SJohn Marino -Wstrict-aliasing=level. 44*e4b17023SJohn Marino ONOFF is assumed to take value 1 when -Wstrict-aliasing is specified, 45*e4b17023SJohn Marino and 0 otherwise. After calling this function, wstrict_aliasing will be 46*e4b17023SJohn Marino set to the default value of -Wstrict_aliasing=level. */ 47*e4b17023SJohn Marino 48*e4b17023SJohn Marino extern void set_Wstrict_aliasing (struct gcc_options *opts, int onoff); 49*e4b17023SJohn Marino 50*e4b17023SJohn Marino /* Now the symbols that are set with `-f' switches. */ 51*e4b17023SJohn Marino 52*e4b17023SJohn Marino /* True if printing into -fdump-final-insns= dump. */ 53*e4b17023SJohn Marino 54*e4b17023SJohn Marino extern bool final_insns_dump_p; 55*e4b17023SJohn Marino 56*e4b17023SJohn Marino /* Nonzero means make permerror produce warnings instead of errors. */ 57*e4b17023SJohn Marino 58*e4b17023SJohn Marino extern int flag_permissive; 59*e4b17023SJohn Marino 60*e4b17023SJohn Marino /* Other basic status info about current function. */ 61*e4b17023SJohn Marino 62*e4b17023SJohn Marino /* Target-dependent global state. */ 63*e4b17023SJohn Marino struct target_flag_state { 64*e4b17023SJohn Marino /* Values of the -falign-* flags: how much to align labels in code. 65*e4b17023SJohn Marino 0 means `use default', 1 means `don't align'. 66*e4b17023SJohn Marino For each variable, there is an _log variant which is the power 67*e4b17023SJohn Marino of two not less than the variable, for .align output. */ 68*e4b17023SJohn Marino int x_align_loops_log; 69*e4b17023SJohn Marino int x_align_loops_max_skip; 70*e4b17023SJohn Marino int x_align_jumps_log; 71*e4b17023SJohn Marino int x_align_jumps_max_skip; 72*e4b17023SJohn Marino int x_align_labels_log; 73*e4b17023SJohn Marino int x_align_labels_max_skip; 74*e4b17023SJohn Marino int x_align_functions_log; 75*e4b17023SJohn Marino 76*e4b17023SJohn Marino /* The excess precision currently in effect. */ 77*e4b17023SJohn Marino enum excess_precision x_flag_excess_precision; 78*e4b17023SJohn Marino }; 79*e4b17023SJohn Marino 80*e4b17023SJohn Marino extern struct target_flag_state default_target_flag_state; 81*e4b17023SJohn Marino #if SWITCHABLE_TARGET 82*e4b17023SJohn Marino extern struct target_flag_state *this_target_flag_state; 83*e4b17023SJohn Marino #else 84*e4b17023SJohn Marino #define this_target_flag_state (&default_target_flag_state) 85*e4b17023SJohn Marino #endif 86*e4b17023SJohn Marino 87*e4b17023SJohn Marino #define align_loops_log \ 88*e4b17023SJohn Marino (this_target_flag_state->x_align_loops_log) 89*e4b17023SJohn Marino #define align_loops_max_skip \ 90*e4b17023SJohn Marino (this_target_flag_state->x_align_loops_max_skip) 91*e4b17023SJohn Marino #define align_jumps_log \ 92*e4b17023SJohn Marino (this_target_flag_state->x_align_jumps_log) 93*e4b17023SJohn Marino #define align_jumps_max_skip \ 94*e4b17023SJohn Marino (this_target_flag_state->x_align_jumps_max_skip) 95*e4b17023SJohn Marino #define align_labels_log \ 96*e4b17023SJohn Marino (this_target_flag_state->x_align_labels_log) 97*e4b17023SJohn Marino #define align_labels_max_skip \ 98*e4b17023SJohn Marino (this_target_flag_state->x_align_labels_max_skip) 99*e4b17023SJohn Marino #define align_functions_log \ 100*e4b17023SJohn Marino (this_target_flag_state->x_align_functions_log) 101*e4b17023SJohn Marino #define flag_excess_precision \ 102*e4b17023SJohn Marino (this_target_flag_state->x_flag_excess_precision) 103*e4b17023SJohn Marino 104*e4b17023SJohn Marino /* Nonzero if we dump in VCG format, not plain text. */ 105*e4b17023SJohn Marino extern int dump_for_graph; 106*e4b17023SJohn Marino 107*e4b17023SJohn Marino /* Returns TRUE if generated code should match ABI version N or 108*e4b17023SJohn Marino greater is in use. */ 109*e4b17023SJohn Marino 110*e4b17023SJohn Marino #define abi_version_at_least(N) \ 111*e4b17023SJohn Marino (flag_abi_version == 0 || flag_abi_version >= (N)) 112*e4b17023SJohn Marino 113*e4b17023SJohn Marino /* True if overflow wraps around for the given integral type. That 114*e4b17023SJohn Marino is, TYPE_MAX + 1 == TYPE_MIN. */ 115*e4b17023SJohn Marino #define TYPE_OVERFLOW_WRAPS(TYPE) \ 116*e4b17023SJohn Marino (TYPE_UNSIGNED (TYPE) || flag_wrapv) 117*e4b17023SJohn Marino 118*e4b17023SJohn Marino /* True if overflow is undefined for the given integral type. We may 119*e4b17023SJohn Marino optimize on the assumption that values in the type never overflow. 120*e4b17023SJohn Marino 121*e4b17023SJohn Marino IMPORTANT NOTE: Any optimization based on TYPE_OVERFLOW_UNDEFINED 122*e4b17023SJohn Marino must issue a warning based on warn_strict_overflow. In some cases 123*e4b17023SJohn Marino it will be appropriate to issue the warning immediately, and in 124*e4b17023SJohn Marino other cases it will be appropriate to simply set a flag and let the 125*e4b17023SJohn Marino caller decide whether a warning is appropriate or not. */ 126*e4b17023SJohn Marino #define TYPE_OVERFLOW_UNDEFINED(TYPE) \ 127*e4b17023SJohn Marino (!TYPE_UNSIGNED (TYPE) && !flag_wrapv && !flag_trapv && flag_strict_overflow) 128*e4b17023SJohn Marino 129*e4b17023SJohn Marino /* True if overflow for the given integral type should issue a 130*e4b17023SJohn Marino trap. */ 131*e4b17023SJohn Marino #define TYPE_OVERFLOW_TRAPS(TYPE) \ 132*e4b17023SJohn Marino (!TYPE_UNSIGNED (TYPE) && flag_trapv) 133*e4b17023SJohn Marino 134*e4b17023SJohn Marino /* True if pointer types have undefined overflow. */ 135*e4b17023SJohn Marino #define POINTER_TYPE_OVERFLOW_UNDEFINED (flag_strict_overflow) 136*e4b17023SJohn Marino 137*e4b17023SJohn Marino /* Whether to emit an overflow warning whose code is C. */ 138*e4b17023SJohn Marino #define issue_strict_overflow_warning(c) (warn_strict_overflow >= (int) (c)) 139*e4b17023SJohn Marino 140*e4b17023SJohn Marino #endif 141*e4b17023SJohn Marino 142*e4b17023SJohn Marino #endif /* ! GCC_FLAGS_H */ 143