OSDN Git Service

Backport from mainline
[pf3gnuchains/gcc-fork.git] / gcc / flags.h
index fd1678b..9791e1b 100644 (file)
-/* Compilation switch flag definitions for GNU CC.
-   Copyright (C) 1987, 88, 94-97, 1998 Free Software Foundation, Inc.
+/* Compilation switch flag definitions for GCC.
+   Copyright (C) 1987, 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002,
+   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+   Free Software Foundation, Inc.
 
-This file is part of GNU CC.
+This file is part of GCC.
 
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
 
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
 
-/* Name of the input .c file being compiled.  */
-extern char *main_input_filename;
+#ifndef GCC_FLAGS_H
+#define GCC_FLAGS_H
 
-enum debug_info_type
-{
-  NO_DEBUG,        /* Write no debug info.  */
-  DBX_DEBUG,       /* Write BSD .stabs for DBX (using dbxout.c).  */
-  SDB_DEBUG,       /* Write COFF for (old) SDB (using sdbout.c).  */
-  DWARF_DEBUG,     /* Write Dwarf debug info (using dwarfout.c).  */
-  DWARF2_DEBUG,            /* Write Dwarf v2 debug info (using dwarf2out.c).  */
-  XCOFF_DEBUG      /* Write IBM/Xcoff debug info (using dbxout.c).  */
-};
-
-/* Specify which kind of debugging info to generate.  */
-extern enum debug_info_type write_symbols;
-
-enum debug_info_level
-{
-  DINFO_LEVEL_NONE,    /* Write no debugging info.  */
-  DINFO_LEVEL_TERSE,   /* Write minimal info to support tracebacks only.  */
-  DINFO_LEVEL_NORMAL,  /* Write info for all declarations (and line table). */
-  DINFO_LEVEL_VERBOSE  /* Write normal info plus #define/#undef info.  */
-};
-
-/* Specify how much debugging info to generate.  */
-extern enum debug_info_level debug_info_level;
-
-/* Nonzero means use GNU-only extensions in the generated symbolic
-   debugging information.  */
-extern int use_gnu_debug_info_extensions;
-
-/* Nonzero means do optimizations.  -opt.  */
-
-extern int optimize;
-
-/* Nonzero means optimize for size.  -Os.  */
-
-extern int optimize_size;
-
-/* Nonzero means do stupid register allocation.  -noreg.
-   Currently, this is 1 if `optimize' is 0.  */
-
-extern int obey_regdecls;
-
-/* Don't print functions as they are compiled and don't print
-   times taken by the various passes.  -quiet.  */
-
-extern int quiet_flag;
-
-/* Don't print warning messages.  -w.  */
-
-extern int inhibit_warnings;
-
-/* Do print extra warnings (such as for uninitialized variables).  -W.  */
-
-extern int extra_warnings;
-
-/* Nonzero to warn about unused local variables.  */
-
-extern int warn_unused;
-
-/* Nonzero means warn if inline function is too large.  */
-
-extern int warn_inline;
-
-/* Nonzero to warn about variables used before they are initialized.  */
-
-extern int warn_uninitialized;
-
-/* Zero if unknown pragmas are ignored
-   One if the compiler should warn about an unknown pragma not in
-   a system include file.
-   Greater than one if the compiler should warn for all unknown
-   pragmas.  */
-
-extern int warn_unknown_pragmas;
-
-/* Nonzero means warn about all declarations which shadow others.   */
-
-extern int warn_shadow;
-
-/* Warn if a switch on an enum fails to have a case for every enum value.  */
-
-extern int warn_switch;
-
-/* Nonzero means warn about function definitions that default the return type
-   or that use a null return and have a return-type other than void.  */
-
-extern int warn_return_type;
-
-/* Nonzero means warn about pointer casts that increase the required
-   alignment of the target type (and might therefore lead to a crash
-   due to a misaligned access).  */
-
-extern int warn_cast_align;
-
-/* Nonzero means warn that dbx info for template class methods isn't fully
-   supported yet.  */
-
-extern int warn_template_debugging;
-
-/* Nonzero means warn about any identifiers that match in the first N
-   characters.  The value N is in `id_clash_len'.  */
-
-extern int warn_id_clash;
-extern unsigned id_clash_len;
+#include "coretypes.h"
+#include "flag-types.h"
+#include "options.h"
 
