From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26909 invoked by alias); 12 Apr 2017 16:19:57 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 25863 invoked by uid 89); 12 Apr 2017 16:19:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=perfect X-HELO: mail-wm0-f49.google.com Received: from mail-wm0-f49.google.com (HELO mail-wm0-f49.google.com) (74.125.82.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Apr 2017 16:19:55 +0000 Received: by mail-wm0-f49.google.com with SMTP id u2so28004046wmu.0 for ; Wed, 12 Apr 2017 09:19:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=yh1PTGBwc9qrOBiPs21uRgt024xthtRhklNSQe9aoAM=; b=hOX9G9J1CGdvhiI9UM8FVaopLtGDUwMM0y641DfbQY7yUZdvwmFk3ILUSf1swn0aSs ZGUTrHuJ20i9srJ8lhhvfWoHL3OFJVy8z6O2Q7b62nCK07aU2I1kaUvCPSUmFzK6Uxme Q/J2RS5lp8NPW1/v06XxrTy91SKWBWB31Bfwtzenm2CrnTnn0svzPTYKvdhU9aCncXPb LEdmnxa77yteKSMLdCH64Te4+BIaxTXh5GYYjUyOCPfqB9qc2b716aQsBeG318L/56oJ z3r9xvyFXfGG+/O0WvWkx049KU7uJHztXXRQbcL/74d4QBwoKssDJPsKf02l2uzoR588 APEQ== X-Gm-Message-State: AN3rC/7aYLzIvb72PEHunCFenSv484DaZWLIKDwR6yntLpaMg/q6uTnD6MHmtjGVLPInUifK X-Received: by 10.28.170.212 with SMTP id t203mr3661897wme.4.1492013994879; Wed, 12 Apr 2017 09:19:54 -0700 (PDT) Received: from [192.168.0.101] ([37.189.166.198]) by smtp.gmail.com with ESMTPSA id j26sm6770658wrb.19.2017.04.12.09.19.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Apr 2017 09:19:54 -0700 (PDT) Subject: Re: [RFA v2 10/17] C++ify mi_parse To: Tom Tromey References: <20170411150112.23207-1-tom@tromey.com> <20170411150112.23207-11-tom@tromey.com> <56430d1d-abb1-5e22-87dd-14158939d842@redhat.com> <87y3v561rm.fsf@tromey.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <59b6549f-3232-64c0-2f3c-5469f1f3ca6f@redhat.com> Date: Wed, 12 Apr 2017 16:19:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <87y3v561rm.fsf@tromey.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-04/txt/msg00349.txt.bz2 On 04/12/2017 05:15 PM, Tom Tromey wrote: >>>>>> "Pedro" == Pedro Alves writes: > > Pedro> The patch made mi_parse be a non-POD (non-trivial dtor), so I > Pedro> think we should get rid of that memset at the same time. > > This change was a little bigger than the others. I've added this > constructor: > > mi_parse::mi_parse () > : op (MI_COMMAND), > command (NULL), > token (NULL), > cmd (NULL), > cmd_start (NULL), > args (NULL), > argv (NULL), > argc (0), > all (0), > thread_group (-1), > thread (-1), > frame (-1), > language (language_unknown) > { > } > Thanks. Totally fine with me. If you prefer, using in-class initialization is also fine. (We've been using it more in recent patches.) > ... and changed the construction of the object like: > > @@ -241,12 +241,5 @@ > > - memset (parse, 0, sizeof (*parse)); > - parse->all = 0; > - parse->thread_group = -1; > - parse->thread = -1; > - parse->frame = -1; > - parse->language = language_unknown; > - > - cleanup = make_cleanup (mi_parse_cleanup, parse); > + std::unique_ptr parse (new struct mi_parse); > Perfect. Thanks, Pedro Alves