]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Change -g so that it will override -g1 but not -g3.
authorCary Coutant <ccoutant@google.com>
Wed, 14 May 2014 21:48:47 +0000 (21:48 +0000)
committerCary Coutant <ccoutant@gcc.gnu.org>
Wed, 14 May 2014 21:48:47 +0000 (14:48 -0700)
gcc/
        PR debug/61013
* opts.c (common_handle_option): Don't special-case "-g".
(set_debug_level): Default to at least level 2 with "-g".

From-SVN: r210442

gcc/ChangeLog
gcc/opts.c

index 228f0e96ba7ba700018ff308dd48a87c3672843d..85a8cd4a379b164ab9e16a39ff458cc675538b67 100644 (file)
@@ -1,3 +1,9 @@
+2014-05-14  Cary Coutant  <ccoutant@google.com>
+
+        PR debug/61013
+       * opts.c (common_handle_option): Don't special-case "-g".
+       (set_debug_level): Default to at least level 2 with "-g".
+
 2014-05-14  DJ Delorie  <dj@redhat.com>
 
        * config/msp430/msp430.c (msp430_builtin): Add
index 269cd93ea69122d427d6f1cfab407ce42edfb55d..5f4b2e390dd85523f75ca4224ba6b36531bed81a 100644 (file)
@@ -1814,13 +1814,8 @@ common_handle_option (struct gcc_options *opts,
       break;
 
     case OPT_g:
-      /* -g by itself should force -g2.  */
-      if (*arg == '\0')
-       set_debug_level (NO_DEBUG, DEFAULT_GDB_EXTENSIONS, "2", opts, opts_set,
-                        loc);
-      else
-       set_debug_level (NO_DEBUG, DEFAULT_GDB_EXTENSIONS, arg, opts, opts_set,
-                        loc);
+      set_debug_level (NO_DEBUG, DEFAULT_GDB_EXTENSIONS, arg, opts, opts_set,
+                       loc);
       break;
 
     case OPT_gcoff:
@@ -2070,10 +2065,12 @@ set_debug_level (enum debug_info_type type, int extended, const char *arg,
       opts_set->x_write_symbols = type;
     }
 
-  /* A debug flag without a level defaults to level 2.  */
+  /* A debug flag without a level defaults to level 2.
+     If off or at level 1, set it to level 2, but if already
+     at level 3, don't lower it.  */ 
   if (*arg == '\0')
     {
-      if (!opts->x_debug_info_level)
+      if (opts->x_debug_info_level < DINFO_LEVEL_NORMAL)
        opts->x_debug_info_level = DINFO_LEVEL_NORMAL;
     }
   else