From 7934d78179a91cf3f2c03ce6c6b2c014ac61fdab Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 8 Mar 2008 12:44:51 +0000 Subject: [PATCH] lang.opt (nostdlib): Move around. * lang.opt (nostdlib): Move around. * misc.c (gnat_handle_option): Fix formatting. (gnat_dwarf_name): Move around. * trans.c (Case_Statement_to_gnu): Fix formatting. (gnat_to_gnu): Likewise. * utils.c (aggregate_type_contains_array_p): Likewise. (create_subprog_decl): Likewise. From-SVN: r133035 --- gcc/ada/ChangeLog | 10 +++++++++ gcc/ada/ada-tree.def | 2 +- gcc/ada/ada.h | 10 ++++----- gcc/ada/lang.opt | 8 +++---- gcc/ada/misc.c | 27 +++++++++++------------ gcc/ada/trans.c | 52 +++++++++++++++++++++----------------------- gcc/ada/utils.c | 26 +++++++++++----------- 7 files changed, 71 insertions(+), 64 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 1f3665585e8..75d19106dc9 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,13 @@ +2008-03-08 Eric Botcazou + + * lang.opt (nostdlib): Move around. + * misc.c (gnat_handle_option): Fix formatting. + (gnat_dwarf_name): Move around. + * trans.c (Case_Statement_to_gnu): Fix formatting. + (gnat_to_gnu): Likewise. + * utils.c (aggregate_type_contains_array_p): Likewise. + (create_subprog_decl): Likewise. + 2008-03-08 Eric Botcazou * decl.c (gnat_to_gnu_entity) : Do not diff --git a/gcc/ada/ada-tree.def b/gcc/ada/ada-tree.def index 83157a269a2..0a1949f6710 100644 --- a/gcc/ada/ada-tree.def +++ b/gcc/ada/ada-tree.def @@ -6,7 +6,7 @@ * * * Specification * * * - * Copyright (C) 1992-2004, 2007 Free Software Foundation, Inc. * + * Copyright (C) 1992-2007, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * diff --git a/gcc/ada/ada.h b/gcc/ada/ada.h index a55d0137ad9..5f2191fdec9 100644 --- a/gcc/ada/ada.h +++ b/gcc/ada/ada.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 1992-2003 Free Software Foundation, Inc. * + * Copyright (C) 1992-2008, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -37,7 +37,7 @@ #define GCC_ADA_H /* Inlined functions in header are preceded by INLINE, which is normally set - to extern inline for GCC, but may be set to static for use in standard + to extern inline for GCC, but may be set to static for use in standard ANSI-C. */ #ifndef INLINE @@ -58,10 +58,10 @@ #define CAT(A,B) ECHO(A)B #endif -/* The following macro definition simulates the effect of a declaration of +/* The following macro definition simulates the effect of a declaration of a subtype, where the first two parameters give the name of the type and subtype, and the third and fourth parameters give the subtype range. The - effect is to compile a typedef defining the subtype as a synonym for the + effect is to compile a typedef defining the subtype as a synonym for the type, together with two constants defining the end points. */ #define SUBTYPE(SUBTYPE,TYPE,FIRST,LAST) \ @@ -70,7 +70,7 @@ CAT (SUBTYPE,__Last) = LAST }; /* The following definitions provide the equivalent of the Ada IN and NOT IN - operators, assuming that the subtype involved has been defined using the + operators, assuming that the subtype involved has been defined using the SUBTYPE macro defined above. */ #define IN(VALUE,SUBTYPE) \ diff --git a/gcc/ada/lang.opt b/gcc/ada/lang.opt index 3aecdc76abf..0d541bf845a 100644 --- a/gcc/ada/lang.opt +++ b/gcc/ada/lang.opt @@ -69,16 +69,16 @@ nostdinc Ada RejectNegative ; Don't look for source files +nostdlib +Ada +; Don't look for object files + feliminate-unused-debug-types Ada ; Effect documented for C - intercepted for Ada to force the associated flag ; not to be set by default, as it currently eliminates unreferenced parallel ; types we need for encoding descriptions to the debugger. -nostdlib -Ada -; Don't look for object files - fRTS= Ada Joined RejectNegative ; Selects the runtime diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c index 3845ba8242d..da0f2d96a0a 100644 --- a/gcc/ada/misc.c +++ b/gcc/ada/misc.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2007, Free Software Foundation, Inc. * + * Copyright (C) 1992-2008, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -126,7 +126,7 @@ static tree gnat_type_max_size (const_tree); #undef LANG_HOOKS_PUSHDECL #define LANG_HOOKS_PUSHDECL gnat_return_tree #undef LANG_HOOKS_WRITE_GLOBALS -#define LANG_HOOKS_WRITE_GLOBALS gnat_write_global_declarations +#define LANG_HOOKS_WRITE_GLOBALS gnat_write_global_declarations #undef LANG_HOOKS_FINISH_INCOMPLETE_DECL #define LANG_HOOKS_FINISH_INCOMPLETE_DECL gnat_finish_incomplete_decl #undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS @@ -303,9 +303,9 @@ gnat_handle_option (size_t scode, const char *arg, int value) case OPT_feliminate_unused_debug_types: /* We arrange for post_option to be able to only set the corresponding - flag to 1 when explicitely requested by the user. We expect the - default flag value to be either 0 or positive, and expose a positive - -f as a negative value to post_option. */ + flag to 1 when explicitely requested by the user. We expect the + default flag value to be either 0 or positive, and expose a positive + -f as a negative value to post_option. */ flag_eliminate_unused_debug_types = -value; break; @@ -527,7 +527,6 @@ gnat_init_gcc_eh (void) marked as "cannot trap" if the flag is not set (see emit_libcall_block). We should not let this be since it is possible for such calls to actually raise in Ada. */ - flag_exceptions = 1; flag_non_call_exceptions = 1; @@ -614,6 +613,14 @@ gnat_print_type (FILE *file, tree node, int indent) } } +static const char * +gnat_dwarf_name (tree t, int verbosity ATTRIBUTE_UNUSED) +{ + gcc_assert (DECL_P (t)); + + return (const char *) IDENTIFIER_POINTER (DECL_NAME (t)); +} + static const char * gnat_printable_name (tree decl, int verbosity) { @@ -631,14 +638,6 @@ gnat_printable_name (tree decl, int verbosity) return (const char *) ada_name; } -static const char * -gnat_dwarf_name (tree t, int verbosity ATTRIBUTE_UNUSED) -{ - gcc_assert (DECL_P (t)); - - return (const char *) IDENTIFIER_POINTER (DECL_NAME (t)); -} - /* Expands GNAT-specific GCC tree nodes. The only ones we support here are and NULL_EXPR. */ diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index 5cb02976627..acf4de3793d 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -1527,33 +1527,31 @@ Case_Statement_to_gnu (Node_Id gnat_node) gcc_unreachable (); } - /* If the case value is a subtype that raises Constraint_Error at - run-time because of a wrong bound, then gnu_low or gnu_high - is not translated into an INTEGER_CST. In such a case, we need - to ensure that the when statement is not added in the tree, - otherwise it will crash the gimplifier. */ - if ((!gnu_low || TREE_CODE (gnu_low) == INTEGER_CST) - && (!gnu_high || TREE_CODE (gnu_high) == INTEGER_CST)) - { - - add_stmt_with_node (build3 (CASE_LABEL_EXPR, void_type_node, - gnu_low, gnu_high, - create_artificial_label ()), - gnat_choice); - choices_added++; - } + /* If the case value is a subtype that raises Constraint_Error at + run-time because of a wrong bound, then gnu_low or gnu_high is + not transtaleted into an INTEGER_CST. In such a case, we need + to ensure that the when statement is not added in the tree, + otherwise it will crash the gimplifier. */ + if ((!gnu_low || TREE_CODE (gnu_low) == INTEGER_CST) + && (!gnu_high || TREE_CODE (gnu_high) == INTEGER_CST)) + { + add_stmt_with_node (build3 (CASE_LABEL_EXPR, void_type_node, + gnu_low, gnu_high, + create_artificial_label ()), + gnat_choice); + choices_added++; + } } - /* Push a binding level here in case variables are declared since we want - them to be local to this set of statements instead of the block - containing the Case statement. */ - - if (choices_added > 0) - { - add_stmt (build_stmt_group (Statements (gnat_when), true)); - add_stmt (build1 (GOTO_EXPR, void_type_node, - TREE_VALUE (gnu_switch_label_stack))); - } + /* Push a binding level here in case variables are declared as we want + them to be local to this set of statements instead of to the block + containing the Case statement. */ + if (choices_added > 0) + { + add_stmt (build_stmt_group (Statements (gnat_when), true)); + add_stmt (build1 (GOTO_EXPR, void_type_node, + TREE_VALUE (gnu_switch_label_stack))); + } } /* Now emit a definition of the label all the cases branched to. */ @@ -4244,7 +4242,7 @@ gnat_to_gnu (Node_Id gnat_node) for (gnat_temp = First_Formal_With_Extras - (Defining_Entity (Specification (gnat_node))); + (Defining_Entity (Specification (gnat_node))); Present (gnat_temp); gnat_temp = Next_Formal_With_Extras (gnat_temp)) if (Is_Itype (Etype (gnat_temp)) @@ -6299,7 +6297,7 @@ assoc_to_constructor (Entity_Id gnat_entity, Node_Id gnat_assoc, tree gnu_type) { tree gnu_field; - /* Verify every enty in GNU_LIST was used. */ + /* Verify every entry in GNU_LIST was used. */ for (gnu_field = gnu_list; gnu_field; gnu_field = TREE_CHAIN (gnu_field)) gcc_assert (TREE_ADDRESSABLE (gnu_field)); } diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index f1ffa4f7b29..58f0b68c4fc 100644 --- a/gcc/ada/utils.c +++ b/gcc/ada/utils.c @@ -1554,7 +1554,7 @@ aggregate_type_contains_array_p (tree type) case ARRAY_TYPE: return true; - + default: gcc_unreachable (); } @@ -1932,18 +1932,18 @@ create_subprog_decl (tree subprog_name, tree asm_name, DECL_ARTIFICIAL (DECL_RESULT (subprog_decl)) = 1; DECL_IGNORED_P (DECL_RESULT (subprog_decl)) = 1; - /* TREE_ADDRESSABLE is set on the result type to request the use of the - target by-reference return mechanism. This is not supported all the - way down to RTL expansion with GCC 4, which ICEs on temporary creation - attempts with such a type and expects DECL_BY_REFERENCE to be set on - the RESULT_DECL instead - see gnat_genericize for more details. */ - if (TREE_ADDRESSABLE (TREE_TYPE (DECL_RESULT (subprog_decl)))) - { - tree result_decl = DECL_RESULT (subprog_decl); - - TREE_ADDRESSABLE (TREE_TYPE (result_decl)) = 0; - DECL_BY_REFERENCE (result_decl) = 1; - } + /* TREE_ADDRESSABLE is set on the result type to request the use of the + target by-reference return mechanism. This is not supported all the + way down to RTL expansion with GCC 4, which ICEs on temporary creation + attempts with such a type and expects DECL_BY_REFERENCE to be set on + the RESULT_DECL instead - see gnat_genericize for more details. */ + if (TREE_ADDRESSABLE (TREE_TYPE (DECL_RESULT (subprog_decl)))) + { + tree result_decl = DECL_RESULT (subprog_decl); + + TREE_ADDRESSABLE (TREE_TYPE (result_decl)) = 0; + DECL_BY_REFERENCE (result_decl) = 1; + } if (inline_flag) DECL_DECLARED_INLINE_P (subprog_decl) = 1; -- 2.30.2