Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2740308ybg; Sat, 19 Oct 2019 22:53:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3k2O01XyBF9adCf8nc2GPNZZC7cnnIHurUiv+Pladw4smlaLYp87tRMkcV0/RxoFZUkR+ X-Received: by 2002:aa7:ca52:: with SMTP id j18mr18047799edt.299.1571550817545; Sat, 19 Oct 2019 22:53:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571550817; cv=none; d=google.com; s=arc-20160816; b=zGpvT+zk4n2Gu/MA/4Q6SOIks+u1n1uzVn9mO7MuYnJJEFqt3arhl8l8j5sgh9Vmpv 8Dm+xMtvFCBlFgK1PsGwnGxNtvSmV9hL9rd9OGBewxAIXthwRZGjmKhoZWYNr8VP8Dbt JyBPYpJ8/+WLl9BpMANCH5yHM+0zC9ZB/jmn05CEcPHN/QFYLknFySS5WTgCL4yUWVnu giedO9GQ8XDoQjobdE14FNGZWoekvFrPsLU/NQtpHt09yHF9Am8dvrYJ0lPuz7JrJPHJ w3r5s91yEQChBcXxOYi6fraBMI6W2Kne9yQyoKezHSHbli7/1cN7e8ZSaRDIi6F2QZNf fNmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=51TklpCVmpWzv8/2EcsxOdE6xXoYYK++w+3ck6sGq7g=; b=FA5avM7eGL+dXlOhrLItfg5l2089VH829FSZvvIKBqzdDZtQ0f557JXtkw7S99gIKT 8iXvvbRSYJvpA+qiFhA7Sc/zEsDS6e9Un0M9DIGU6T1M/LhPN4/qkoZd+rW3IXSr0dOa Po4fYJ7kGFsPqXc7Pt0xPfJA9gYKhjZsJMsBQ8cDZK0gzJGqog8DhYMFgRjNO1sZPOJc M/EPiL4K/H3INBFg1iXXFlP868mrRraxrzqy5bt4rX6Nt6pPzwmlrf0iGx38N94xvG8k iBL94T50P2nvK6OD64/1vFh4mmaxTi4YuMPwrcwUvleJN+bD/zAKnXdqWBGuHvdAZ0vI Nunw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="sJi8/6+E"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15si13679edd.8.2019.10.19.22.53.13; Sat, 19 Oct 2019 22:53:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="sJi8/6+E"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726285AbfJTFw6 (ORCPT + 99 others); Sun, 20 Oct 2019 01:52:58 -0400 Received: from mail-wr1-f51.google.com ([209.85.221.51]:35934 "EHLO mail-wr1-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725851AbfJTFw5 (ORCPT ); Sun, 20 Oct 2019 01:52:57 -0400 Received: by mail-wr1-f51.google.com with SMTP id w18so9697324wrt.3; Sat, 19 Oct 2019 22:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=51TklpCVmpWzv8/2EcsxOdE6xXoYYK++w+3ck6sGq7g=; b=sJi8/6+EPXDLkFwM84PDzxNA+xm/Ty4OLsEENxPDWuFLSe6Q0NpSWlMUiamI2quZHb QzqxmXKuEHPbdVFNCl0m/57mbcREyxdyo0vB+W+2RWSpDjNvQFsLrNfv4OzmwtsxgXDG 9Xw5z/G7Gl0wzF3x/mhNzIrcai5ZYPq3vxNHWteLj2igr+OCPCCds43IDPuXqe1P6JSp +BR7+k31QxCk+elV8cgZWQJE1iYqq4tIn1PS9dV8VV21YevDhSwcYTsXyMh/NtD353Hm +pbftBm+DMYlO4H8I3L4JLCPrCkt1PdBmTLi0sbfy94PW2DqZpFrCUApyV6oTf0pBZf9 ls6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=51TklpCVmpWzv8/2EcsxOdE6xXoYYK++w+3ck6sGq7g=; b=CHV9FH4bbw95H/L8/OpS30Nwej838e+/iiuyZBSGh1uq66A4AYpnd2xk5Ioh9WwqBR 7Cl4KSENuTkscNFmMoMjMgSuOQoKYTTMkct5XoSOOk1guwURCcCLdlw5Hg+gdEfnc2G7 FzaXkWaETQGAL1jaya+Jz7MDDgPeNQG4oZVecUgM8JC2cedRUJXMQ6P3gnuDSxYKaV7p u1mZ17ZlZCAjeX9/XLtslf5MwoYa+DWN+SEriCAVoPf3PEhhjCVJQPy5ZdErYzUJy6U1 m5jpzSKsusK8hHqE4pChmM1BEigeYh/y7nE1d7ohROoNrAClnT8gRng9+7tVf1l0S1lm Dhvg== X-Gm-Message-State: APjAAAV1Rug2YTV5o+welT+P+LTY95RWAvI9fTlXgRt9FFcHJU/r7U5H pD8kSmAh9mrLZ0DBVicI0zc= X-Received: by 2002:a5d:4142:: with SMTP id c2mr13624286wrq.208.1571550775205; Sat, 19 Oct 2019 22:52:55 -0700 (PDT) Received: from ltop.local ([2a02:a03f:40ac:ce00:9cfc:63f1:4c41:b934]) by smtp.gmail.com with ESMTPSA id u7sm1283982wre.59.2019.10.19.22.52.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Oct 2019 22:52:54 -0700 (PDT) Date: Sun, 20 Oct 2019 07:52:53 +0200 From: Luc Van Oostenryck To: Linus Torvalds Cc: Ben Dooks , Sparse Mailing-list , "linux-kernel@vger.kernel.org" Subject: Re: sparse: __pure declaration only Message-ID: <20191020055252.2ymxfrskpodxhuxs@ltop.local> References: <09d824ac-5371-830e-466d-7f78ccdae065@codethink.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 18, 2019 at 08:31:48AM -0700, Linus Torvalds wrote: > On Fri, Oct 18, 2019 at 4:15 AM Ben Dooks wrote: > > > > is this a valid warning? if not, should sparse be ignoring these. > > It's technically valid, but maybe it's not useful. > > If we make sure that any pure bits from a declaration always make it > into the definition, then I suspect that the "was not declared" > warning (if the definition is non-static and seen without a > declaration) is sufficient. > > Of course, sparse doesn't actually _care_ about "pure" in the > definition, only in the use, so right now it doesn't even make any > difference to sparse whether the definition has the "pure" or not. > It's only when the function is used that the "pure" matters (it makes > the call instruction be CSE'd like any other random instruction). Yes, for 'pure' it doesn't matter much but it's a problem anyway. For example with 'static': $ cat file.c static void foo(void); void foo(void) { } $ sparse file.c file.c:2:6: warning: symbol 'foo' was not declared. Should it be static? Which is kinda absurd: foo() was declared and was even declared static. But the definition is a different symbol than its declaration (OK) which doesn't 'inherit' the declaration's specifier/modifier/attributes. It's on my to-be-fixed list for a long time but .. -- Luc