-/* Nonzero means warn about any objects definitions whose size is larger
-   than N bytes.  Also want about function definitions whose returned
-   values are larger than N bytes. The value N is in `larger_than_size'.  */
+#if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS)
 
-extern int warn_larger_than;
-extern unsigned larger_than_size;
+/* Names of debug_info_type, for error messages.  */
+extern const char *const debug_type_names[];
 
-/* Warn if a function returns an aggregate,
-   since there are often incompatible calling conventions for doing this.  */
+extern void strip_off_ending (char *, int);
+extern int base_of_path (const char *path, const char **base_out);
 
-extern int warn_aggregate_return;
+/* Return true iff flags are set as if -ffast-math.  */
+extern bool fast_math_flags_set_p (const struct gcc_options *);
+extern bool fast_math_flags_struct_set_p (struct cl_optimization *);
 
-/* Nonzero if generating code to do profiling.  */
+/* Used to set the level of -Wstrict-aliasing in OPTS, when no level
+   is specified.  The external way to set the default level is to use
+   -Wstrict-aliasing=level.
+   ONOFF is assumed to take value 1 when -Wstrict-aliasing is specified,
+   and 0 otherwise.  After calling this function, wstrict_aliasing will be
+   set to the default value of -Wstrict_aliasing=level.  */
 
-extern int profile_flag;
-
-/* Nonzero if generating code to do profiling on the basis of basic blocks.  */
-
-extern int profile_block_flag;
-
-/* Nonzero if generating code to profile program flow graph arcs. */
-
-extern int profile_arc_flag;
-
-/* Nonzero if generating info for gcov to calculate line test coverage. */
-
-extern int flag_test_coverage;
-
-/* Nonzero indicates that branch taken probabilities should be calculated. */
-
-extern int flag_branch_probabilities;
-
-/* Nonzero for -pedantic switch: warn about anything
-   that standard C forbids.  */
-
-extern int pedantic;
-
-/* Temporarily suppress certain warnings.
-   This is set while reading code from a system header file.  */
-
-extern int in_system_header;
-
-/* Nonzero for -dp: annotate the assembly with a comment describing the
-   pattern and alternative used.  */
-
-extern int flag_print_asm_name;
+extern void set_Wstrict_aliasing (struct gcc_options *opts, int onoff);
 \f
 /* Now the symbols that are set with `-f' switches.  */
 
-/* Nonzero means `char' should be signed.  */
-
-extern int flag_signed_char;
-
-/* Nonzero means give an enum type only as many bytes as it needs.  */
-
-extern int flag_short_enums;
-
-/* Nonzero for -fcaller-saves: allocate values in regs that need to
-   be saved across function calls, if that produces overall better code.
-   Optional now, so people can test it.  */
-
-extern int flag_caller_saves;
-
-/* Nonzero for -fpcc-struct-return: return values the same way PCC does.  */
-
-extern int flag_pcc_struct_return;
-
-/* Nonzero for -fforce-mem: load memory value into a register
-   before arithmetic on it.  This makes better cse but slower compilation.  */
-
-extern int flag_force_mem;
-
-/* Nonzero for -fforce-addr: load memory address into a register before
-   reference to memory.  This makes better cse but slower compilation.  */
-
-extern int flag_force_addr;
-
-/* Nonzero for -fdefer-pop: don't pop args after each function call;
-   instead save them up to pop many calls' args with one insns.  */
-
-extern int flag_defer_pop;
-
-/* Nonzero for -ffloat-store: don't allocate floats and doubles
-   in extended-precision registers.  */
-
-extern int flag_float_store;
-
-/* Nonzero enables strength-reduction in loop.c.  */
-
-extern int flag_strength_reduce;
-
-/* Nonzero enables loop unrolling in unroll.c.  Only loops for which the
-   number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
-   UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
-   unrolled.  */
-
-extern int flag_unroll_loops;
-
-/* Nonzero enables loop unrolling in unroll.c.  All loops are unrolled.
-   This is generally not a win.  */
-
-extern int flag_unroll_all_loops;
-
-/* Nonzero forces all invariant computations in loops to be moved
-   outside the loop. */
-
-extern int flag_move_all_movables;
+/* True if printing into -fdump-final-insns= dump.  */
 
