From patchwork Wed Sep 29 18:21:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 45580 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5769E3857C7A for ; Wed, 29 Sep 2021 18:21:28 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id BF95B3858406 for ; Wed, 29 Sep 2021 18:21:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BF95B3858406 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: YqlomqyKD9rvWoFHmaoSp7WOkAn0VoJCAVGz0VyOf/i8xM9Ch4L3CR9dVOMKh7ZaEviikgay0i U0WIWNTAr30NGE7iJn7h4uy3HhUsmC+0OntyYqUItrLAg7D8dKitCmy5tEF7dUWobdShuKKOwG ESrBVjiB9/AMzIyEDwEjExSwXalRK5zn3lMMETRtDwZO/n5bO5uPmjZ8MRVRD1MkBn+VQyy3Ri rrXmATJV7FGkMbmkDxgvxVja9Ur/EURZf7GEJbSZRKZdPjiPKXvHiC5Ja3bkCDnVWlrYGAw+XS 0YqU7apX4gM90LCE4Lg+vgv8 X-IronPort-AV: E=Sophos;i="5.85,332,1624348800"; d="scan'208";a="66629337" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 29 Sep 2021 10:21:13 -0800 IronPort-SDR: 0Enh67O/6/rLi2R0//MpBDHhb2RjzuctBiBOpO8SpIX+2v76aOjnM8x/waKw05VobcmbFvqwuu 2i7PhKJvhkcqg1OEkKzRH0Ovpkl2hrGo04ig7ZFMoHqHvTfnYxKT6bgFR4RG3RPNMX1HYT2ByW 93q3awtBf45IrX/FUgWdNtxuBAF/1embAzNkMZq9VdW0P5gXNzg2qqJVnjWssMWsLHGthmpm1f LChFUYnU+4tyFSr1aupTcD++Xu2n4MFja1YS5Vo5xTrIALO8ziCACwc2wE6P8/rifSkZi/Rf3j Trg= Date: Wed, 29 Sep 2021 18:21:08 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Subject: Do not declare fmax, fmin _FloatN, _FloatNx versions for C2X [committed] Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-06.mgc.mentorg.com (139.181.222.6) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-3124.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" At the last WG14 meeting, was accepted, which places more emphasis on the new fmaximum / fminimum functions and less on the old fmax / fmin functions. Some of the changes are to examples, notes or otherwise don't require implementation changes. However, the changes include removing the _FloatN / _FloatNx versions of the fmax and fmin functions that came from TS 18661-3. Thus, those function versions should only be declared under similar conditions to the _FloatN / _FloatNx versions of fmaxmag and fminmag: for _GNU_SOURCE and pre-C2X use of __STDC_WANT_IEC_60559_TYPES_EXT__, but not for C2X without _GNU_SOURCE. In turn this requires a tgmath.h change so that the corresponding tgmath.h macros, for C2X with __STDC_WANT_IEC_60559_TYPES_EXT__ but without _GNU_SOURCE, don't try to use function variants that aren't declared. (That issue doesn't arise for the tgmath.h macros for fmaxmag and fminmag, because those aren't defined at all in those circumstances unless __STDC_WANT_IEC_60559_BFP_EXT__ (from TS 18661-1 and not specified at all by C2X) is also defined, and in that case the _FloatN / _FloatNx versions of fmaxmag and fminmag get declared - this is only ever an issue when it's possible for some functions corresponding to a type-generic-macro to be declared, and for _FloatN / _FloatNx functions in general to be declared, but without the _FloatN / _FloatNx functions corresponding to that particular macro being declared.) Tested for x86_64. --- Committed. diff --git a/math/bits/mathcalls.h b/math/bits/mathcalls.h index ee0c6d7219..da4cf4e10c 100644 --- a/math/bits/mathcalls.h +++ b/math/bits/mathcalls.h @@ -328,11 +328,13 @@ __MATHDECL (long long int,llround,, (_Mdouble_ __x)); /* Return positive difference between X and Y. */ __MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y)); +# if !__MATH_DECLARING_FLOATN || defined __USE_GNU || !__GLIBC_USE (ISOC2X) /* Return maximum numeric value from X and Y. */ __MATHCALLX (fmax,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); /* Return minimum numeric value from X and Y. */ __MATHCALLX (fmin,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); +# endif /* Multiply-add function computed as a ternary operation. */ __MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z)); diff --git a/math/tgmath.h b/math/tgmath.h index 3d7b0998df..e8042833dd 100644 --- a/math/tgmath.h +++ b/math/tgmath.h @@ -892,12 +892,20 @@ /* Return positive difference between X and Y. */ #define fdim(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fdim) +#if __GLIBC_USE (ISOC2X) && !defined __USE_GNU /* Return maximum numeric value from X and Y. */ -#define fmax(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmax) +# define fmax(Val1, Val2) __TGMATH_BINARY_REAL_STD_ONLY (Val1, Val2, fmax) /* Return minimum numeric value from X and Y. */ -#define fmin(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmin) +# define fmin(Val1, Val2) __TGMATH_BINARY_REAL_STD_ONLY (Val1, Val2, fmin) +#else +/* Return maximum numeric value from X and Y. */ +# define fmax(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmax) +/* Return minimum numeric value from X and Y. */ +# define fmin(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmin) +#endif + /* Multiply-add function computed as a ternary operation. */ #define fma(Val1, Val2, Val3) \