Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1223248lqt; Tue, 19 Mar 2024 17:35:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXzkh4qdFzBTguI8GSTF1zYWRLPhU/7VtXU1m2J1+EN+4O823UyVdo0US81nVDQKZY5nLB981xLBp9A5I0PbtW3pfgJZAVoTfZFdHOeLw== X-Google-Smtp-Source: AGHT+IGsXc6qbWOCNqnNYMqytH2YvG7y8uP3MC7pQmEWZm2pBByXlhbUnot7ViNKYid2Pxjteo1K X-Received: by 2002:a05:6808:2288:b0:3c3:835b:5871 with SMTP id bo8-20020a056808228800b003c3835b5871mr12578752oib.30.1710894900913; Tue, 19 Mar 2024 17:35:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710894900; cv=pass; d=google.com; s=arc-20160816; b=URG3iPGFS5kZVdmyB/IYJ1qG86zyiBZQ5W0umTL0CharP1TjOhYLZkIssCF+LsbfGa fDJXdR9tadeNY/Op5RsMCHbCHtk7Bo35ib1VTagyUKEv98KOTemN7oCwx1V1fgXgxw7r zeL94a5Sgj2YogSrdNrsW5jmJXOAeRykledgLW14p6SwbIz9gTU/4fdj2/NeuixxnX9m d3+GxEcszsl3o6EUNbdahGMZQ+GvZ6a3NRv7pQmo/dva/9lG/hh9Jv1F1oJPtKhIxE/u Snlrk9PLZR5yYaaCgK8DkXxZi/1fY0rcx1jN8LeBtuPoRnuefjLScKPWPi3JLvmZZZO8 GoBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=e8/Mppi7+Vr7xQ6beCixfgsT3qjwsW/pZffxPJYKdC0=; fh=qSkAOdUcZDutvNCn9Li2Zn8rtXfP4NRQ9ACJdPciR9Y=; b=q8y0WXWRebkdrOPIoF9cmCJX8mhp69kW2BzneE8APuMpSGahcf+g8oQqZ0pTkPMDLx //UgqW4uHnbdhyOU+qeWEwPEI1pVSBRO9CBV12+/o+1w0Qll6CnhhoeulzZt89O71bYK qacjBDgg0a6daTvK4VKFIMOvdTxYkS/17FAYm9Xfn2TsRQql/kg7aHawVtZgfPN8VwOH SFOGGkYjO/N7kM1UFc8scAYzm52xPQUdbFdcMT3rPWhH4FqZ4yZElo0t09idlpbvZKyU CvV6jn7e+1tOuL+/NxI78viI55Wbs/7j9SLhgmxu+gKO59FswMOuWvIriEBzn0s0OQzL pKlA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-108269-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108269-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e38-20020a631e26000000b005dc4af11fedsi11033823pge.887.2024.03.19.17.35.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 17:35:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108269-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-108269-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108269-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 90765283FEC for ; Wed, 20 Mar 2024 00:35:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2DB26EDB; Wed, 20 Mar 2024 00:34:55 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1983629; Wed, 20 Mar 2024 00:34:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710894894; cv=none; b=KLgDWcNnxb6x98QQZw6OfYLPpyh8D36uyPctmgTEEJAYJlGKEvkuzgR0RsVsUNisesPISXRz76H/oXw6XdTQArUxN3M6jpQl0M1Oy+TClzZocKGaL7erTGEloahmjmaCXjADCL6X8/oUqm846smjTSdc3aySjv6569VkYyc6VG4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710894894; c=relaxed/simple; bh=ZjyLvlOBSSMgSQbTO2EhcxGH7IpxIDHqTWIIUav4yGg=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OYmpz7D5Lo1Vhkd8Bh0lHiHsVZYtympRVprw2vT2LZPvZSuYPkfCXHtSYzWbilooNHRRB4qO1DPb+xT+6e+hlWDWEA8wg5eNljLBiqI5UldCRYYQrmGiOScDMbYt2TGCDkRSqkohflHAD1CMo3y8cEHbHpp+c+JHzdawnSo3aww= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0ED74C433C7; Wed, 20 Mar 2024 00:34:52 +0000 (UTC) Date: Tue, 19 Mar 2024 20:37:16 -0400 From: Steven Rostedt To: Justin Stitt Cc: Nathan Chancellor , mhiramat@kernel.org, mathieu.desnoyers@efficios.com, ndesaulniers@google.com, morbo@google.com, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, Linux Kernel Functional Testing Subject: Re: [PATCH 2/2] tracing: Ignore -Wstring-compare with diagnostic macros Message-ID: <20240319203716.208c9b29@gandalf.local.home> In-Reply-To: References: <20240319-tracing-fully-silence-wstring-compare-v1-0-81adb44403f5@kernel.org> <20240319-tracing-fully-silence-wstring-compare-v1-2-81adb44403f5@kernel.org> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 19 Mar 2024 17:30:41 -0700 Justin Stitt wrote: > > diff --git a/include/trace/stages/stage6_event_callback.h b/include/trace/stages/stage6_event_callback.h > > index 83da83a0c14f..56a4eea5a48e 100644 > > --- a/include/trace/stages/stage6_event_callback.h > > +++ b/include/trace/stages/stage6_event_callback.h > > @@ -35,9 +35,14 @@ > > do { \ > > char *__str__ = __get_str(dst); \ > > int __len__ = __get_dynamic_array_len(dst) - 1; \ > > + __diag_push(); \ > > + __diag_ignore(clang, 11, "-Wstring-compare", \ > > + "__builtin_constant_p() ensures strcmp()" \ > > + "will be used for string literals"); \ > > WARN_ON_ONCE(__builtin_constant_p(src) ? \ > > strcmp((src), __data_offsets.dst##_ptr_) : \ > > (src) != __data_offsets.dst##_ptr_); \ > > What exactly is the point of the literal string comparison? Why > doesn't strcmp do the trick? This is done in the hotpath, and is only for debugging. The string passed into __string() should be the same as the string passed into __assign_str(). But this is moot as I ended up always using strcmp() even if it will slow down the recording of the event. Next merge window the src parameter (along with the strcmp() checks) are going away. -- Steve > > > + __diag_pop(); \ > > memcpy(__str__, __data_offsets.dst##_ptr_ ? : \ > > EVENT_NULL_STR, __len__); \ > > __str__[__len__] = '\0'; \ > > > > -- > > 2.44.0 > >