Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1204178rbb; Mon, 26 Feb 2024 01:58:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWEyfJQCyJ7zSflseQjRZzS2lHMGju1ZAWsD2Jse3nEqpyRpwcPmgjMY/lZ6q1bg+c/rtumJbSh8rg3GnQccQAdBs+TMy2yc/5x2/lCsQ== X-Google-Smtp-Source: AGHT+IGNTXS18KI3zs4QZAqKZoxeDDxnvr+8ziGBpPFt7SDeWrZrlItEibSd4vJu5PZl4aT2Pokg X-Received: by 2002:a05:6808:1294:b0:3c0:4196:8e2c with SMTP id a20-20020a056808129400b003c041968e2cmr9162127oiw.43.1708941505037; Mon, 26 Feb 2024 01:58:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708941505; cv=pass; d=google.com; s=arc-20160816; b=NfdpnhugrhwqTYFmRyJSsedM9knmDVS/tMWSmRJEhV0eZAbLIp0pPr8gqYetqjwNTu ZWodm1oai2kHhPVTso3xcXgCbCs/MXKv5RnhmJjVomoZMs/liDbUlSzLJf1hAz2hs6zX IaPxs+Pnk0I53rjOdVsGaHIeZklRq2X/B0QTQZapnrgM4QsTMCEE1VxbhlHiq/T//xAu rWwyW4y/yPt2gd/ijSExi5GS01f3glFhfzDLFijiFKISl1bSdqzeK5beqiuWpVIpAvWr U1e5NOzCtSmpA6Ep2cMprBzbtgeM4kzGQ52MGLajxAtzIOQ3XQEwCBoX0ddjjufCQa8U Unig== 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=wVvOa2vcM+1oBnPTFbTtA1hvAaxR+G/wizSnzJQcCo0=; fh=3gfK5SPaqJaEvNy9b9o+vGAvZjhwFyCyMMuXd/A1I5Q=; b=PB5G+F1JU6phESWWLztWujJ/77J7gQWFD9JS4tPfHiDRsATjJERSRwUedwPG1ULfBi orFfz5s7in/fHbnMQZo0bH5AaI5PnDdLY3xVRKHwRrnlifMMCHe1M2BiBdooCLjf+HHV eeL469jFFoHwmBseiv759yDgOetWoJ8o1dTDcfD45nRvlXfyonrijN0x9goCSefHKO1T RMsXPT954SlYYVuqrIPkHFUGXnXaafHqo2kYHVPhmH8Vh7VBmqnetDZY2IgwfteWbgz+ fPJlgpukDSa8izJwDyuH6W0KqkeQpBpcEbcbRs9BsPJ0FJKTrF9B34Hwg4GWTM0Q0ouY EXWA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=T+b5dLDl; 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-81053-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81053-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c15-20020ac8660f000000b0042e5b20327bsi4762626qtp.538.2024.02.26.01.58.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 01:58:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81053-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=T+b5dLDl; 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-81053-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81053-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C53341C256B9 for ; Mon, 26 Feb 2024 09:58:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1002356466; Mon, 26 Feb 2024 09:28:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="T+b5dLDl" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (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 79D2055E7B; Mon, 26 Feb 2024 09:28:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708939711; cv=none; b=FYb9NH7oAlIiY/cX2FLvURcDur7gAnDJRzyu14ttzDLeO0iy0Q/wNBTIZDLLEWtL6NJinf7GQTm+Iw4fzDuUUDhSFV34WNZaRq9TSMYLSJnMBoii1SVArfNii/jA3swvAHch6lTS2Y1ypPg1OnvpTMLBpMggqlIovUKsyucXyX4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708939711; c=relaxed/simple; bh=Wz4SoLxzTswpch9tgCM4x5EOC43eeKmpBEQj+YZz5+s=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=ivnY03edtaPlVbzEFQamqV+Sp52GI+8eFGM2fVFJK2IS8k8xc/v0INha+GknI0K/bHAmvuXiZA+CgfVbOieb2I137xozjhDHHyICWFZ9QLGXvBlBhDw3M2GajfUrvQ3sJ/SgB+dhmWhU6uS/yFMdyP3WcCDnGWEkfLNVdY7Tpvo= 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=T+b5dLDl; arc=none smtp.client-ip=198.175.65.15 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=1708939710; x=1740475710; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=Wz4SoLxzTswpch9tgCM4x5EOC43eeKmpBEQj+YZz5+s=; b=T+b5dLDli/pkMK+JL5A83wZJ10bnvlEWVz0KLQvTS8lPvd1bprzo91Y4 wAIKFyv/SIsBB0J/Eaiq6zHkaqPoZ5cYkhKPcTXIdLrDUL/pxrJtZc8zW A9XyorGyIsRs6mR/pUCXmrFDYCZgPANCIMaIicQkVA7UtcKHjzO84wCGB lHIcEQ6VhmYUQbS4nYDpmmCQaF23mRs9k+TsOoHy9zk27h6U5uqvKqpyd Dyz5I+16AKLeYDCU4Rx543n8dqg+FIXK2Ik7jVW1Eg7j4Pn8Ocdq7GnC9 HVUhTyBJ3SEhZBpS20oQ6GtDCDt4LLA3IMiO0OAVjjim8wBqglrnlABBP g==; X-IronPort-AV: E=McAfee;i="6600,9927,10995"; a="7029302" X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="7029302" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 01:28:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="11169213" Received: from hibeid-mobl.amr.corp.intel.com (HELO localhost) ([10.252.46.254]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 01:28: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: <8059bc04da1a45bc810ac339a1129a4c@AcuMS.aculab.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <0fff52305e584036a777f440b5f474da@AcuMS.aculab.com> <8059bc04da1a45bc810ac339a1129a4c@AcuMS.aculab.com> Date: Mon, 26 Feb 2024 11:28:21 +0200 Message-ID: <87v86bo9qi.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 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(). Are we now saying it's fine to use _Static_assert() directly all over the place? People will copy-paste and cargo cult. BR, Jani. > > Signed-off-by: David Laight > --- > include/linux/minmax.h | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > Changes for v2: > - Typographical and spelling corrections to the commit messages. > Patches unchanged. > > diff --git a/include/linux/minmax.h b/include/linux/minmax.h > index 63c45865b48a..900eec7a28e5 100644 > --- a/include/linux/minmax.h > +++ b/include/linux/minmax.h > @@ -48,7 +48,7 @@ > #define __cmp_once(op, x, y, unique_x, unique_y) ({ \ > typeof(x) unique_x = (x); \ > typeof(y) unique_y = (y); \ > - static_assert(__types_ok(x, y), \ > + _Static_assert(__types_ok(x, y), \ > #op "(" #x ", " #y ") signedness error, fix types or consider u" #op "() before " #op "_t()"); \ > __cmp(op, unique_x, unique_y); }) > > @@ -137,11 +137,11 @@ > typeof(val) unique_val = (val); \ > typeof(lo) unique_lo = (lo); \ > typeof(hi) unique_hi = (hi); \ > - static_assert(__builtin_choose_expr(__is_constexpr((lo) > (hi)), \ > + _Static_assert(__builtin_choose_expr(__is_constexpr((lo) > (hi)), \ > (lo) <= (hi), true), \ > "clamp() low limit " #lo " greater than high limit " #hi); \ > - static_assert(__types_ok(val, lo), "clamp() 'lo' signedness error"); \ > - static_assert(__types_ok(val, hi), "clamp() 'hi' signedness error"); \ > + _Static_assert(__types_ok(val, lo), "clamp() 'lo' signedness error"); \ > + _Static_assert(__types_ok(val, hi), "clamp() 'hi' signedness error"); \ > __clamp(unique_val, unique_lo, unique_hi); }) > > #define __careful_clamp(val, lo, hi) ({ \ -- Jani Nikula, Intel