-/* Nonzero forces all general induction variables in loops to be
-   strength reduced. */
+extern bool final_insns_dump_p;
 
-extern int flag_reduce_all_givs;
+/* Nonzero means make permerror produce warnings instead of errors.  */
 
-/* Nonzero for -fcse-follow-jumps:
-   have cse follow jumps to do a more extensive job.  */
-
-extern int flag_cse_follow_jumps;
-
-/* Nonzero for -fcse-skip-blocks:
-   have cse follow a branch around a block.  */
-
-extern int flag_cse_skip_blocks;
-
-/* Nonzero for -fexpensive-optimizations:
-   perform miscellaneous relatively-expensive optimizations.  */
-extern int flag_expensive_optimizations;
-
-/* Nonzero for -fwritable-strings:
-   store string constants in data segment and don't uniquize them.  */
-
-extern int flag_writable_strings;
-
-/* Nonzero means don't put addresses of constant functions in registers.
-   Used for compiling the Unix kernel, where strange substitutions are
-   done on the assembly output.  */
-
-extern int flag_no_function_cse;
-
-/* Nonzero for -fomit-frame-pointer:
-   don't make a frame pointer in simple functions that don't require one.  */
-
-extern int flag_omit_frame_pointer;
-
-/* Nonzero to inhibit use of define_optimization peephole opts.  */
-
-extern int flag_no_peephole;
-
-/* Nonzero means all references through pointers are volatile.  */
-
-extern int flag_volatile;
-
-/* Nonzero means treat all global and extern variables as global.  */
-
-extern int flag_volatile_global;
-
-/* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
-   operations in the interest of optimization.  For example it allows
-   GCC to assume arguments to sqrt are nonnegative numbers, allowing
-   faster code for sqrt to be generated. */
-
-extern int flag_fast_math;
-
-/* Nonzero means to run loop optimizations twice.  */
-
-extern int flag_rerun_loop_opt;
-
-/* Nonzero means make functions that look like good inline candidates
-   go inline.  */
-
-extern int flag_inline_functions;
-
-/* Nonzero for -fkeep-inline-functions: even if we make a function
-   go inline everywhere, keep its definition around for debugging
-   purposes.  */
-
-extern int flag_keep_inline_functions;
-
-/* Nonzero means that functions declared `inline' will be treated
-   as `static'.  Prevents generation of zillions of copies of unused
-   static inline functions; instead, `inlines' are written out
-   only when actually used.  Used in conjunction with -g.  Also
-   does the right thing with #pragma interface.  */
-
-extern int flag_no_inline;
-
-/* Nonzero if we are only using compiler to check syntax errors.  */
-
-extern int flag_syntax_only;
-
-/* Nonzero means we should save auxiliary info into a .X file.  */
-
-extern int flag_gen_aux_info;
-
-/* Nonzero means make the text shared if supported.  */
-
-extern int flag_shared_data;
-
-/* flag_schedule_insns means schedule insns within basic blocks (before
-   local_alloc).
-   flag_schedule_insns_after_reload means schedule insns after
-   global_alloc.  */
-
-extern int flag_schedule_insns;
-extern int flag_schedule_insns_after_reload;
-
-#ifdef HAIFA
-/* The following flags have effect only for scheduling before register
-   allocation:
-
-   flag_schedule_interblock means schedule insns accross basic blocks.
-   flag_schedule_speculative means allow speculative motion of non-load insns.
-   flag_schedule_speculative_load means allow speculative motion of some
-   load insns.
-   flag_schedule_speculative_load_dangerous allows speculative motion of more
-   load insns.  */
-
-extern int flag_schedule_interblock;
-extern int flag_schedule_speculative;
-extern int flag_schedule_speculative_load;
-extern int flag_schedule_speculative_load_dangerous;
-
-/* flag_on_branch_count_reg means try to replace add-1,compare,branch tupple
-   by a cheaper branch, on a count register. */
-extern int flag_branch_on_count_reg;
-#endif  /* HAIFA */
-
-
-/* Nonzero means put things in delayed-branch slots if supported. */
-
-extern int flag_delayed_branch;
-
-/* Nonzero means pretend it is OK to examine bits of target floats,
-   even if that isn't true.  The resulting code will have incorrect constants,
-   but the same series of instructions that the native compiler would make.  */
-
-extern int flag_pretend_float;
-
-/* Nonzero means change certain warnings into errors.
-   Usually these are warnings about failure to conform to some standard.  */
-
-extern int flag_pedantic_errors;
-
-/* Nonzero means generate position-independent code.
-   This is not fully implemented yet.  */
-
-extern int flag_pic;
-
-/* Nonzero means generate extra code for exception handling and enable
-   exception handling.  */
-
-extern int flag_exceptions;
-
-/* Nonzero means don't place uninitialized global data in common storage
-   by default.  */
-
-extern int flag_no_common;
-
-/* -finhibit-size-directive inhibits output of .size for ELF.
-   This is used only for compiling crtstuff.c,
-   and it may be extended to other effects
-   needed for crtstuff.c on other systems.  */
-extern int flag_inhibit_size_directive;
-
-/* Nonzero means place each function into its own section on those platforms
-   which support arbitrary section names and unlimited numbers of sections.  */
-
-extern int flag_function_sections;
-
-/* -fverbose-asm causes extra commentary information to be produced in
-   the generated assembly code (to make it more readable).  This option
-   is generally only of use to those who actually need to read the
-   generated assembly code (perhaps while debugging the compiler itself).
-   -fno-verbose-asm, the default, causes the extra information
-   to not be added and is useful when comparing two assembler files.  */
-
-extern int flag_verbose_asm;
-
-/* -dA causes debug information to be produced in
-   the generated assembly code (to make it more readable).  This option
-   is generally only of use to those who actually need to read the
-   generated assembly code (perhaps while debugging the compiler itself).
-   Currently, this switch is only used by dwarfout.c; however, it is intended
-   to be a catchall for printing debug information in the assembler file.  */
-
-extern int flag_debug_asm;
-
-/* -fgnu-linker specifies use of the GNU linker for initializations.
-   -fno-gnu-linker says that collect will be used.  */
-extern int flag_gnu_linker;
-
-/* Tag all structures with __attribute__(packed) */
-extern int flag_pack_struct;
-
-/* This flag is only tested if alias checking is enabled.
-   0 if pointer arguments may alias each other.  True in C.
-   1 if pointer arguments may not alias each other but may alias
-   global variables.
-   2 if pointer arguments may not alias each other and may not
-   alias global variables.  True in Fortran.
-   The value is ignored if flag_alias_check is 0.  */
-extern int flag_argument_noalias;
-
-/* Emit code to check for stack overflow; also may cause large objects
-   to be allocated dynamically.  */
-extern int flag_stack_check;
-
-/* Do the full regmove optimization pass.  */
-extern int flag_regmove;
+extern int flag_permissive;
 \f
 /* Other basic status info about current function.  */
 
