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.129.124]) by sourceware.org (Postfix) with ESMTPS id 08C2D3858D37 for ; Tue, 19 Mar 2024 14:58:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 08C2D3858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 08C2D3858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710860314; cv=none; b=bQSCDXNid0PV/l8dos2vVjfdkHAVO7lVPqex7tjZNOuGbQCzXx/cbMxDLJJXqisT27LePLz8TBlBCU5+KCp2pUOE/QUXrofWDJGi09zW4a2qPeZ/USzFhXyWuw3RCbMOvlA41rnMYKsBQO2uNCv/qv1kWuku+a66aAu1qvqsUcU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710860314; c=relaxed/simple; bh=11xpqkR9KgZlEbmDpxvBODISaJiNPBM4M5Nf1dnhjrY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=sj7vkvUR4bI1lmc1bp51BInt3A9Lw644RMCmsG521EczcnH/p3vGsrIpBHxjR41imU45R+mEdxxnikeQrpSj5wNAvgcrOTBFsP6CpYvWCp+RtxYKZ5aWZe7zG7eRe/6MGgrGdOAw/4ib34AHbIAYuThMRuxICCwnaeVpS3t7wMA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710860311; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Px+RxJV0tC8Tlg6u6QbwCyWmm1dDwoEHACcxKRjL9Z4=; b=X/C0fePPh26nA3wi1OyELBsD+W1UglZKXhZ6wjpM9FzT5iXVk2qzIuB3C7AFZGb1ZvurDO mnIMwqtnn16t7thKeUXm54yilTQkRjzKRhsk4GrgnrSpu5SlRYZiC1I0GD9CNd4ddQG7se smMvKcMHYsW7cSA1G9Jru/pHfZ6z/kc= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-453-jRYEISntPFSVLnO42bz2zg-1; Tue, 19 Mar 2024 10:58:29 -0400 X-MC-Unique: jRYEISntPFSVLnO42bz2zg-1 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-513def50581so3159484e87.3 for ; Tue, 19 Mar 2024 07:58:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710860308; x=1711465108; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Px+RxJV0tC8Tlg6u6QbwCyWmm1dDwoEHACcxKRjL9Z4=; b=LKUEJTaafuI2lKFtp78P7V9WnnIKcfkcduDTwgVOTqqolJR3Egz/lwSveX8pkdHaAG HXLW/OtWvBdALN3yN+9CIiJ4iznOVYFNIvIyQRodENP0XgIe4+VgcbrmBbci1Wdsq98r ZFT4KX0/t8P2z+cbd5E5BqD+2lztYzW7W2CRaXiWvOBGdbJ7iqUqZdhtU2xTYFb4FeIJ C5qWb2CAoDTBQEOly7zlZLHlBYdYnk6VgnJrE6Oa8NGZFajxl/tnRNN4wehGYwarG++e AM8g2R2qKnojyrIi2ISVABQU0zBbPaAZD+ZCavsC8mN2JWoqMLbBOnpgWnXZTH+kK2EU j6jg== X-Forwarded-Encrypted: i=1; AJvYcCV9ZqwXATCUiDhzTheHo1b9NOz0UlITkTbBaXHQJbqbzv5CaqXwEg/hr9hWZJ4YBlb4Rm4r1II5+bPxg5LfGIIrcMdY67cRrfB7XA== X-Gm-Message-State: AOJu0Yy6gULKyuEdGvctwdud7zVSxANioBH1sg5UPQkWma91tmrm0ITq HqEaOaayzRNAkVMkNx/gtMfzM91Lz9AfKgk8sFYCUrq/xXd2/q07RN13Kt0tadMhCFQSXJPOJk3 xeyjarIR39jcwNgi++suq7tEXi27FVH/XmHhDAoc8aVNioEZAh+ET3zYp92Hzw+p/aI8= X-Received: by 2002:a05:6512:3283:b0:513:bed1:5069 with SMTP id p3-20020a056512328300b00513bed15069mr7994749lfe.13.1710860307623; Tue, 19 Mar 2024 07:58:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZMOmUQ9c6Cw2jzladidBPOEetKwy9VnA2TLV2QodROINt7qZlurAQTQ7ccCXAhwbsS3pK7w== X-Received: by 2002:a05:6512:3283:b0:513:bed1:5069 with SMTP id p3-20020a056512328300b00513bed15069mr7994718lfe.13.1710860307092; Tue, 19 Mar 2024 07:58:27 -0700 (PDT) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id d10-20020a170907272a00b00a44ef54b6b6sm6212105ejl.58.2024.03.19.07.58.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 07:58:26 -0700 (PDT) From: Andrew Burgess To: Simon Marchi , Tom de Vries , gdb-patches@sourceware.org Subject: Re: [PATCH] [gdb/build] Fix static cast of virtual base In-Reply-To: <7f3d74e0-1825-477d-9842-1d7f7fce221a@polymtl.ca> References: <20240222161804.1134-1-tdevries@suse.de> <87frx39s43.fsf@redhat.com> <1e54180b-6665-43c7-9c3c-fdf72bd29a07@polymtl.ca> <8734sxqd3i.fsf@redhat.com> <7f3d74e0-1825-477d-9842-1d7f7fce221a@polymtl.ca> Date: Tue, 19 Mar 2024 14:58:25 +0000 Message-ID: <87v85itgj2.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=-12.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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: Simon Marchi writes: > On 3/11/24 06:25, Andrew Burgess wrote: >>> This is similar to what I proposed here: >>> >>> https://inbox.sourceware.org/gdb-patches/24af4ea8-5426-4ce4-b1c5-12858b38a952@simark.ca/ >>> >>> The idea is the same, to have a static_cast in the DEVELOPMENT branch. >>> I kinda like my version better, as it factors out the static cast >>> (notice that both branches have identical static_cast lines after your >>> patch) and the ifdef is just around a single assert. Also, I'm pretty >>> sure the nullptr check is not necessary, as both dynamic_cast and >>> static_cast can handle it. >> >> I agree yours is better. Do you have an official patch somewhere that I >> can add a +1 too? If not then below is an updated version inline with >> you proposal. Feel free to push your version if you have it somewhere. > > I didn't have a proper patch ready, what you sent LGTM. Thanks a lot > for taking care of it. Thanks. I pushed this patch. I also pushed the patch below which I spotted in the same area. Thanks, Andrew --- commit 8695c3a693849bf6ebd3c6d0620f03bcc6429604 Author: Andrew Burgess Date: Wed Mar 6 17:48:55 2024 +0000 gdbsupport: rename include guard in gdb-checked-static-cast.h I noticed in passing that the include guard in the file gdbsupport/gdb-checked-static-cast.h was wrong, it includes the word DYNAMIC when STATIC would be better, fixed in this commit. There should be no user visible changes after this commit. diff --git a/gdbsupport/gdb-checked-static-cast.h b/gdbsupport/gdb-checked-static-cast.h index 24fa7a4ba04..97843fab225 100644 --- a/gdbsupport/gdb-checked-static-cast.h +++ b/gdbsupport/gdb-checked-static-cast.h @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef COMMON_GDB_CHECKED_DYNAMIC_CAST_H -#define COMMON_GDB_CHECKED_DYNAMIC_CAST_H +#ifndef COMMON_GDB_CHECKED_STATIC_CAST_H +#define COMMON_GDB_CHECKED_STATIC_CAST_H #include "gdbsupport/traits.h" @@ -80,4 +80,4 @@ checked_static_cast (V &v) } -#endif /* COMMON_GDB_CHECKED_DYNAMIC_CAST_H */ +#endif /* COMMON_GDB_CHECKED_STATIC_CAST_H */