2011-11-04 Tom de Vries <tom@codesourcery.com>
[official-gcc.git] / gcc / flags.h
blob8cc6670ef1b1243ad46e81cf275750e211da0e6c
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, 2011
4 Free Software Foundation, Inc.
6 This file is part of GCC.
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.
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.
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/>. */
22 #ifndef GCC_FLAGS_H
23 #define GCC_FLAGS_H
25 #include "coretypes.h"
26 #include "flag-types.h"
27 #include "options.h"
29 #if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS)
31 /* Names of debug_info_type, for error messages. */
32 extern const char *const debug_type_names[];
34 extern void strip_off_ending (char *, int);
35 extern int base_of_path (const char *path, const char **base_out);
37 /* Return true iff flags are set as if -ffast-math. */
38 extern bool fast_math_flags_set_p (const struct gcc_options *);
39 extern bool fast_math_flags_struct_set_p (struct cl_optimization *);
41 /* Used to set the level of -Wstrict-aliasing in OPTS, when no level
42 is specified. The external way to set the default level is to use
43 -Wstrict-aliasing=level.
44 ONOFF is assumed to take value 1 when -Wstrict-aliasing is specified,
45 and 0 otherwise. After calling this function, wstrict_aliasing will be
46 set to the default value of -Wstrict_aliasing=level. */
48 extern void set_Wstrict_aliasing (struct gcc_options *opts, int onoff);
50 /* Now the symbols that are set with `-f' switches. */
52 /* True if printing into -fdump-final-insns= dump. */
54 extern bool final_insns_dump_p;
56 /* Nonzero means make permerror produce warnings instead of errors. */
58 extern int flag_permissive;
60 /* Generate code for GNU or NeXT Objective-C runtime environment. */
62 extern int flag_next_runtime;
64 /* Other basic status info about current function. */
66 /* Target-dependent global state. */
67 struct target_flag_state {
68 /* Values of the -falign-* flags: how much to align labels in code.
69 0 means `use default', 1 means `don't align'.
70 For each variable, there is an _log variant which is the power
71 of two not less than the variable, for .align output. */
72 int x_align_loops_log;
73 int x_align_loops_max_skip;
74 int x_align_jumps_log;
75 int x_align_jumps_max_skip;
76 int x_align_labels_log;
77 int x_align_labels_max_skip;
78 int x_align_functions_log;
80 /* The excess precision currently in effect. */
81 enum excess_precision x_flag_excess_precision;
84 extern struct target_flag_state default_target_flag_state;
85 #if SWITCHABLE_TARGET
86 extern struct target_flag_state *this_target_flag_state;
87 #else
88 #define this_target_flag_state (&default_target_flag_state)
89 #endif
91 #define align_loops_log \
92 (this_target_flag_state->x_align_loops_log)
93 #define align_loops_max_skip \
94 (this_target_flag_state->x_align_loops_max_skip)
95 #define align_jumps_log \
96 (this_target_flag_state->x_align_jumps_log)
97 #define align_jumps_max_skip \
98 (this_target_flag_state->x_align_jumps_max_skip)
99 #define align_labels_log \
100 (this_target_flag_state->x_align_labels_log)
101 #define align_labels_max_skip \
102 (this_target_flag_state->x_align_labels_max_skip)
103 #define align_functions_log \
104 (this_target_flag_state->x_align_functions_log)
105 #define flag_excess_precision \
106 (this_target_flag_state->x_flag_excess_precision)
108 /* Nonzero if we dump in VCG format, not plain text. */
109 extern int dump_for_graph;
111 /* Returns TRUE if generated code should match ABI version N or
112 greater is in use. */
114 #define abi_version_at_least(N) \
115 (flag_abi_version == 0 || flag_abi_version >= (N))
117 /* True if overflow wraps around for the given integral type. That
118 is, TYPE_MAX + 1 == TYPE_MIN. */
119 #define TYPE_OVERFLOW_WRAPS(TYPE) \
120 (TYPE_UNSIGNED (TYPE) || flag_wrapv)
122 /* True if overflow is undefined for the given integral type. We may
123 optimize on the assumption that values in the type never overflow.
125 IMPORTANT NOTE: Any optimization based on TYPE_OVERFLOW_UNDEFINED
126 must issue a warning based on warn_strict_overflow. In some cases
127 it will be appropriate to issue the warning immediately, and in
128 other cases it will be appropriate to simply set a flag and let the
129 caller decide whether a warning is appropriate or not. */
130 #define TYPE_OVERFLOW_UNDEFINED(TYPE) \
131 (!TYPE_UNSIGNED (TYPE) && !flag_wrapv && !flag_trapv && flag_strict_overflow)
133 /* True if overflow for the given integral type should issue a
134 trap. */
135 #define TYPE_OVERFLOW_TRAPS(TYPE) \
136 (!TYPE_UNSIGNED (TYPE) && flag_trapv)
138 /* True if pointer types have undefined overflow. */
139 #define POINTER_TYPE_OVERFLOW_UNDEFINED (flag_strict_overflow)
141 /* Whether to emit an overflow warning whose code is C. */
142 #define issue_strict_overflow_warning(c) (warn_strict_overflow >= (int) (c))
144 #endif
146 #endif /* ! GCC_FLAGS_H */