From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine 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=icpzsJXm; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 633DF5A027E for ; Fri, 16 May 2025 18:26:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1747412788; 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=gCn8fJzJ4q30FxjbXfaCou/jcx1g7h1uCB/aHgIFoFY=; b=icpzsJXmrPfp8GOF14mFRJKlbpcaWa68gH0sDuDswyt9IUmQBpaal98yTITYph/XRv8VwD q7rVLZX25sS5pS3Yc++4iY6SuZdq1Ink3TiCLa1S8h8R6SA5qokMcAtou0vHl0LuPWTcea 6meDckmMORZtyYRmLuUMZap5Vd5IR9M= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-515-kDVJ86BFPIWXffPE6DZZfw-1; Fri, 16 May 2025 12:26:27 -0400 X-MC-Unique: kDVJ86BFPIWXffPE6DZZfw-1 X-Mimecast-MFC-AGG-ID: kDVJ86BFPIWXffPE6DZZfw_1747412786 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-3a0b1798d69so1271106f8f.3 for ; Fri, 16 May 2025 09:26:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747412785; x=1748017585; 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=gCn8fJzJ4q30FxjbXfaCou/jcx1g7h1uCB/aHgIFoFY=; b=sPjykzzqbXWJYQVwRq7gydIdLjiQrZOap6D16Mw4UP+XYxKl0UYVpgtXLRlpQ8ZVsg Xs2i7PQCID61lBTf2gu2BBr4BzAzRvoBEKzXFVw5dZhGr79saIrFxZeUqTDa4FCw8jhM v7/s9S/HKCjnfXFBbsNN0vPEbulBYLLlEcXPXzl4m13Nr4u2zbWMfytIaVHtTye37S0w SIY1EBU2MX/dN7PMv/BPjSr7S/jqNtWngfUPecs0De2CXQk9TVnqPXd52i8MBBiT4Kvm L0eD9JqHlmrbsopavjaLlMvrNkSr6V1iiA3kI7AacXRJHL2tSup8ZUKWU5wCvMPCL6OP J+wA== X-Gm-Message-State: AOJu0Ywekwua774BZLmRKS6lnfqzTylziu+J9Oj/QCv5BLj0wYl2r45Q +H1frlJTobs6R7Ml+wqAFGgGHv6p1jPUHh6OAnrJOUfkGNBaonY+o8K9tAh8iJEzLdORO5IBnQy WJCyRcHdPIoF56aamuddEykEfxgBzgZIcg778/2SZtSEkM8pRiAQVQZn/JHmqfQ== X-Gm-Gg: ASbGncsIOzHAoR7novzIH3iEpFUdkH1NUm3bBC8BSDSaQ4g8DK1hLpHkjzaQcyShg+S BkYw29WVR2Ux4YjifiV1xoMjwFTZLM2Ug7HpNtgnyKH8Mazod5MCNNy4oYUZyLIgjF+xQvlONHh JWmt8gDB0i2rE9ImkQnZuLBTgjfXNb+qGslNToTTX/J7XtsqJpDULif6Nvl1AxNiGJ0Fugt1j2q 6AaFcizyspZAiIkanGzZK8j/kpaQaN1XMM3JAh0SE/BiunN1scJbmoKvLfprMbAZP27PSM6HysQ JX6X8JDeU839kchnKLx7URg= X-Received: by 2002:a05:6000:400f:b0:3a2:ffbe:3676 with SMTP id ffacd0b85a97d-3a35c8570fbmr3709433f8f.49.1747412785600; Fri, 16 May 2025 09:26:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEs8CI/8kDoHpxTNGh/ldk80NrrxRwbONDbXQDjmuqGho46FvgbdIIIvG400T2k5mrDHKcrbA== X-Received: by 2002:a05:6000:400f:b0:3a2:ffbe:3676 with SMTP id ffacd0b85a97d-3a35c8570fbmr3709408f8f.49.1747412785188; Fri, 16 May 2025 09:26:25 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a35ca4d263sm3303471f8f.3.2025.05.16.09.26.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 May 2025 09:26:24 -0700 (PDT) Date: Fri, 16 May 2025 18:26:23 +0200 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH] tap: Avoid bogus missingReturn cppcheck warning in tap_l2_max_len() Message-ID: <20250516182623.69e49c29@elisabeth> In-Reply-To: References: <20250515160501.2636220-1-sbrivio@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: EhnHkwf5qz6WboLIQtA0Z89oL5RRbpqEXp3tqHl4tBI_1747412786 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: VCAZC3HSFFAWIYXIBJM4ZDQCNOJ6CVJL X-Message-ID-Hash: VCAZC3HSFFAWIYXIBJM4ZDQCNOJ6CVJL 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 Fri, 16 May 2025 17:25:21 +1000 David Gibson wrote: > On Thu, May 15, 2025 at 06:05:01PM +0200, Stefano Brivio wrote: > > Cppcheck 2.14.2 on Alpine Linux (musl) says that: > > > > tap.c:111:19: error: Found an exit path from function with non-void return type that has missing return statement [missingReturn] > > switch (c->mode) { > > ^ > > > > This exit path is not reachable because we ASSERT(0) after the switch, > > but for some reason cppcheck doesn't see this with musl headers. Hide > > the warning with a redundant return statement. > > > > Signed-off-by: Stefano Brivio > > Hm. Alternatively you could change this to call abort_with_msg() > directly. That's marked as ((noreturn)) so with any luck cppcheck > will then be able to figure out what's going on. Although, I'm > slightly surprised it can't do so already: I thought I put the > ((noreturn)) in there to avoid warnings exactly like this. So, I checked, and abort_with_msg(""); works. ASSERT() ultimately expands to abort_with_msg(), but for some reason cppcheck together with Clang can't "follow" that, I suppose it's something related to the pre-processor. But in any case, abort_with_msg("") doesn't look as descriptive and as obviously redundant as a return statement with a comment, so I don't quite see the benefit changing it (also considering that I need to test other versions, which takes time). -- Stefano