From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PC14zcLZ; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id BC0365A004E for ; Fri, 06 Sep 2024 13:29:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725622197; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UsUs2392cCgdWTa36q+PNWqxsub3cYadWu1gstdQs/A=; b=PC14zcLZfoHYriiTlOZRpTwwXD6LMs4wlU3p8eMdlMnjIovggWdL/UOxoJauuzil0Bbhw1 jksPMCZJzO4nXPODaewpPf4wdgTz/BpLpbe/ERIiwiZYS/dw+gyZZuIacTBHFuIPsex4af 2kz9G9MAgJgdGwFDpf1/GiW5NqN1uD8= Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-582-W78yA0RgM0OlyOCWXjoKQg-1; Fri, 06 Sep 2024 07:29:56 -0400 X-MC-Unique: W78yA0RgM0OlyOCWXjoKQg-1 Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-718db8e61bfso524494b3a.0 for ; Fri, 06 Sep 2024 04:29:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725622195; x=1726226995; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=UsUs2392cCgdWTa36q+PNWqxsub3cYadWu1gstdQs/A=; b=m+iTuREp2dXomWa1RwKyuFtEWx3YGlfR6LxBR3eAPrpujr3SLsdWFpJQJDmXqbOmVG Kz6PTAoxL+c1kLVtz2Y8oMfQ7WnaYPZ0IuijHOr0AoQIezrSnpI+vdyLgKyz+jiFWdWy aPXvIkPXayMu07LvgYAXl8uqxhPMW4zw/wNGHwh/SYxLIgkn3ACsqx6ef+mgeQa1EwZD rCaSvuxIBP21d6pFTveMLQFcDhIci10PECO3wjUTSK8fkDmDnG1RemcuMeS5Dr0LV/eW T6t7ShAvlJANjvpPcie7w0Br8AgaM5VgKz5kNKsBPxHXOlVGmovmSvjM8ukeoypYyOf+ 93Hg== X-Gm-Message-State: AOJu0Yy49ZA8Bt5QhvaXE85BcuSN3bxo67T2kYL3P3SMk+5IAjvTajro nkyB6YSNKJMMyFJb9wdg6vQpNJcmaTABssBm6R8c2Cx7HMcJgYpDi5ZXY+NKWaTTenVlQlHHgo5 j/XEJPJClKAGd3A8wZlhhg02K7OtofOoa5IVeNwX5hdRJZSmlgPz9UoqvmA== X-Received: by 2002:a05:6a21:3942:b0:1c4:231e:8ee5 with SMTP id adf61e73a8af0-1cf1d1c4f88mr2526285637.29.1725622195067; Fri, 06 Sep 2024 04:29:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG1afEhFzs1zW2OUOPQ2atKlztiZPLDIy9cGEqIDbX4Tlh9c3AO9Kca8co9WMXjC12yqIXgDg== X-Received: by 2002:a05:6a21:3942:b0:1c4:231e:8ee5 with SMTP id adf61e73a8af0-1cf1d1c4f88mr2526263637.29.1725622194676; Fri, 06 Sep 2024 04:29:54 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71794cf6907sm1939797b3a.45.2024.09.06.04.29.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 04:29:53 -0700 (PDT) Date: Fri, 6 Sep 2024 13:29:50 +0200 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH v2] cppcheck: Work around some cppcheck 2.15.0 redundantInitialization warnings Message-ID: <20240906132950.48da4e59@elisabeth> In-Reply-To: <20240905112204.2661135-1-david@gibson.dropbear.id.au> References: <20240905112204.2661135-1-david@gibson.dropbear.id.au> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: NJJDCAJMTQOQQ5DDYOFV6QIAE6CRQKS2 X-Message-ID-Hash: NJJDCAJMTQOQQ5DDYOFV6QIAE6CRQKS2 X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, 5 Sep 2024 21:22:04 +1000 David Gibson wrote: > cppcheck-2.15.0 has apparently broadened when it throws a warning about > redundant initialization to include some cases where we have an initializer > for some fields, but then set other fields in the function body. > > This is arguably a false positive: although we are technically overwriting > the zero-initialization the compiler supplies for fields not explicitly > initialized, this sort of construct makes sense when there are some fields > we know at the top of the function where the initializer is, but others > that require more complex calculation. > > That said, in the two places this shows up, it's pretty easy to work > around. The results are arguably slightly clearer than what we had, since > they move the parts of the initialization closer together. > > So do that rather than having ugly suppressions or dealing with the > tedious process of reporting a cppcheck false positive. > > Signed-off-by: David Gibson Applied. -- Stefano