misc.c (flag_short_enums): Declare.
authorTristan Gingold <gingold@adacore.com>
Fri, 24 Jan 2014 14:48:48 +0000 (14:48 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 24 Jan 2014 14:48:48 +0000 (15:48 +0100)
2014-01-24  Tristan Gingold  <gingold@adacore.com>

* gcc-interface/misc.c (flag_short_enums): Declare.
(gnat_post_options): Set it.

From-SVN: r207037

gcc/ada/ChangeLog
gcc/ada/gcc-interface/misc.c

index 351b9ed6bfab62478d0e7e3a4fe808481c388556..c1b524456c08a19ef4971018bfdd0d91d6e5aee7 100644 (file)
@@ -26,6 +26,8 @@
 2014-01-24  Tristan Gingold  <gingold@adacore.com>
 
        * back_end.adb (Scan_Compiler_Arguments): Set Short_Enums_On_Target.
+       * gcc-interface/misc.c (flag_short_enums): Declare.
+       (gnat_post_options): Set it.
 
 2014-01-24  Vincent Celier  <celier@adacore.com>
 
index fc74be28fb84393a02eac0c7e5055a2218989041..0272050954f053ddc0ad73d3531c5035c3e30640 100644 (file)
@@ -224,10 +224,12 @@ gnat_init_options (unsigned int decoded_options_count,
 #undef optimize
 #undef optimize_size
 #undef flag_compare_debug
+#undef flag_short_enums
 #undef flag_stack_check
 int optimize;
 int optimize_size;
 int flag_compare_debug;
+int flag_short_enums;
 enum stack_check_type flag_stack_check = NO_STACK_CHECK;
 
 /* Settings adjustments after switches processing by the back-end.
@@ -258,6 +260,12 @@ gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED)
   flag_compare_debug = global_options.x_flag_compare_debug;
   flag_stack_check = global_options.x_flag_stack_check;
 
+  /* Unfortunately the post_options hook is called before setting the
+     short_enums flag. Set it now.  */
+  if (global_options.x_flag_short_enums == 2)
+    global_options.x_flag_short_enums = targetm.default_short_enums ();
+  flag_short_enums = global_options.x_flag_short_enums;
+
   return false;
 }