From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) (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 8901B208B4 for ; Mon, 26 Feb 2024 10:07:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.58.85.151 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708942030; cv=none; b=tEIRQVEAvEk6MoGL5lP91qdRpwuwJk+8wVakw1lrcuynx55FTyXQlyHT8Nzv6PbFhdE+u8P+sbg38H//+D5h4bpvvl3F43dNXSv/kCfKII4Si49DQXkXUvfwg0ou+wkxRraRt3ASvpGOXeqDywk2MWABGOpF4Ao/746UzIHz06g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708942030; c=relaxed/simple; bh=tjXnZ4goM1qumYJwf47U7+WWJdpRRWcTWLqYqEFbbQg=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: MIME-Version:Content-Type; b=RDxrYOy5iOH2YdztKCv8t8h4UNYAKZiuapmKrvMA4xKP/VEFWYhcA5jkEjtvMnRUkAMTKdy97QaG6s96q3HJvEAAgtJYutdLsEg5RV9OaQJ71S/F9ehdGF1YSwD7N7S6Slahlitbk7gy8yfUrUs9gbyP6obQiNjL64hvu8neBds= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ACULAB.COM; spf=pass smtp.mailfrom=aculab.com; arc=none smtp.client-ip=185.58.85.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ACULAB.COM Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aculab.com Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-28-hJeJAT_oPHyxzCcPYljXKg-1; Mon, 26 Feb 2024 10:07:05 +0000 X-MC-Unique: hJeJAT_oPHyxzCcPYljXKg-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Mon, 26 Feb 2024 10:07:04 +0000 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Mon, 26 Feb 2024 10:07:04 +0000 From: David Laight To: 'Jani Nikula' , "'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() Thread-Topic: [PATCH next v2 02/11] minmax: Use _Static_assert() instead of static_assert() Thread-Index: AdpoComWnYboZopTTWeIFfAWCv2rOwAi5neAAAEPFJA= Date: Mon, 26 Feb 2024 10:07:03 +0000 Message-ID: <824b0f70413d4570bcc97b39aad81a93@AcuMS.aculab.com> References: <0fff52305e584036a777f440b5f474da@AcuMS.aculab.com> <8059bc04da1a45bc810ac339a1129a4c@AcuMS.aculab.com> <87v86bo9qi.fsf@intel.com> In-Reply-To: <87v86bo9qi.fsf@intel.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable From: Jani Nikula > Sent: 26 February 2024 09:28 >=20 > On Sun, 25 Feb 2024, David Laight wrote: > > The wrapper just adds two more lines of error output when the test fail= s. >=20 > 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? > 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? 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....) =09David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1= PT, UK Registration No: 1397386 (Wales)