From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6881C77B6F for ; Tue, 11 Apr 2023 13:38:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229575AbjDKNi5 (ORCPT ); Tue, 11 Apr 2023 09:38:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230061AbjDKNiw (ORCPT ); Tue, 11 Apr 2023 09:38:52 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 573D419AB for ; Tue, 11 Apr 2023 06:38:51 -0700 (PDT) X-IronPort-AV: E=McAfee;i="6600,9927,10677"; a="327715774" X-IronPort-AV: E=Sophos;i="5.98,336,1673942400"; d="scan'208";a="327715774" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2023 06:38:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10677"; a="691148175" X-IronPort-AV: E=Sophos;i="5.98,336,1673942400"; d="scan'208";a="691148175" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga007.fm.intel.com with ESMTP; 11 Apr 2023 06:38:16 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1pmECN-00FHXp-0Z; Tue, 11 Apr 2023 16:38:15 +0300 Date: Tue, 11 Apr 2023 16:38:14 +0300 From: Andy Shevchenko To: =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= Cc: Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn , linux-kernel@vger.kernel.org, =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= Subject: Re: [RFC PATCH] checkpatch: Support __initconst combined with struct definition Message-ID: References: <20230301094320.15954-1-bjorn@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230301094320.15954-1-bjorn@kernel.org> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 01, 2023 at 10:43:20AM +0100, Björn Töpel wrote: > From: Björn Töpel > > Checkpatch sometimes report a false positive for __initconst. E.g., for the > following snippet: > > | static const struct strspn_test { > | const char str[16]; > | const char accept[16]; > | const char reject[16]; > | unsigned a; > | unsigned r; > | } tests[] __initconst = { > | { "foobar", "", "", 0, 6 }, > | { "abba", "abc", "ABBA", 4, 4 }, > | { "abba", "a", "b", 1, 1 }, > | { "", "abc", "abc", 0, 0}, > | }; > > checkpatch would report: > > | ERROR: Use of __initconst requires a separate use of const > | #190: FILE: ./test_string.c:190: > | + } tests[] __initconst = { > > Improve the reporting by trying harder to find the 'const'. Joe, what do you think about this? -- With Best Regards, Andy Shevchenko