/* Command line option handling.
- Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
Contributed by Neil Booth.
This file is part of GCC.
#include "flags.h"
#include "params.h"
#include "diagnostic.h"
-#include "diagnostic-color.h"
#include "opts-diagnostic.h"
#include "insn-attr-common.h"
#include "common/common-target.h"
targetm_common.option_init_struct (opts);
}
+/* Release any allocations owned by OPTS. */
+
+void
+finalize_options_struct (struct gcc_options *opts)
+{
+ XDELETEVEC (opts->x_param_values);
+}
+
/* If indicated by the optimization level LEVEL (-Os if SIZE is set,
-Ofast if FAST is set, -Og if DEBUG is set), apply the option DEFAULT_OPT
to OPTS and OPTS_SET, diagnostic context DC, location LOC, with language
{ OPT_LEVELS_2_PLUS, OPT_ftree_pre, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_ftree_switch_conversion, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_fipa_cp, NULL, 1 },
+ { OPT_LEVELS_2_PLUS, OPT_fipa_cp_alignment, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_fdevirtualize, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_fdevirtualize_speculatively, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_fipa_sra, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_fhoist_adjacent_loads, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_fipa_icf, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_fisolate_erroneous_paths_dereference, NULL, 1 },
- { OPT_LEVELS_2_PLUS, OPT_fuse_caller_save, NULL, 1 },
+ { OPT_LEVELS_2_PLUS, OPT_fipa_ra, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_flra_remat, NULL, 1 },
/* -O3 optimizations. */
if (!opts->x_flag_opts_finished)
{
+ /* We initialize opts->x_flag_pie to -1 so that targets can set a
+ default value. */
+ if (opts->x_flag_pie == -1)
+ {
+ if (opts->x_flag_pic == 0)
+ opts->x_flag_pie = DEFAULT_FLAG_PIE;
+ else
+ opts->x_flag_pie = 0;
+ }
if (opts->x_flag_pie)
opts->x_flag_pic = opts->x_flag_pie;
if (opts->x_flag_pic && !opts->x_flag_pie)
if (* (const char **) flag_var != NULL)
snprintf (new_help + strlen (new_help),
sizeof (new_help) - strlen (new_help),
- * (const char **) flag_var);
+ "%s", * (const char **) flag_var);
}
else if (option->var_type == CLVC_ENUM)
{
arg = _("[default]");
snprintf (new_help + strlen (new_help),
sizeof (new_help) - strlen (new_help),
- arg);
+ "%s", arg);
}
else
sprintf (new_help + strlen (new_help),
the desired maximum width of the output. */
if (opts->x_help_columns == 0)
{
- const char *p;
-
- p = getenv ("COLUMNS");
- if (p != NULL)
- {
- int value = atoi (p);
-
- if (value > 0)
- opts->x_help_columns = value;
- }
-
- if (opts->x_help_columns == 0)
+ opts->x_help_columns = get_terminal_width ();
+ if (opts->x_help_columns == INT_MAX)
/* Use a reasonable default. */
opts->x_help_columns = 80;
}
if (!opts_set->x_flag_ipa_cp_clone
&& value && opts->x_flag_ipa_cp)
opts->x_flag_ipa_cp_clone = value;
+ if (!opts_set->x_flag_ipa_cp_alignment
+ && value && opts->x_flag_ipa_cp)
+ opts->x_flag_ipa_cp_alignment = value;
if (!opts_set->x_flag_predictive_commoning)
opts->x_flag_predictive_commoning = value;
if (!opts_set->x_flag_unswitch_loops)
unsigned int i;
if (lang_mask == CL_DRIVER)
- break;;
+ break;
undoc_mask = ((opts->x_verbose_flag | opts->x_extra_warnings)
? 0
{ "float-cast-overflow", SANITIZE_FLOAT_CAST,
sizeof "float-cast-overflow" - 1 },
{ "bounds", SANITIZE_BOUNDS, sizeof "bounds" - 1 },
+ { "bounds-strict", SANITIZE_BOUNDS | SANITIZE_BOUNDS_STRICT,
+ sizeof "bounds-strict" - 1 },
{ "alignment", SANITIZE_ALIGNMENT, sizeof "alignment" - 1 },
{ "nonnull-attribute", SANITIZE_NONNULL_ATTRIBUTE,
sizeof "nonnull-attribute" - 1 },
sizeof "returns-nonnull-attribute" - 1 },
{ "object-size", SANITIZE_OBJECT_SIZE,
sizeof "object-size" - 1 },
+ { "vptr", SANITIZE_VPTR, sizeof "vptr" - 1 },
+ { "all", ~0, sizeof "all" - 1 },
{ NULL, 0, 0 }
};
const char *comma;
&& memcmp (p, spec[i].name, len) == 0)
{
/* Handle both -fsanitize and -fno-sanitize cases. */
- if (value)
+ if (value && spec[i].flag == ~0U)
+ {
+ if (code == OPT_fsanitize_)
+ error_at (loc, "-fsanitize=all option is not valid");
+ else
+ *flag |= ~(SANITIZE_USER_ADDRESS | SANITIZE_THREAD
+ | SANITIZE_LEAK);
+ }
+ else if (value)
*flag |= spec[i].flag;
else
*flag &= ~spec[i].flag;
break;
case OPT_fdbg_cnt_:
+ /* Deferred. */
+ break;
+
case OPT_fdbg_cnt_list:
/* Deferred. */
+ opts->x_exit_after_options = true;
break;
case OPT_fdebug_prefix_map_:
break;
case OPT_fdiagnostics_color_:
- pp_show_color (dc->printer)
- = colorize_init ((diagnostic_color_rule_t) value);
+ diagnostic_color_init (dc, value);
break;
case OPT_fdiagnostics_show_option:
/* FALLTHRU */
case OPT_gdwarf_:
- if (value < 2 || value > 4)
+ if (value < 2 || value > 5)
error_at (loc, "dwarf version %d is not supported", value);
else
opts->x_dwarf_version = value;
{
struct rlimit rlim;
if (getrlimit (RLIMIT_CORE, &rlim) != 0)
- fatal_error ("getting core file size maximum limit: %m");
+ fatal_error (input_location, "getting core file size maximum limit: %m");
rlim.rlim_cur = rlim.rlim_max;
if (setrlimit (RLIMIT_CORE, &rlim) != 0)
- fatal_error ("setting core file size limit to maximum: %m");
+ fatal_error (input_location,
+ "setting core file size limit to maximum: %m");
}
#endif
diagnostic_abort_on_error (dc);