From patchwork Tue Oct 5 10:18:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 66811 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 EA45BB70B8 for ; Tue, 5 Oct 2010 21:18:49 +1100 (EST) Received: (qmail 13227 invoked by alias); 5 Oct 2010 10:18:42 -0000 Received: (qmail 13213 invoked by uid 22791); 5 Oct 2010 10:18:42 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 05 Oct 2010 10:18:37 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 8C82DCB026D; Tue, 5 Oct 2010 12:18:35 +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 2PAJOP0o9gm7; Tue, 5 Oct 2010 12:18:35 +0200 (CEST) Received: from saumur.act-europe.fr (saumur.act-europe.fr [10.10.0.183]) by mel.act-europe.fr (Postfix) with ESMTP id 75719CB024C; Tue, 5 Oct 2010 12:18:35 +0200 (CEST) Received: by saumur.act-europe.fr (Postfix, from userid 525) id 58CBCD9BB5; Tue, 5 Oct 2010 12:18:35 +0200 (CEST) Date: Tue, 5 Oct 2010 12:18:35 +0200 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Ed Schonberg Subject: [Ada] Rejecting duplicate stubs Message-ID: <20101005101835.GA19873@adacore.com> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.9i X-IsSubscribed: yes 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 The compiler did not reject duplicate stubs for task bodies. Compiling dupsep.adb must yield: dupsep.adb:5:04: duplicate stub for task --- package Dupsep is procedure Start; end Dupsep; --- package body Dupsep is task type Bugger is end Bugger; task body bugger is separate; task body bugger is separate; procedure Start is begin null; end Start; end Dupsep; --- separate (Dupsep) task body Bugger is begin null; end Bugger; Tested on x86_64-pc-linux-gnu, committed on trunk 2010-10-05 Ed Schonberg * sem_ch10.adb (Analyze_Task_Body_Stub): Diagnose duplicate stub for task. Index: sem_ch10.adb =================================================================== --- sem_ch10.adb (revision 164934) +++ sem_ch10.adb (working copy) @@ -2272,7 +2272,16 @@ package body Sem_Ch10 is else Set_Scope (Defining_Entity (N), Current_Scope); Generate_Reference (Nam, Defining_Identifier (N), 'b'); - Set_Has_Completion (Etype (Nam)); + + -- Check for duplicate stub, if so give message and terminate + + if Has_Completion (Etype (Nam)) then + Error_Msg_N ("duplicate stub for task", N); + return; + else + Set_Has_Completion (Etype (Nam)); + end if; + Analyze_Proper_Body (N, Etype (Nam)); -- Set elaboration flag to indicate that entity is callable. This