From patchwork Tue Jan 22 09:58:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 214482 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 440AE2C0080 for ; Tue, 22 Jan 2013 21:01:39 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1359453700; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version: Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=t1Tjy5THfhrs5YZYLNc4d7FfLvQ=; b=LiNhut99hlFm8dS WnrrmXZTntzH/BIlZ+ZxiBKbWE0dJDDz4EufF3ambEZMlqi1OiSfPDUZ/bbuUQ8P ehOiKUAnShZhP1lSkNqt+GU4bXUez6fhDlV8J+hGKgoqDcswOY24fUFJQA6ddfqN 9I5nrCGksTkymTvwdKtTt6B0adAc= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=tNVnuccE5qDDZ5eajkiwwmx7oegmGjmTok6owClr71Og98jyaSoT1fkewyUu9N BnME3i0EnDf3pV/zeCx6iDVPtIQJuanykdEGCjiORmuL9fHubmyVNO60FjBs8T9r ttTuXAxoSOwbhex1rJxZ1POlXy+/89o+rYyMfaYHsxHmc=; Received: (qmail 28689 invoked by alias); 22 Jan 2013 10:01:33 -0000 Received: (qmail 28678 invoked by uid 22791); 22 Jan 2013 10:01:32 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,TW_TM X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 22 Jan 2013 10:01:22 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 649BA29005B for ; Tue, 22 Jan 2013 11:01:31 +0100 (CET) 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 EFsqqfgaJPH7 for ; Tue, 22 Jan 2013 11:01:31 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 3E23129003B for ; Tue, 22 Jan 2013 11:01:31 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix handling of top-level pragma Optimize Date: Tue, 22 Jan 2013 10:58:40 +0100 Message-ID: <1413916.mJvCPtrma8@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.16-desktop; KDE/4.7.2; x86_64; ; ) MIME-Version: 1.0 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 It's not really a regression, but the fix is trivial: top-level pragma Optimize is ignored (as other pragmas for which gigi must do something). Tested on x86_64-suse-linux, applied on the mainline. 2013-01-22 Eric Botcazou * gcc-interface/trans.c (Pragma_to_gnu) : Use optimize_size instead of optimize and adjust warning message. (Compilation_Unit_to_gnu): Process pragmas preceding the unit. 2013-01-22 Eric Botcazou * gnat.dg/warn8.adb: New test. Index: gcc-interface/trans.c =================================================================== --- gcc-interface/trans.c (revision 195364) +++ gcc-interface/trans.c (working copy) @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2012, Free Software Foundation, Inc. * + * Copyright (C) 1992-2013, 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- * @@ -1254,16 +1254,21 @@ Pragma_to_gnu (Node_Id gnat_node) switch (Chars (Expression (First (Pragma_Argument_Associations (gnat_node))))) { - case Name_Time: case Name_Space: - if (!optimize) - post_error ("insufficient -O value?", gnat_node); - break; - case Name_Off: if (optimize) post_error ("must specify -O0?", gnat_node); break; + case Name_Space: + if (!optimize_size) + post_error ("must specify -Os?", gnat_node); + break; + + case Name_Time: + if (!optimize) + post_error ("insufficient -O value?", gnat_node); + break; + default: gcc_unreachable (); } @@ -4743,6 +4748,7 @@ Compilation_Unit_to_gnu (Node_Id gnat_no const bool body_p = (Nkind (gnat_unit) == N_Package_Body || Nkind (gnat_unit) == N_Subprogram_Body); const Entity_Id gnat_unit_entity = Defining_Entity (gnat_unit); + Node_Id gnat_pragma; /* Make the decl for the elaboration procedure. */ tree gnu_elab_proc_decl = create_subprog_decl @@ -4778,8 +4784,16 @@ Compilation_Unit_to_gnu (Node_Id gnat_no return; } + /* Then process any pragmas and declarations preceding the unit. */ + for (gnat_pragma = First (Context_Items (gnat_node)); + Present (gnat_pragma); + gnat_pragma = Next (gnat_pragma)) + if (Nkind (gnat_pragma) == N_Pragma) + add_stmt (gnat_to_gnu (gnat_pragma)); process_decls (Declarations (Aux_Decls_Node (gnat_node)), Empty, Empty, true, true); + + /* Process the unit itself. */ add_stmt (gnat_to_gnu (gnat_unit)); /* If we can inline, generate code for all the inlined subprograms. */