From mboxrd@z Thu Jan 1 00:00:00 1970 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 CF46F5A005E for ; Fri, 17 Feb 2023 09:05:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676621100; 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=AyivEbhMrusr5OA9JK4cwTDpVMqnStqbgiyAOJvM+/M=; b=jA7NvaXGcEjPUJE1geXAhk/2nPBUriDIU0nfXjm/i0Ay6KTdgcXGLsPuszv7R9pb8pnJKh +3asGcheE8+UPtDZZdGmDcuWEwEmc1cey3CDaYUQDm4M5+HoDnB2CYcHaP5TRGdM3Gw7jL I0W4Bej7OowmBX/Ol9HLvXDohUctI+w= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-82-rcxuj5c1P-SccnQYm9n_zg-1; Fri, 17 Feb 2023 03:04:57 -0500 X-MC-Unique: rcxuj5c1P-SccnQYm9n_zg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D2ACA18A6460; Fri, 17 Feb 2023 08:04:56 +0000 (UTC) Received: from maya.cloud.tilaa.com (unknown [10.33.32.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7F1FA140EBF4; Fri, 17 Feb 2023 08:04:56 +0000 (UTC) Date: Fri, 17 Feb 2023 09:04:53 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH] conf, tap: Silence two false positive invalidFunctionArg from cppcheck Message-ID: <20230217090453.419bb4f9@elisabeth> In-Reply-To: References: <20230216182210.2290008-1-sbrivio@redhat.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: IE2BVBSRAYUQNSXSKNECDDFPLEHR5VHT X-Message-ID-Hash: IE2BVBSRAYUQNSXSKNECDDFPLEHR5VHT 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, Laine Stump X-Mailman-Version: 3.3.3 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, 17 Feb 2023 09:53:28 +1100 David Gibson wrote: > On Thu, Feb 16, 2023 at 07:22:10PM +0100, Stefano Brivio wrote: > > The newly introduced die() calls exit(), but cppcheck doesn't see it > > and warns about possibly invalid arguments used after the check which > > triggers die(). Add return statements to silence the warnings. > > > > Signed-off-by: Stefano Brivio > > Oof, that's super ugly. Any chance that cppcheck will recognize the > ((noreturn)) attribute if we added it to die()? It doesn't. I guess Library::isnoreturn() in lib/library.cpp is fooled by the way we build die with a macro. I couldn't find a corresponding ticket, there's a vaguely related false _negative_ here: https://trac.cppcheck.net/ticket/7933 but I admit I might have missed one from this list: https://trac.cppcheck.net/query?status=!closed&keywords=~valueflow I see a few alternatives: - move exit() after the function body, instead of using 'doexit', I couldn't find a "nice" way to do so but it should be possible - fix the issue in cppcheck - or... would you prefer if I use a cppcheck-suppress token here? -- Stefano