From patchwork Sun Sep 19 13:12:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 65159 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 94052B70B8 for ; Sun, 19 Sep 2010 23:18:48 +1000 (EST) Received: (qmail 15005 invoked by alias); 19 Sep 2010 13:18:46 -0000 Received: (qmail 14993 invoked by uid 22791); 19 Sep 2010 13:18:45 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, TW_TM, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (140.186.70.10) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 19 Sep 2010 13:18:39 +0000 Received: from eggs.gnu.org ([140.186.70.92]:35395) by fencepost.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1OxJmv-0006NR-Bf for gcc-patches@gnu.org; Sun, 19 Sep 2010 09:18:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OxJmt-0001N5-AQ for gcc-patches@gnu.org; Sun, 19 Sep 2010 09:18:36 -0400 Received: from mel.act-europe.fr ([212.99.106.210]:35878) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OxJms-0001Mr-U7 for gcc-patches@gnu.org; Sun, 19 Sep 2010 09:18:35 -0400 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 8C9B2CB02A8 for ; Sun, 19 Sep 2010 15:18:34 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qumZJaR-GH2N for ; Sun, 19 Sep 2010 15:18:34 +0200 (CEST) Received: from [192.168.1.2] (bon31-9-83-155-120-49.fbx.proxad.net [83.155.120.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 5B60ACB0202 for ; Sun, 19 Sep 2010 15:18:34 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gnu.org Subject: [Ada] Housekeeping work in gigi (29/n) Date: Sun, 19 Sep 2010 15:12:04 +0200 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Message-Id: <201009191512.04938.ebotcazou@adacore.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Tested on i586-suse-linux, applied on the mainline. 2010-09-19 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_entity): Explicitly test _LEVEL variables against zero in all cases. (rest_of_type_decl_compilation): Likewise. * gcc-interface/trans.c (gigi): Pass properly typed constants to create_var_decl. (call_to_gnu): Fix formatting. (Handled_Sequence_Of_Statements_to_gnu): Likewise. (Exception_Handler_to_gnu_zcx): Likewise. (gnat_to_gnu) : Short-circuit handling of constant expressions in presence of a freeze node. Index: gcc-interface/decl.c =================================================================== --- gcc-interface/decl.c (revision 164414) +++ gcc-interface/decl.c (working copy) @@ -3510,7 +3510,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entit && TYPE_IS_DUMMY_P (TREE_TYPE (get_gnu_tree (gnat_desig_equiv)))) || (!in_main_unit - && defer_incomplete_level + && defer_incomplete_level != 0 && !present_gnu_tree (gnat_desig_equiv)) || (in_main_unit && is_from_limited_with @@ -3594,7 +3594,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entit access type may be the full view of a private type. Note that the unconstrained array case is handled above. */ || ((!in_main_unit || imported_p) - && defer_incomplete_level + && defer_incomplete_level != 0 && !present_gnu_tree (gnat_desig_equiv) && (Is_Record_Type (gnat_desig_rep) || Is_Array_Type (gnat_desig_rep))) @@ -3728,7 +3728,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entit Besides, variants of this non-dummy type might have been created along the way. update_pointer_to is expected to properly take care of those situations. */ - if (!defer_incomplete_level && !is_from_limited_with_in_main_unit) + if (defer_incomplete_level == 0 + && !is_from_limited_with_in_main_unit) update_pointer_to (TYPE_MAIN_VARIANT (gnu_old_desig_type), gnat_to_gnu_type (gnat_desig_equiv)); else @@ -5045,7 +5046,7 @@ rest_of_type_decl_compilation (tree decl { /* We need to defer finalizing the type if incomplete types are being deferred or if they are being processed. */ - if (defer_incomplete_level || defer_finalize_level) + if (defer_incomplete_level != 0 || defer_finalize_level != 0) VEC_safe_push (tree, heap, defer_finalize_list, decl); else rest_of_type_decl_compilation_no_defer (decl); Index: gcc-interface/trans.c =================================================================== --- gcc-interface/trans.c (revision 164413) +++ gcc-interface/trans.c (working copy) @@ -593,12 +593,14 @@ gigi (Node_Id gnat_root, int max_gnat_no others_decl = create_var_decl (get_identifier ("OTHERS"), get_identifier ("__gnat_others_value"), - integer_type_node, 0, 1, 0, 1, 1, 0, Empty); + integer_type_node, NULL_TREE, true, false, true, false, + NULL, Empty); all_others_decl = create_var_decl (get_identifier ("ALL_OTHERS"), get_identifier ("__gnat_all_others_value"), - integer_type_node, 0, 1, 0, 1, 1, 0, Empty); + integer_type_node, NULL_TREE, true, false, true, false, + NULL, Empty); main_identifier_node = get_identifier ("main"); @@ -2788,8 +2790,8 @@ call_to_gnu (Node_Id gnat_node, tree *gn /* Create an explicit temporary holding the copy. This ensures that its lifetime is as narrow as possible around a statement. */ gnu_temp = create_var_decl (create_tmp_var_name ("A"), NULL_TREE, - TREE_TYPE (gnu_name), NULL_TREE, false, - false, false, false, NULL, Empty); + TREE_TYPE (gnu_name), NULL_TREE, + false, false, false, false, NULL, Empty); DECL_ARTIFICIAL (gnu_temp) = 1; DECL_IGNORED_P (gnu_temp) = 1; @@ -3210,8 +3212,8 @@ Handled_Sequence_Of_Statements_to_gnu (N gnu_jmpsave_decl = create_var_decl (get_identifier ("JMPBUF_SAVE"), NULL_TREE, jmpbuf_ptr_type, build_call_0_expr (get_jmpbuf_decl), - false, false, false, false, NULL, - gnat_node); + false, false, false, false, + NULL, gnat_node); DECL_ARTIFICIAL (gnu_jmpsave_decl) = 1; /* The __builtin_setjmp receivers will immediately reinstall it. Now @@ -3220,8 +3222,8 @@ Handled_Sequence_Of_Statements_to_gnu (N it is uninitialized, although they will never be actually taken. */ TREE_NO_WARNING (gnu_jmpsave_decl) = 1; gnu_jmpbuf_decl = create_var_decl (get_identifier ("JMP_BUF"), - NULL_TREE, jmpbuf_type, - NULL_TREE, false, false, false, false, + NULL_TREE, jmpbuf_type, NULL_TREE, + false, false, false, false, NULL, gnat_node); DECL_ARTIFICIAL (gnu_jmpbuf_decl) = 1; @@ -3273,12 +3275,11 @@ Handled_Sequence_Of_Statements_to_gnu (N gnat_pushlevel (); VEC_safe_push (tree, gc, gnu_except_ptr_stack, - create_var_decl (get_identifier ("EXCEPT_PTR"), - NULL_TREE, + create_var_decl (get_identifier ("EXCEPT_PTR"), NULL_TREE, build_pointer_type (except_type_node), build_call_0_expr (get_excptr_decl), - false, - false, false, false, NULL, gnat_node)); + false, false, false, false, + NULL, gnat_node)); /* Generate code for each handler. The N_Exception_Handler case does the real work and returns a COND_EXPR for each handler, which we chain @@ -3537,8 +3538,8 @@ Exception_Handler_to_gnu_zcx (Node_Id gn 1, integer_zero_node); gnu_incoming_exc_ptr = create_var_decl (get_identifier ("EXPTR"), NULL_TREE, ptr_type_node, gnu_current_exc_ptr, - false, false, false, false, NULL, - gnat_node); + false, false, false, false, + NULL, gnat_node); add_stmt_with_node (build_call_1_expr (begin_handler_decl, gnu_incoming_exc_ptr), @@ -3997,13 +3998,16 @@ gnat_to_gnu (Node_Id gnat_node) is frozen. */ if (Present (Freeze_Node (gnat_temp))) { - if ((Is_Public (gnat_temp) || global_bindings_p ()) - && !TREE_CONSTANT (gnu_expr)) + bool public_flag = Is_Public (gnat_temp); + + if (TREE_CONSTANT (gnu_expr)) + ; + else if (public_flag || global_bindings_p ()) gnu_expr = create_var_decl (create_concat_name (gnat_temp, "init"), - NULL_TREE, TREE_TYPE (gnu_expr), - gnu_expr, false, Is_Public (gnat_temp), - false, false, NULL, gnat_temp); + NULL_TREE, TREE_TYPE (gnu_expr), gnu_expr, + false, public_flag, false, false, + NULL, gnat_temp); else gnu_expr = gnat_save_expr (gnu_expr);