From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C1E4110F9 for ; Wed, 2 Apr 2025 16:38:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743611895; cv=none; b=etKf6ngvcGkI7/Z8qG7oco46GCi0KOIlr9Jp6EF9NOokrq7VOYMznCYXeD7WOPBp7a8HjXroC+Yta8I4sXlGCWfSsa17xKsaLGR002Mj9/KfalVfoDj+g6Fud/wOhD1qO4sCz82GrBS9AvqY7QBJhbvX5vVcTnpsPtocfGxOECs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743611895; c=relaxed/simple; bh=PiLjoXvQRf2kVr7SQ6qTUAAZ0gGf8NJL48KaDm/P/wQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=G3V0WHg+6pEayFxOBvFscloSsBwUo9aEOLqRz72LG2VkKaw0OZu3pjTxfZWCrhbPtTDYFEgMBufvmu4sH+y6eSm5WDUzguki1iMT5IhSFz1Nw2wQKb3vV++eRV/aGYNHEuJceHCTxjtvQ4RtYbpGynYJ3XJdl3UUSSeFBo/c4ZY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D59091F91; Wed, 2 Apr 2025 09:38:14 -0700 (PDT) Received: from localhost (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 89AE93F63F; Wed, 2 Apr 2025 09:38:11 -0700 (PDT) Date: Wed, 2 Apr 2025 17:38:07 +0100 From: Leo Yan To: Ian Rogers Cc: Yury Norov , Rasmus Villemoes , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Kan Liang , Thomas Gleixner , Darren Hart , Davidlohr Bueso , =?iso-8859-1?Q?Andr=E9?= Almeida , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Yicong Yang , Jonathan Cameron , Nathan Chancellor , Bill Wendling , Justin Stitt , Josh Poimboeuf , Al Viro , Kyle Meyer , Ben Gainey , Athira Rajeev , Kajol Jain , Aditya Gupta , Eder Zulian , Dapeng Mi , Kuan-Wei Chiu , He Zhe , Dirk Gouders , Brian Geffon , Ravi Bangoria , Howard Chu , Charlie Jenkins , Colin Ian King , Dominique Martinet , Jann Horn , Masahiro Yamada , Arnd Bergmann , Yang Jihong , Dmitry Vyukov , Andi Kleen , Graham Woodward , Ilkka Koskinen , Anshuman Khandual , Zhongqiu Han , Hao Ge , Tengda Wu , Gabriele Monaco , Chun-Tse Shao , Casey Chen , "Dr. David Alan Gilbert" , Li Huafei , "Steinar H. Gunderson" , Levi Yun , Weilin Wang , Thomas Falcon , Thomas Richter , Andrew Kreimer , Krzysztof =?utf-8?Q?=C5=81opatowski?= , Christophe Leroy , Jean-Philippe Romain , Junhao He , "Masami Hiramatsu (Google)" , Xu Yang , Steve Clevenger , Zixian Cai , Stephen Brennan , Yujie Liu , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev Subject: Re: [PATCH v1 09/48] perf tests: Silence -Wshorten-64-to-32 warnings Message-ID: <20250402163807.GP115840@e132581.arm.com> References: <20250401182347.3422199-1-irogers@google.com> <20250401182347.3422199-10-irogers@google.com> <20250402143541.GM115840@e132581.arm.com> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Hi Ian, On Wed, Apr 02, 2025 at 08:42:58AM -0700, Ian Rogers wrote: [...] > On Wed, Apr 2, 2025 at 7:35 AM Leo Yan wrote: > > > > On Tue, Apr 01, 2025 at 11:23:07AM -0700, Ian Rogers wrote: > > > > [...] > > > > > @@ -478,13 +478,14 @@ static int __cmd_test(struct test_suite **suites, int argc, const char *argv[], > > > int err = 0; > > > > > > for (struct test_suite **t = suites; *t; t++) { > > > - int i, len = strlen(test_description(*t, -1)); > > > + int i; > > > + int len = (int)strlen(test_description(*t, -1)); > > > > Thanks for huge polish. > > > > Just a concern from me. Throughout this patch, the methodology is not > > consistent. Some changes update variable types which is fine for me. > > > > But the case above it simply cast size_t to int. Should we update the > > variable type as 'size_t' at here? > > Thanks Leo, I played around with it, but don't mind if someone wants > to do it a different way. I was trying to make the changes minimal. > The problem typically with size_t is we then use the value, for > example, as a printf size modifier and need to introduce lots of casts > back to being an int. This conclusion is not quite right, see: https://stackoverflow.com/questions/2524611/how-can-one-print-a-size-t-variable-portably-using-the-printf-family > When this isn't too great I've done it, but in > this case I think keeping the int, the lack of casts but a cast here > to capture that we expect test descriptions to fit in the size of an > int is the least worst option. I would say in another way. After we enabled a compiler warning option, this will give us a chance to improve code by dismissing the warnings (and avoid potential bugs). If we use casts just to silence warnings, we also lose the opportunity to improve code quality. The changes in this series that fix type mismatches are good, but I think the use of casts is not particularly helpful - we're simply switching from implicit compiler casts to explicit ones. Thanks, Leo