From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 29F853858D3C for ; Mon, 11 Sep 2023 09:17:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 29F853858D3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694423839; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6vKionDOmNb/hdiZNX73MPb0WqgE4GaK6A+WigRvxZk=; b=XNsdk3d5mXcAVWpcgOwFxVxkEt8OKhnQuFy3g9xVpPBNe5U05CvoZV6/KNMss+HdAR+05y ACC0W2xb4e54UjKoaPouYHtNnJWdgKEcwO/FdWMer2N1Io4WukDLYRBlfZUrZ2CE7NhrE2 BC61nq1aD01C9xzpQ8gHAxVtJmttQVQ= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-664-Y-wo06dSNtSyvSKyqULSnA-1; Mon, 11 Sep 2023 05:17:18 -0400 X-MC-Unique: Y-wo06dSNtSyvSKyqULSnA-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-402493650c6so20729555e9.1 for ; Mon, 11 Sep 2023 02:17:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694423837; x=1695028637; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6vKionDOmNb/hdiZNX73MPb0WqgE4GaK6A+WigRvxZk=; b=IbLFZqmV5dSzitKuveUeD4KWcCV76hfOzhl25xBAdLDIgfth0+i1NW/HNg7Xv4zUKX YreeMFP8dK189dEeY6mggIiwONn1emhz2OoBvQUbuhNat134LBFDDiyj1X9UW+m3KqPj gw08bxC43YaT41fpSmuhNYUUjAAxIWUc5v1ZtFe+qey18CPCJ8klrxV5gaBvrIjzJAgw 5F/Uv0Puk4rthETtI5aR6SY3K8ldno+rCwELNW9uuLcoNNzJ9FxOaCpotzIu/05sFDzH RgXV7GSDzxhH6MqN44owmUQjPT6xF/5TSfKqDdVB56BkHh8yV8p1yNJn1AdWyE2B6GbM JZjA== X-Gm-Message-State: AOJu0YxuXidVOTbWk9TkLTUz7OjN7sINmbPPPa7sgYBnZ/8+99npGW/E p0nWePJq268Uv2nJJLfDJhdMx7j9FzsJ2mnHyFiM/ncC8rC73lDPaGgCPXyftiMqb6sP8hf4GUI 1SxXek7dDZgbi20Mz2w2YhA== X-Received: by 2002:a05:600c:b4f:b0:401:b3a5:ec04 with SMTP id k15-20020a05600c0b4f00b00401b3a5ec04mr6295902wmr.16.1694423837616; Mon, 11 Sep 2023 02:17:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHgEvB85kChkN0vsv12r8LXf5h9w7jaNOw5dulaPVKpGKJQwgJZCIXXf3BMTSaeeIbGaDrUNA== X-Received: by 2002:a05:600c:b4f:b0:401:b3a5:ec04 with SMTP id k15-20020a05600c0b4f00b00401b3a5ec04mr6295884wmr.16.1694423837241; Mon, 11 Sep 2023 02:17:17 -0700 (PDT) Received: from localhost (197.126.90.146.dyn.plus.net. [146.90.126.197]) by smtp.gmail.com with ESMTPSA id p15-20020adff20f000000b003143c9beeaesm9423724wro.44.2023.09.11.02.17.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 02:17:16 -0700 (PDT) From: Andrew Burgess To: "Metzger, Markus T" , Simon Marchi Cc: "vries@gcc.gnu.org" , "gdb-patches@sourceware.org" Subject: RE: [PATCH v3] gdb: c++ify btrace_target_info In-Reply-To: References: <20230908105319.1963979-1-markus.t.metzger@intel.com> <0d7782da-940c-40da-a511-4f8a36b5455c@polymtl.ca> Date: Mon, 11 Sep 2023 10:17:15 +0100 Message-ID: <87r0n5kr1g.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: "Metzger, Markus T via Gdb-patches" writes: > Hello Simon, > >>> - gdb::unique_xmalloc_ptr tinfo >>> - (XCNEW (btrace_target_info)); >>> - tinfo->ptid = ptid; >>> + std::unique_ptr tinfo >>> + { new linux_btrace_target_info { ptid } }; >> >>We recently added a gdb::make_unique function, it would make sense to >>you use it here (it will eventually become std::make_unique once we >>migrate to C++ 14). >> >>So this could be written as: >> >> auto tinfo = gdb::make_unique (ptid); > > I'm not a fan of 'auto'. So this becomes > > std::unique_ptr tinfo > { gdb::make_unique (ptid) }; This really doesn't feel like an improvement. I also try to avoid excessive use of auto, so I dislike things like: auto var = some_function (....); because there's no hint what the type of var actually is (without looking at `some_function`). But in the case of: auto var = gdb::make_unique (...); The type of var is right there on the line, so duplicating the type information is just noise. For me this is a perfect use of auto. Just my $0.02 worth. Thanks, Andrew > >>Approved-By: Simon Marchi > > Pushed. > > thanks, > markus. > Intel Deutschland GmbH > Registered Address: Am Campeon 10, 85579 Neubiberg, Germany > Tel: +49 89 99 8853-0, www.intel.de > Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva > Chairperson of the Supervisory Board: Nicole Lau > Registered Office: Munich > Commercial Register: Amtsgericht Muenchen HRB 186928