Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp1155035ybb; Thu, 28 Mar 2019 21:35:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/fXMY80eFanolHHi8XQg77idKDRWo8bkpos/bB3cNwflbK8vCqgVQIWf+GlAl/jlRZU+n X-Received: by 2002:a63:bd52:: with SMTP id d18mr19355960pgp.52.1553834137087; Thu, 28 Mar 2019 21:35:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553834137; cv=none; d=google.com; s=arc-20160816; b=BGed4ZwzDtkO+k6zZ0gv8A2qEsJh6BErMmSZviT0UVK9H71B1eg+uGbKzAZK0fchQd uP5XBPoraqSTS8LpiuLkyVA92hxBQJ3Bq+DZg4cS48FCS2N8UibwXYVpBMgvDJPSX8Ys EoUlrm83OzEiBv/i5pfEpyf4wBxZKoS26RoJvK2gWLb8BAZzl6pP/Rk9/Vuufpa8c9A9 CFX6NF7ufQ8h4pA5UmTncClWaUjpThX3d6v6rZQvwmVL02Z+vVHzeJelu6PVFkMAKpyY +TFAbef5BhkjW4bsaNHxIOuZa2QtfmcV2y16Ji3uaiLeaDF4O7Yx7D6lpPnjaE9jV9jc pqdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:from:references:in-reply-to :message-id:date:dkim-signature; bh=SsbxdzcU2FQ00c4WUDwUbNmk6X8lSOeaMDhmwkLW2ps=; b=cU7HrPd8GJi65+VYitjwZOWzZB5dIsw3G0rpxtd9QxCJB4H0dLCnSqXY/Ive8BRCJ4 KZkFGlbX9EMGQnw3tBmXq9+HPdWgpQpE6nOjyFItuaWQCmDeVe+zyw2MixPcIpFG/BOn 7GhEzLP8aM524Ixa4iuUp1C5AL4EEHTd0BsFSdDnLjgYWvI4p1PRtWqtoJrbEI4iOJNW bD0sNPaD0yM0daEx8VCbJuBRJrD689eBdqtNIgSYVcldXTkocGnMZ/HI21ztreFcTEdb w3n6J/270rhifIJX1IEey+VyW0QkPIZdswCed0fxWpdWFTkYFdrBTNhDCXeSBoFlI1Rr CnHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sdf.org header.s=default header.b=S6NzVGSn; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w8si936098ply.303.2019.03.28.21.35.08; Thu, 28 Mar 2019 21:35: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=@sdf.org header.s=default header.b=S6NzVGSn; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726016AbfC2EeK (ORCPT + 99 others); Fri, 29 Mar 2019 00:34:10 -0400 Received: from mx.sdf.org ([205.166.94.20]:59125 "EHLO mx.sdf.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725385AbfC2EeK (ORCPT ); Fri, 29 Mar 2019 00:34:10 -0400 Received: from sdf.org (IDENT:lkml@sdf.lonestar.org [205.166.94.16]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id x2T4VqZU005980 (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits) verified NO); Fri, 29 Mar 2019 04:31:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sdf.org; s=default; t=1553833921; bh=MSlrUev1tWLvZ+5hN9M4dKFNaBlpRQgRF66IHzEREIg=; h=Date:In-Reply-To:References:From:Subject:To:Cc; b=S6NzVGSn86KRcTDxLvasrhx8kZzwOEj53Y16+v/C8y8nVvaE0tkHgiYNiJSI/s/60 cqzkDGsm2U1isXiTmztXQHNp+sf+UQzK1OMia2hGGTXg4gK02cdbXBHQ39szMwCpUR yfO8ToZP3oo8l5EzWpbMCEV3MB7wNPq7I0u5PD1E= Received: (from lkml@localhost) by sdf.org (8.15.2/8.12.8/Submit) id x2T4Vq5A024120; Fri, 29 Mar 2019 04:31:52 GMT Date: Fri, 29 Mar 2019 04:31:52 GMT Message-Id: <201903290431.x2T4Vq5A024120@sdf.org> In-Reply-To: References: From: George Spelvin Subject: [PATCH 6/5] lib/list_sort: Fix GCC warning To: Andrew Morton , Stephen Rothwell , kbuild test robot Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, George Spelvin , Andrey Abramov , Geert Uytterhoeven , Daniel Wagner , Rasmus Villemoes , Don Mullis , Dave Chinner , Andy Shevchenko Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It turns out that GCC 4.9, 7.3, and 8.1 ignore the __pure attribute on function pointers and (with the standard kernel compile flags) emit a warning about it. Even though it accurately describes a comparison function (the compiler need not reload cached pointers across the call), it doesn't actually help GCC 8.3's code generation, so just omit it. Signed-off-by: George Spelvin Fixes: 820c81be5237 ("lib/list_sort: simplify and remove MAX_LIST_LENGTH_BITS") Cc: Andrew Morton Cc: Stephen Rothwell --- lib/list_sort.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/list_sort.c b/lib/list_sort.c index 623a9158ac8a..b1b492e20f1d 100644 --- a/lib/list_sort.c +++ b/lib/list_sort.c @@ -8,12 +8,16 @@ #include /* - * By declaring the compare function with the __pure attribute, we give - * the compiler more opportunity to optimize. Ideally, we'd use this in - * the prototype of list_sort(), but that would involve a lot of churn - * at all call sites, so just cast the function pointer passed in. + * A more accurate type for comparison functions. Ideally, we'd use + * this in the prototype of list_sort(), but that would involve a lot of + * churn at all call sites, so just cast the function pointer passed in. + * + * This could also include __pure to give the compiler more opportunity + * to optimize, but that elicits an "attribute ignored" warning on + * GCC <= 8.1, and doesn't change GCC 8.3's code generation at all, + * so it's omitted. */ -typedef int __pure __attribute__((nonnull(2,3))) (*cmp_func)(void *, +typedef int __attribute__((nonnull(2,3))) (*cmp_func)(void *, struct list_head const *, struct list_head const *); /* -- 2.20.1