From patchwork Mon Apr 27 09:55:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 464925 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5FE161402B6 for ; Mon, 27 Apr 2015 19:55:57 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=la+JHIIc; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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 :content-transfer-encoding; q=dns; s=default; b=da8e7IRrX4eY8FdY qGBYuPThSphldYS0lAcsRUIJFxf4icD0HtCVBMhzGVk9m7SYtFlAvfa8LyaXdkvp x0A+V/G8GedLtQ3Ft/Jq3mmwk8PpazKPQ5WM++iBWjKB/hIByiFicEr+1d0uWpUt udHeIrznKDtm+SgQsJu5WQwWNok= 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 :content-transfer-encoding; s=default; bh=SsCnHrzqcGKxMNyU8XlPFT soQ8o=; b=la+JHIIc2xGRD9yQg6HM7UeqLRu9dUXg30O/kDRX4ib9ERSwXnMW7g s/k8c7HnH3sPf61lMSsAPDOOMc77HBjLJTbpoyoJX3eBXeGLrRwSq2ieynYIjMid 148Vb9B1W3eIAjPEfe8f38yfX/dQbRxlHTeg27PKVFU20dpNqCTWs= Received: (qmail 100951 invoked by alias); 27 Apr 2015 09:55:37 -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 100785 invoked by uid 89); 27 Apr 2015 09:55:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (207.82.80.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 27 Apr 2015 09:55:34 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by uk-mta-26.uk.mimecast.lan; Mon, 27 Apr 2015 10:55:31 +0100 Received: from localhost ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 27 Apr 2015 10:55:31 +0100 From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [committed] Make arguments to vec::splice const User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) Date: Mon, 27 Apr 2015 10:55:31 +0100 Message-ID: <87vbghyjxo.fsf@e105548-lin.cambridge.arm.com> MIME-Version: 1.0 X-MC-Unique: EDrz61BuQa28yUxJxJQ_ew-1 vec::splice doesn't modify its source vector, so mark the argument as const. Tested on x86_64-linux-gnu. Applied as obvious. Richard gcc/ * vec.h (vec): Make splice arguments const. Update definitions accordingly. Index: gcc/vec.h =================================================================== --- gcc/vec.h 2015-04-27 10:38:48.000000000 +0100 +++ gcc/vec.h 2015-04-27 10:41:57.859920289 +0100 @@ -483,8 +483,8 @@ struct GTY((user)) vec bool iterate (unsigned, T *) const; bool iterate (unsigned, T **) const; vec *copy (ALONE_CXX_MEM_STAT_INFO) const; - void splice (vec &); - void splice (vec *src); + void splice (const vec &); + void splice (const vec *src); T *quick_push (const T &); T &pop (void); void truncate (unsigned); @@ -705,7 +705,7 @@ vec_safe_copy (vec *src Reallocate DST, if necessary. */ template inline void -vec_safe_splice (vec *&dst, vec *src +vec_safe_splice (vec *&dst, const vec *src CXX_MEM_STAT_INFO) { unsigned src_len = vec_safe_length (src); @@ -836,7 +836,7 @@ vec::copy (ALONE_MEM_STA template inline void -vec::splice (vec &src) +vec::splice (const vec &src) { unsigned len = src.length (); if (len) @@ -849,7 +849,7 @@ vec::splice (vec inline void -vec::splice (vec *src) +vec::splice (const vec *src) { if (src) splice (*src); @@ -1212,8 +1212,8 @@ struct vec vec copy (ALONE_CXX_MEM_STAT_INFO) const; bool reserve (unsigned, bool = false CXX_MEM_STAT_INFO); bool reserve_exact (unsigned CXX_MEM_STAT_INFO); - void splice (vec &); - void safe_splice (vec & CXX_MEM_STAT_INFO); + void splice (const vec &); + void safe_splice (const vec & CXX_MEM_STAT_INFO); T *quick_push (const T &); T *safe_push (const T &CXX_MEM_STAT_INFO); T &pop (void); @@ -1489,7 +1489,7 @@ vec::release (void) template inline void -vec::splice (vec &src) +vec::splice (const vec &src) { if (src.m_vec) m_vec->splice (*(src.m_vec)); @@ -1503,7 +1503,7 @@ vec::splice (vec inline void -vec::safe_splice (vec &src +vec::safe_splice (const vec &src MEM_STAT_DECL) { if (src.length ())