Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1226073rbb; Mon, 26 Feb 2024 02:54:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVtt7td/q2Wt2apY0TF2yu/qqJO6tXwqLqT2Z1AvJqRWWAMt7ehKpha5+xu2jcPUOi3GxySQRM/tdKOgDpkvotey+eQPqFrLUmu1NbvWw== X-Google-Smtp-Source: AGHT+IErnM0Hdlz7Q4QDfNbz4FfDXrikAD5aSpuPGV57XxjoL5d1shIYwc/f76djpg+IoYCiGK8W X-Received: by 2002:a17:902:e748:b0:1db:47bb:671b with SMTP id p8-20020a170902e74800b001db47bb671bmr8451465plf.19.1708944871210; Mon, 26 Feb 2024 02:54:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708944871; cv=pass; d=google.com; s=arc-20160816; b=lno0mJyp+0A9xIc03mnD1OjSnTiOsSt1vG+fp3oDRk8inXB29IMnrBRjFkYxoFXnE9 EtunGd8nesshOnnrgaavHYmbDM7NyS5LRiQu+B41I+XeyKuRPwZ78g7Y17Io9al67Yr8 DsW9gpZ9FJ6sgw7PoRDWE9cuaHmEpu7VVo5xaakIWlq5lrt4NeJ9MXONHvRnRP9JZyya 9VEMpxUntWALgbBma3kkX0CSHS8WVKSIRw9tSGLuyREbl0K3F+0ziOKB16AwaKfhErKd CHWc2T/qllNay7Pu/QSj4v6YzdH1gjZm7gcH8DQMsv0+QrhT6MkWsSUT8HXP9bcPlooa hlyg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:organization:in-reply-to:subject:cc:to :from:dkim-signature; bh=wWiI1VWVZ1dD+v8pibXVYWpGKHj1+dbY3ShEsoORn0E=; fh=3gfK5SPaqJaEvNy9b9o+vGAvZjhwFyCyMMuXd/A1I5Q=; b=brPQAXszaWTjFJGET+iEB2uTn2hguYB1nMOSmuDeclhIYs0gjfsVufxGG9Ug2BnXI7 n+4lTK5Ks38IkxsZRqSbfVf8Bm21n/cBByiRw2GxNJkzRxYEDq7bKhpVZmIqWZmaH0MA icvn/bQnZADQQAMnoeVucahvn2JzVtkvOYWW7y//GcU9dQyCjTFyTFujjKlMDmaguHwo 03Ol5Qsg4ft1Ok1RiRZl1G41pIGAZVTckm+lqzgIfVgbUy/Ze49YT/8O3UvouRzezs7U JoN5W9GTqx1dh8KNBvsqntoJTTOcxg1KNVbS5BYkt3lZfUB0dSlTcGlcRYEcCmbph1mb Kgtg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SLM+liUb; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-81159-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81159-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id f8-20020a170902684800b001dca6379ba1si1114359pln.150.2024.02.26.02.54.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 02:54:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81159-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; dkim=pass header.i=@intel.com header.s=Intel header.b=SLM+liUb; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-81159-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81159-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 80E612892C3 for ; Mon, 26 Feb 2024 10:36:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 061602D058; Mon, 26 Feb 2024 10:27:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SLM+liUb" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) (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 D1704817; Mon, 26 Feb 2024 10:27:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708943252; cv=none; b=bzBsF8t0rCsydfR1bUNQwpEucRA/Zm9pXqDOyjTyZTkFq3Upk9dDdHeUfbQwMH1t2hCoGv7R+yuz23plQJziLx/TMoR9XJbCU3AsR97QuYglDlhExwpiFhZ/L6L9Q0l5oDUHur1ZpP/xcQdKkzGGTVM8kFOlCt2vbIm1zRjNeAs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708943252; c=relaxed/simple; bh=5L9QNoh0f+vRtiDXMwpI8NJgAp36BLuI/7gvCVOlhwg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=k5wRLfpm0zu6UOLLrFaczmPkCy2MmWgKpHTu+zXkfaAVj570FL69udg+FhW55alcyoX6z9wSM5YPPOwvDsWVuy/ZLknuIwbTpd5ntF8mMPWCxoNSbeMF8QNjR3M3RmZ8+8akIisQJwEiF4VlQTTkPYqSb0Pq8zWngwI82dK7Ops= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=SLM+liUb; arc=none smtp.client-ip=192.198.163.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708943250; x=1740479250; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=5L9QNoh0f+vRtiDXMwpI8NJgAp36BLuI/7gvCVOlhwg=; b=SLM+liUbOTfMOALNwe8Lba5XSWMgMzJPJIXsWWFwHNTC/2ZkT4MzmZKJ 4hCzomsahoob/7WtRLTlbsk9nRh533Em6kH+OEDA/EBocCH5k41CKZLKP VgzwPPyaHui480IxgbKeVpe+T2F8+bGP/Qky5kMVRF07JXiI+SSWgnfl+ uB4q2Z8QIwyZxQeNClV0h5jQ5JGsdTp6w1VaU6UbN9LbkMqIRQLfxtdKz VmCSYcz/rws2eioqUyNlORq1NPbO7bJtx1eMwCk2SDDwXjzjhgcbWvlIQ v+cILIeekRoR8D2aSV+j0DU1SB7HtvyNRpjw+Ja3LNI3KzNGKXBzqtBxC A==; X-IronPort-AV: E=McAfee;i="6600,9927,10995"; a="3060928" X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="3060928" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 02:27:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="37629455" Received: from hibeid-mobl.amr.corp.intel.com (HELO localhost) ([10.252.46.254]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 02:27:24 -0800 From: Jani Nikula To: David Laight , "'linux-kernel@vger.kernel.org'" , 'Linus Torvalds' , 'Netdev' , "'dri-devel@lists.freedesktop.org'" Cc: 'Jens Axboe' , "'Matthew Wilcox (Oracle)'" , 'Christoph Hellwig' , "'linux-btrfs@vger.kernel.org'" , 'Andrew Morton' , 'Andy Shevchenko' , "'David S . Miller'" , 'Dan Carpenter' , Rasmus Villemoes Subject: RE: [PATCH next v2 02/11] minmax: Use _Static_assert() instead of static_assert() In-Reply-To: <824b0f70413d4570bcc97b39aad81a93@AcuMS.aculab.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <0fff52305e584036a777f440b5f474da@AcuMS.aculab.com> <8059bc04da1a45bc810ac339a1129a4c@AcuMS.aculab.com> <87v86bo9qi.fsf@intel.com> <824b0f70413d4570bcc97b39aad81a93@AcuMS.aculab.com> Date: Mon, 26 Feb 2024 12:27:22 +0200 Message-ID: <87sf1fo705.fsf@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Mon, 26 Feb 2024, David Laight wrote: > From: Jani Nikula >> Sent: 26 February 2024 09:28 >> >> On Sun, 25 Feb 2024, David Laight wrote: >> > The wrapper just adds two more lines of error output when the test fails. >> >> There are only a handful of places in kernel code that use >> _Static_assert() directly. Nearly 900 instances of static_assert(). > > How many of those supply an error message? At a glance, not many. >> Are we now saying it's fine to use _Static_assert() directly all over >> the place? People will copy-paste and cargo cult. > > Is that actually a problem? I don't know. I'm asking. Usually when we have compiler wrappers, they're meant to be used instead of the thing being wrapped. This series deviates from that, so it would seem to fair to mention it slightly more verbosely than just stating what's being done. > The wrapper allows the error message to be omitted and substitutes > the text of the conditional. > But it isn't 'free'. > As well as slightly slowing down the compilation, the error messages > from the compiler get more difficult to interpret. > > Most of the static_assert() will probably never generate an error. > But the ones in min()/max() will so it is best to make them as > readable as possible. > (Don't even look as the mess clang makes....) I'm not arguing any of this. :) BR, Jani. -- Jani Nikula, Intel