-/* Nonzero means current function must be given a frame pointer.
-   Set in stmt.c if anything is allocated on the stack there.
-   Set in reload1.c if anything is allocated on the stack there.  */
-
-extern int frame_pointer_needed;
-
-/* Set nonzero if jump_optimize finds that control falls through
-   at the end of the function.  */
-
-extern int can_reach_end;
-
-/* Nonzero if function being compiled receives nonlocal gotos
-   from nested functions.  */
-
-extern int current_function_has_nonlocal_label;
-
-/* Nonzero if function being compiled has nonlocal gotos to parent
-   function.  */
-
-extern int current_function_has_nonlocal_goto;
-
-/* Nonzero if GCC must add code to check memory access (used by Checker).  */
-
-extern int flag_check_memory_usage;
-
-/* Nonzero if GCC must prefix function names (used with
-   flag_check_memory_usage).  */
+/* Target-dependent global state.  */
+struct target_flag_state {
+  /* Values of the -falign-* flags: how much to align labels in code.
+     0 means `use default', 1 means `don't align'.
+     For each variable, there is an _log variant which is the power
+     of two not less than the variable, for .align output.  */
+  int x_align_loops_log;
+  int x_align_loops_max_skip;
+  int x_align_jumps_log;
+  int x_align_jumps_max_skip;
+  int x_align_labels_log;
+  int x_align_labels_max_skip;
+  int x_align_functions_log;
+
+  /* The excess precision currently in effect.  */
+  enum excess_precision x_flag_excess_precision;
+};
 
