aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2015-11-18 21:17:51 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2015-11-18 21:17:51 +0000
commit5f29a394cdb78df249577d86e39b8c37aab2875d (patch)
tree1cf089adf1f5a0d1780ded1dc1a15349185a7842 /gcc/ada
parent21c7259c1c6d5de223a4150d5bd0420eef1f2925 (diff)
downloadgcc-5f29a394cdb78df249577d86e39b8c37aab2875d.zip
gcc-5f29a394cdb78df249577d86e39b8c37aab2875d.tar.gz
gcc-5f29a394cdb78df249577d86e39b8c37aab2875d.tar.bz2
misc.c: Move global variables to the top of the file.
* gcc-interface/misc.c: Move global variables to the top of the file. (gnat_handle_option): Remove obsolete ATTRIBUTE_UNUSED markers. (gnat_init_options): Minor tweak. (gnat_post_options): Set -fstrict-overflow if not done by the user. (internal_error_function): Minor reformatting. From-SVN: r230569
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog10
-rw-r--r--gcc/ada/gcc-interface/misc.c63
2 files changed, 43 insertions, 30 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 6c4a850..2f8dfc9 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,13 @@
2015-11-18 Eric Botcazou <ebotcazou@adacore.com>
+ * gcc-interface/misc.c: Move global variables to the top of the file.
+ (gnat_handle_option): Remove obsolete ATTRIBUTE_UNUSED markers.
+ (gnat_init_options): Minor tweak.
+ (gnat_post_options): Set -fstrict-overflow if not done by the user.
+ (internal_error_function): Minor reformatting.
+
+2015-11-18 Eric Botcazou <ebotcazou@adacore.com>
+
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Use case #1
for the renaming of an address.
@@ -269,7 +277,6 @@
2015-11-18 Hristian Kirtchev <kirtchev@adacore.com>
PR ada/66242
-
* exp_ch3.adb (Default_Initialize_Object): Reimplemented. Abort
defer / undefer pairs are now encapsulated in a block with
an AT END handler. Partial finalization now takes restriction
@@ -7919,7 +7926,6 @@
2015-03-01 Arnaud Charlet <charlet@adacore.com>
PR ada/65259
-
* doc/gnat_ugn/gnat_project_manager.rst,
doc/gnat_ugn/platform_specific_information.rst: Remove reference to
image, too troublesome with texi format.
diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index 0e5de24..2a65142 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -62,9 +62,28 @@ void *callgraph_info_file = NULL;
unsigned int save_argc;
const char **save_argv;
-/* GNAT argc and argv. */
+/* GNAT argc and argv generated by the binder for all Ada programs. */
extern int gnat_argc;
-extern char **gnat_argv;
+extern const char **gnat_argv;
+
+/* Ada code requires variables for these settings rather than elements
+ of the global_options structure because they are imported. */
+int gnat_encodings = 0;
+
+#undef optimize
+int optimize;
+
+#undef optimize_size
+int optimize_size;
+
+#undef flag_compare_debug
+int flag_compare_debug;
+
+#undef flag_short_enums
+int flag_short_enums;
+
+#undef flag_stack_check
+enum stack_check_type flag_stack_check = NO_STACK_CHECK;
#ifdef __cplusplus
extern "C" {
@@ -118,9 +137,8 @@ gnat_option_lang_mask (void)
are marked as Ada-specific. Return true on success or false on failure. */
static bool
-gnat_handle_option (size_t scode, const char *arg ATTRIBUTE_UNUSED, int value,
- int kind ATTRIBUTE_UNUSED, location_t loc ATTRIBUTE_UNUSED,
- const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED)
+gnat_handle_option (size_t scode, const char *arg, int value, int kind,
+ location_t loc, const struct cl_option_handlers *handlers)
{
enum opt_code code = (enum opt_code) scode;
@@ -164,8 +182,8 @@ gnat_handle_option (size_t scode, const char *arg ATTRIBUTE_UNUSED, int value,
Ada_handle_option_auto (&global_options, &global_options_set,
scode, arg, value,
- gnat_option_lang_mask (), kind,
- loc, handlers, global_dc);
+ gnat_option_lang_mask (), kind, loc,
+ handlers, global_dc);
return true;
}
@@ -194,11 +212,9 @@ gnat_init_options (unsigned int decoded_options_count,
??? back_end.adb should not rely on this; instead, it should work with
decoded options without such reparsing, to ensure consistency in how
options are decoded. */
- unsigned int i;
-
save_argv = XNEWVEC (const char *, 2 * decoded_options_count + 1);
save_argc = 0;
- for (i = 0; i < decoded_options_count; i++)
+ for (unsigned int i = 0; i < decoded_options_count; i++)
{
size_t num_elements = decoded_options[i].canonical_option_num_elements;
@@ -223,25 +239,12 @@ gnat_init_options (unsigned int decoded_options_count,
}
save_argv[save_argc] = NULL;
- gnat_argv = (char **) xmalloc (sizeof (save_argv[0]));
- gnat_argv[0] = xstrdup (save_argv[0]); /* name of the command */
+ /* Pass just the name of the command through the regular channel. */
+ gnat_argv = (const char **) xmalloc (sizeof (char *));
+ gnat_argv[0] = xstrdup (save_argv[0]);
gnat_argc = 1;
}
-/* Ada code requires variables for these settings rather than elements
- of the global_options structure. */
-#undef optimize
-#undef optimize_size
-#undef flag_compare_debug
-#undef flag_short_enums
-#undef flag_stack_check
-int gnat_encodings = 0;
-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.
Note that the front-end switches processing (Scan_Compiler_Arguments)
has not been done yet at this point! */
@@ -262,6 +265,10 @@ gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED)
if (!global_options_set.x_flag_diagnostics_show_caret)
global_dc->show_caret = false;
+ /* Set strict overflow by default for Ada. */
+ if (!global_options_set.x_flag_strict_overflow)
+ global_options.x_flag_strict_overflow = true;
+
/* Warn only if STABS is not the default: we don't want to emit a warning if
the user did not use a -gstabs option. */
if (PREFERRED_DEBUGGING_TYPE != DBX_DEBUG && write_symbols == DBX_DEBUG)
@@ -287,8 +294,8 @@ gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED)
/* Here is the function to handle the compiler error processing in GCC. */
static void
-internal_error_function (diagnostic_context *context,
- const char *msgid, va_list *ap)
+internal_error_function (diagnostic_context *context, const char *msgid,
+ va_list *ap)
{
text_info tinfo;
char *buffer, *p, *loc;