From owner-svn-src-head@freebsd.org Fri Feb 28 03:04:04 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D4BFD257AFB for ; Fri, 28 Feb 2020 03:04:04 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic310-22.consmr.mail.gq1.yahoo.com (sonic310-22.consmr.mail.gq1.yahoo.com [98.137.69.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48TDrz33Tcz4cZ0 for ; Fri, 28 Feb 2020 03:04:03 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: yMsHelgVM1lSLGqTMxwejMjEOcqo72dUbHhLnwFV5Q3KJrAFAu6O4JVVId8djNg JuJ0i36WPHaN3.8ZQKpFl7Z5D.TuwTisu3YFT.ewXnFtdBLzQkNafd4mTrEr.InfhVe2U58nzdkR Ol3gBl8YNLbOWrgQBLrc2ZdZ9uiOVVWJkTXZKOpDNBVNaZFyZS0RA0SCbDaluJZkiliQQvAdnFNt LYKVJFIM64APE.TUPMUiwRpXbNuxVtyxuUQQyCKD0GIUX08a9K4JLDSDuRb05jF1PUt8jQJ2eM3s RHPHuOr8tT9fHSP7aiR1PAjYsfU8ePi1sx91gZo5mrOI1mBxcCmu_qsoaRhRIgNP0lZw1Kh3MxAE Iu6Nc.8a.mkl_7vKUznlFJmCj8.e.quBueuu3vk4enidpBt.nKebzrTCC47sI_Njl6A_koJZyJC0 7xzrpVOeGuC5NExRIfyO9p9y_pziaWih8jDMbE9d3P9pL5qgxv68ayHYslXeMhhRGx.fpm62d6o6 UEuajckG4tXtrKDvZOdm_Sw1HxpjN9EY.O9xzssyGSZ2tHqClPV7tLLnuWobJtoo.Iyf189dzNqn xJ69klau3KvfjfUH2ZAWnjc8LjX4JXpUCOgRK3KMLo73f0MgZeSwZyyNTgqKLJdVy04SjNLO3KMf o6T.0WvZ8Ov.mZkw2Lu22vZE2mjAc1ASF.L7Qntm8GBMEAKD74nc99klui3PN8MFpwbbq5HdBXqp BKCEtoy1UTfAa9g5B8ttOZbCo3PjORwsTc6p4bNL67d4PYt9_XqLuh9putsjRhZqBa7Q6BMxW8bU Zh0gSqAvc6jVMIbAPI498S3iWEFvNvHQrVMYl3xKqr7peS8RMEtYAy_5KVGjMfjJVwkDfZROpJbY i1AJLuWUDC8_8vRiOj.9KFgTwzkNOHNm0FeCEcuu_h8ysUkUHnt0rdd.ChzNtkrnRuSRJ8YXS49J 3VZ_6Nw.iS0JWyF9PPnQavDmomNwIXuU5GXNO9g3VNJ.vOaivxTcS6aHKbWPCcCut_sM_mmSVo2C SMeHTklARlHdbAcFJeJo3jYmEcKHESyHesn_gksmPSXhrm.5NLNHSiHEJwIf2IF.E5Ln3vGfM3VP EsiayoDS4Jn1xdiAzIUSeaMmGfuh3zCrKOOAPiwc0tvfRknxZnW8YkwyBjZLHLE7.05uBDOLEtkw whMla.zRT1N4uv30end8xCxbsUIWR1tuRorMQNJ1t5g8EIRAwXpWyM_nLCfht6tyad7SOmPkFgxI y9t8h2y7Vq2zJWeGW1k7510hA_N8rJVnY2.DmYtWq.cMKgHsLBK7unjYVUWRfIpFXxMF0XB5gBPy qhq0P0XCed7UmeCWpLIzkcxBT9rdGP5nxPSbBcEGOlwpNnHWYHNLaMFtLV0YqetNkoBD0ppU6bJE FrasYPYaUc31QYG2xwAVF78O38Yw8AtbW3gzEcoC6AUUSw_ooqCiL0GOG Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.gq1.yahoo.com with HTTP; Fri, 28 Feb 2020 03:04:01 +0000 Received: by smtp417.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID e3bdedc1f3abe575e4464ee07df14f6a; Fri, 28 Feb 2020 03:03:58 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\)) Subject: Re: svn commit: r358392 - head/share/man/man9 From: Mark Millard In-Reply-To: <59374055-922a-81f1-1b05-a572e1cb6b1a@FreeBSD.org> Date: Thu, 27 Feb 2020 19:03:58 -0800 Cc: svn-src-head@freebsd.org, Warner Losh Content-Transfer-Encoding: quoted-printable Message-Id: References: <217D39BA-4FDC-490C-8490-533D244E79CE.ref@yahoo.com> <217D39BA-4FDC-490C-8490-533D244E79CE@yahoo.com> <59374055-922a-81f1-1b05-a572e1cb6b1a@FreeBSD.org> To: John Baldwin X-Mailer: Apple Mail (2.3608.60.0.2.5) X-Rspamd-Queue-Id: 48TDrz33Tcz4cZ0 X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.47 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.97)[-0.974,0]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; FREEMAIL_FROM(0.00)[yahoo.com]; MIME_GOOD(-0.10)[text/plain]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; TO_DN_SOME(0.00)[]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; RCVD_IN_DNSWL_NONE(0.00)[148.69.137.98.list.dnswl.org : 127.0.5.0]; RCVD_TLS_LAST(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(0.00)[ip: (-0.23), ipnet: 98.137.64.0/21(0.83), asn: 36647(0.66), country: US(-0.05)]; DWL_DNSWL_NONE(0.00)[yahoo.com.dwl.dnswl.org : 127.0.5.0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Feb 2020 03:04:04 -0000 On 2020-Feb-27, at 16:37, John Baldwin wrote: > On 2/27/20 2:45 PM, Mark Millard wrote: >> John Baldwin jhb at FreeBSD.org wrote on >> Thu Feb 27 16:55:01 UTC 2020: >>=20 >>> On 2/27/20 7:30 AM, Warner Losh wrote: >>>> Author: imp >>>> Date: Thu Feb 27 15:30:13 2020 >>>> New Revision: 358392 >>>> URL: https://svnweb.freebsd.org/changeset/base/358392 >>>>=20 >>>> Log: >>>> _Static_assert is to be preferred to CTASSERT. >>>>=20 >>>> Document the existing prefernce that _Static_assert be used in = preference to the >>>> old CTASSERT we used to use for compile time assertions. >>>=20 >>> Actually, I think what we want to use is static_assert(). The = intention in >>> userland C is that _Static_assert() is an internal keyword and = >>> adds static_assert() as an alias, similar to defining = alignas, >>> etc. I think what we should do for the kernel is have = define >>> map static_assert to _Static_assert and replace existing = _Static_assert >>> usage with the proper spelling. >>>=20 >>=20 >> Be warned static_assert is a C++ keyword as of C++11. >>=20 >> c++11 added: static_assert(bool_constexpr,message) >> c++17 added: static_assert(bool_constexpr) >>=20 >> C11 added _Static_assert(expression,message) >> C2x gets _Static_assert(expression) >>=20 >> C11 added "#define static_assert _Static_assert" to >>=20 >> It makes for a bit of a mess in code to be allowed >> to be processed by both C and C++. >>=20 >> The wording may need to specify enough to tell what to >> do for such code and the headers may need logic to >> cause that context to exist across both languages >> when the header is allowed for both. >=20 > The intent of the C11 changes is to permit equivalent use of = static_assert() > in both languages. The #define in is guarded to not kick = in for > C++. Ahh. I had vague memories of past oddities in the area that I was involved in. So I looked and found (in head -r3578132 source) : # more /usr/src/sys/sys/cdefs.h . . . #if !__has_extension(c_static_assert) #if (defined(__cplusplus) && __cplusplus >=3D 201103L) || \ __has_extension(cxx_static_assert) #define _Static_assert(x, y) static_assert(x, y) #elif __GNUC_PREREQ__(4,6) && !defined(__cplusplus) /* Nothing, gcc 4.6 and higher has _Static_assert built-in */ #elif defined(__COUNTER__) #define _Static_assert(x, y) __Static_assert(x, __COUNTER__) #define __Static_assert(x, y) ___Static_assert(x, y) #define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : = -1] \ __unused #else #define _Static_assert(x, y) struct __hack #endif #endif . . . # more /usr/include/assert.h . . . /* * Static assertions. In principle we could define static_assert for * C++ older than C++11, but this breaks if _Static_assert is * implemented as a macro. * * C++ template parameters may contain commas, even if not enclosed in * parentheses, causing the _Static_assert macro to be invoked with more * than two parameters. */ #if __ISO_C_VISIBLE >=3D 2011 && !defined(__cplusplus) #define static_assert _Static_assert #endif . . . So one can define a _Static_assert macro, sometimes in terms of static_assert, and the other sometimes defines a static_assert macro in terms of _Static_assert. Messy, but possibly localized. That prompted a more general grep: # grep -r "define[ _]*[Ss]tatic_assert" /usr/src/* | more /usr/src/contrib/llvm-project/libcxx/include/__config:# define = static_assert(...) _Static_assert(__VA_ARGS__) /usr/src/contrib/llvm-project/libunwind/src/config.h: #define = static_assert(__b, __m) \ /usr/src/include/assert.h: * Static assertions. In principle we could = define static_assert for /usr/src/include/assert.h:#define static_assert _Static_assert /usr/src/sys/sys/cdefs.h:#define _Static_assert(x, y) = static_assert(x, y) /usr/src/sys/sys/cdefs.h:#define _Static_assert(x, y) = __Static_assert(x, __COUNTER__) /usr/src/sys/sys/cdefs.h:#define __Static_assert(x, y) = ___Static_assert(x, y) /usr/src/sys/sys/cdefs.h:#define ___Static_assert(x, y) typedef = char __assert_ ## y[(x) ? 1 : -1] \ /usr/src/sys/sys/cdefs.h:#define _Static_assert(x, y) struct = __hack /usr/src/usr.bin/dtc/util.hh:#define static_assert(x, y) ((void)0) So not much else. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)