-extern int flag_prefix_function_name;
-/* Nonzero if the current function is a thunk, so we should try to cut
-   corners where we can.  */
-extern int current_function_is_thunk;
+extern struct target_flag_state default_target_flag_state;
+#if SWITCHABLE_TARGET
+extern struct target_flag_state *this_target_flag_state;
+#else
+#define this_target_flag_state (&default_target_flag_state)
+#endif
+
+#define align_loops_log \
+  (this_target_flag_state->x_align_loops_log)
+#define align_loops_max_skip \
+  (this_target_flag_state->x_align_loops_max_skip)
+#define align_jumps_log \
+  (this_target_flag_state->x_align_jumps_log)
+#define align_jumps_max_skip \
+  (this_target_flag_state->x_align_jumps_max_skip)
+#define align_labels_log \
+  (this_target_flag_state->x_align_labels_log)
+#define align_labels_max_skip \
+  (this_target_flag_state->x_align_labels_max_skip)
+#define align_functions_log \
+  (this_target_flag_state->x_align_functions_log)
+#define flag_excess_precision \
+  (this_target_flag_state->x_flag_excess_precision)
+
+/* Nonzero if we dump in VCG format, not plain text.  */
+extern int dump_for_graph;
+
+/* Returns TRUE if generated code should match ABI version N or
+   greater is in use.  */
+
+#define abi_version_at_least(N) \
+  (flag_abi_version == 0 || flag_abi_version >= (N))
+
+/* True if overflow wraps around for the given integral type.  That
+   is, TYPE_MAX + 1 == TYPE_MIN.  */
+#define TYPE_OVERFLOW_WRAPS(TYPE) \
+  (TYPE_UNSIGNED (TYPE) || flag_wrapv)
+
+/* True if overflow is undefined for the given integral type.  We may
+   optimize on the assumption that values in the type never overflow.
+
+   IMPORTANT NOTE: Any optimization based on TYPE_OVERFLOW_UNDEFINED
+   must issue a warning based on warn_strict_overflow.  In some cases
+   it will be appropriate to issue the warning immediately, and in
+   other cases it will be appropriate to simply set a flag and let the
+   caller decide whether a warning is appropriate or not.  */
+#define TYPE_OVERFLOW_UNDEFINED(TYPE) \
+  (!TYPE_UNSIGNED (TYPE) && !flag_wrapv && !flag_trapv && flag_strict_overflow)
+
+/* True if overflow for the given integral type should issue a
+   trap.  */
+#define TYPE_OVERFLOW_TRAPS(TYPE) \
+  (!TYPE_UNSIGNED (TYPE) && flag_trapv)
+
+/* True if pointer types have undefined overflow.  */
+#define POINTER_TYPE_OVERFLOW_UNDEFINED (flag_strict_overflow)
+
+/* Whether to emit an overflow warning whose code is C.  */
+#define issue_strict_overflow_warning(c) (warn_strict_overflow >= (int) (c))
+
+#endif
+
+#endif /* ! GCC_FLAGS_H */