From patchwork Wed Jun 26 22:58:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 254913 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 106E42C007C for ; Thu, 27 Jun 2013 08:58:31 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=baK1kIuVFgaAstRclxP/H/I6w5PtY76j8NuQHSTO21ls2QllPlReE EGqD7r4rsGyR9Gg9YzZKti7VnSBaotptHcOYOwma+8MkSKLr0qENmHP5TmlC9Lu+ xdP+5EEEbdvCo33fhwrhOLhGXPKxCJ5XxlCPsnaQmsq8b7f9TEM2wY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=qpr0W6IIXYzzE06gK/tuTHVV3E8=; b=EngVZm8rlnaW7CtD2E4z e1zQCPMPIERCvTsu8P130StScX+p6Bg1fJ7xC01RIrYJ6umn5wi+HsOC1WkL/o51 bvPFz67N9QkgYTwDS5fbkgCcduMatDk4GFauJI5/egieSxuSP0fu3NqcHFgenjG1 H8fHU5f2KFs7YG7gCbQamxw= Received: (qmail 19064 invoked by alias); 26 Jun 2013 22:58:24 -0000 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 Received: (qmail 19034 invoked by uid 89); 26 Jun 2013 22:58:19 -0000 X-Spam-SWARE-Status: No, score=-3.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, SPF_PASS, TW_CB, TW_FC autolearn=ham version=3.3.1 Received: from mail-pb0-f54.google.com (HELO mail-pb0-f54.google.com) (209.85.160.54) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 26 Jun 2013 22:58:18 +0000 Received: by mail-pb0-f54.google.com with SMTP id ro2so55726pbb.13 for ; Wed, 26 Jun 2013 15:58:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-type:x-gm-message-state; bh=u3YNQJytHcdpOzT2FAsyJdSD8t6SiXfjtVS57siX8bM=; b=Van+vQOQN0ADzezR5twBkEL/dxkmx5PNvL9CIy3AhA5QUXrA0FVQni5PGTdwbotFts 4E9FwagTu+mRy5E2WzSoQr9y+0QwwA+RnakBTT/GSqoB9BpCsrBajWAuuBQw/2z3Cml6 xmiQyMsJKNyXNc0vovdXeR2f8JBSvjJR2pzrwaPlzOvFAnkSiuk52nswNJFZ70+rpcuy FSVZ8baiApE9gNQaoG/1OU1OyASJKXphyB+qefvLhLjm1NpXQUcYeky+0ySfDR9ZgzF1 5fUYixrSh9xETcZrG7u462osnIvlDKjS08LANN/TT8WEUaZlLpiBQtRs1Edhn8Ha3EBe 1vGw== X-Received: by 10.66.186.79 with SMTP id fi15mr2928465pac.160.1372287496896; Wed, 26 Jun 2013 15:58:16 -0700 (PDT) Received: from iant-glaptop.roam.corp.google.com.google.com ([2620:0:1000:3204:d9b0:cba3:0:7850]) by mx.google.com with ESMTPSA id z5sm105868pbk.0.2013.06.26.15.58.16 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 26 Jun 2013 15:58:16 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org Subject: Go patch committed: Disallow fallthrough at end of switch Date: Wed, 26 Jun 2013 15:58:15 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmp0wzkTSHIZD7GfwoKVZ40bUgDqjqMWJO0aBDW7Vq3p9j8Ij72ohbmIoDI5WKjg4bScDkR3VXbtXpDxgGLjzKqQvaMVHCQO6DorfuAk93nJgYpDB4JlV9EMBioyFej47Ly+FkMtUCCulENZ89auTaEzGdI54aUBZ4edl8LpsGlvyeAX9j/7iSaWLArgQOOrFIPo3JsVjYaqggbWleljbI+jDbJTJqO1kki+tdOTlz2k+vvYlI= X-Virus-Found: No In Go 1 the fallthrough statement is no longer permitted in the last case of a switch, as there is no code to which to fall through. This patch from Rémy Oudompheng implements this restriction in gccgo. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline and 4.8 branch. Ian diff -r 133fcbfa33c6 go/parse.cc --- a/go/parse.cc Wed Jun 26 15:31:30 2013 -0700 +++ b/go/parse.cc Wed Jun 26 15:44:23 2013 -0700 @@ -4523,9 +4523,12 @@ bool is_fallthrough = false; if (this->peek_token()->is_keyword(KEYWORD_FALLTHROUGH)) { + Location fallthrough_loc = this->location(); is_fallthrough = true; if (this->advance_token()->is_op(OPERATOR_SEMICOLON)) this->advance_token(); + if (this->peek_token()->is_op(OPERATOR_RCURLY)) + error_at(fallthrough_loc, _("cannot fallthrough final case in switch")); } if (is_default)