Regenerate .pot files.
[gcc.git] / gcc / opts.c
index a83345b91e21fd5a02dd69252385695dedbc9a1a..9793999016eceace2305200ede42a404ea3a6ce7 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
@@ -30,7 +30,6 @@ along with GCC; see the file COPYING3.  If not see
 #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"
@@ -307,6 +306,14 @@ init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set)
   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
@@ -486,6 +493,7 @@ static const struct default_options default_options_table[] =
     { 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 },
@@ -499,7 +507,7 @@ static const struct default_options default_options_table[] =
     { 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.  */
@@ -733,6 +741,15 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
 
   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)
@@ -1099,7 +1116,7 @@ print_filtered_help (unsigned int include_flags,
                      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)
                    {
@@ -1113,7 +1130,7 @@ print_filtered_help (unsigned int include_flags,
                        arg = _("[default]");
                      snprintf (new_help + strlen (new_help),
                                sizeof (new_help) - strlen (new_help),
-                               arg);
+                               "%s", arg);
                    }
                  else
                    sprintf (new_help + strlen (new_help),
@@ -1224,18 +1241,8 @@ print_specific_help (unsigned int include_flags,
      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;
     }
@@ -1333,6 +1340,9 @@ enable_fdo_optimizations (struct gcc_options *opts,
   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)
@@ -1385,7 +1395,7 @@ common_handle_option (struct gcc_options *opts,
        unsigned int i;
 
        if (lang_mask == CL_DRIVER)
-         break;;
+         break;
 
        undoc_mask = ((opts->x_verbose_flag | opts->x_extra_warnings)
                      ? 0
@@ -1583,6 +1593,8 @@ common_handle_option (struct gcc_options *opts,
              { "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 },
@@ -1591,6 +1603,8 @@ common_handle_option (struct gcc_options *opts,
                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;
@@ -1614,7 +1628,15 @@ common_handle_option (struct gcc_options *opts,
                  && 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;
@@ -1746,8 +1768,12 @@ common_handle_option (struct gcc_options *opts,
       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_:
@@ -1763,8 +1789,7 @@ common_handle_option (struct gcc_options *opts,
       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:
@@ -1984,7 +2009,7 @@ common_handle_option (struct gcc_options *opts,
       
       /* 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;
@@ -2258,10 +2283,11 @@ setup_core_dumping (diagnostic_context *dc)
   {
     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);