Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/807102/?format=api
{ "id": 807102, "url": "http://patchwork.ozlabs.org/api/1.2/patches/807102/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/patch/alpine.DEB.2.20.1708291415580.8800@digraph.polyomino.org.uk/", "project": { "id": 41, "url": "http://patchwork.ozlabs.org/api/1.2/projects/41/?format=api", "name": "GNU C Library", "link_name": "glibc", "list_id": "libc-alpha.sourceware.org", "list_email": "libc-alpha@sourceware.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<alpine.DEB.2.20.1708291415580.8800@digraph.polyomino.org.uk>", "list_archive_url": null, "date": "2017-08-29T14:16:21", "name": "Fix bits/math-finite.h _MSUF_ expansion namespace (bug 22028) [committed]", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "3f04067fa85e6974802b3ae6d4b265b79e9ab15a", "submitter": { "id": 4349, "url": "http://patchwork.ozlabs.org/api/1.2/people/4349/?format=api", "name": "Joseph Myers", "email": "joseph@codesourcery.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/glibc/patch/alpine.DEB.2.20.1708291415580.8800@digraph.polyomino.org.uk/mbox/", "series": [ { "id": 376, "url": "http://patchwork.ozlabs.org/api/1.2/series/376/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/list/?series=376", "date": "2017-08-29T14:16:21", "name": "Fix bits/math-finite.h _MSUF_ expansion namespace (bug 22028) [committed]", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/376/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/807102/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/807102/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<libc-alpha-return-83823-incoming=patchwork.ozlabs.org@sourceware.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "mailing list libc-alpha@sourceware.org" ], "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=sourceware.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=libc-alpha-return-83823-incoming=patchwork.ozlabs.org@sourceware.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (1024-bit key;\n\tsecure) header.d=sourceware.org header.i=@sourceware.org\n\theader.b=\"lMOwU2Q0\"; dkim-atps=neutral", "sourceware.org; auth=none" ], "Received": [ "from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xhW0Z2c95z9t38\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 30 Aug 2017 00:16:46 +1000 (AEST)", "(qmail 21490 invoked by alias); 29 Aug 2017 14:16:40 -0000", "(qmail 19908 invoked by uid 89); 29 Aug 2017 14:16:40 -0000" ], "DomainKey-Signature": "a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id\n\t:list-unsubscribe:list-subscribe:list-archive:list-post\n\t:list-help:sender:date:from:to:subject:message-id:mime-version\n\t:content-type; q=dns; s=default; b=Ln1/V7In+/Bl/2vPVYtpNJHJJGROY\n\tGjL4mHw0VOj6u0D5vHum4/wa0h2eQZgO3YdT6WvLJ0umjPH3/fHvp+6c9YMJq4Hu\n\tqss64plin5QrACyILFHSRbOL+wc1MCopjPKc2P/MJlfK9YZEmoPwyushTW0Q+u3M\n\tsbGupHwagjCU88=", "DKIM-Signature": "v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id\n\t:list-unsubscribe:list-subscribe:list-archive:list-post\n\t:list-help:sender:date:from:to:subject:message-id:mime-version\n\t:content-type; s=default; bh=xcrng1O5Mz/6WeSbmffqBoGP/vU=; b=lMO\n\twU2Q0jHP5gzIW1TTiZ8ptFUYEF08X3UlDtMzQb6UUeIn5nIjvAAwsFNuuq9zpp3V\n\tyhExyrXDBelX1B6FpYqnrTp3CNgun+fScUIAiYMCUcJZXT26IXkgzGrs7dJ0WGXY\n\tbHsuyajdLy8OtDjO5wNaNeVx+n+eWR104D7lVF7k=", "Mailing-List": "contact libc-alpha-help@sourceware.org; run by ezmlm", "Precedence": "bulk", "List-Id": "<libc-alpha.sourceware.org>", "List-Unsubscribe": "<mailto:libc-alpha-unsubscribe-incoming=patchwork.ozlabs.org@sourceware.org>", "List-Subscribe": "<mailto:libc-alpha-subscribe@sourceware.org>", "List-Archive": "<http://sourceware.org/ml/libc-alpha/>", "List-Post": "<mailto:libc-alpha@sourceware.org>", "List-Help": "<mailto:libc-alpha-help@sourceware.org>,\n\t<http://sourceware.org/ml/#faqs>", "Sender": "libc-alpha-owner@sourceware.org", "X-Virus-Found": "No", "X-Spam-SWARE-Status": "No, score=-24.5 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tRCVD_IN_DNSWL_NONE, SPF_PASS,\n\tURIBL_RED autolearn=ham version=3.3.2 spammy=", "X-HELO": "relay1.mentorg.com", "Date": "Tue, 29 Aug 2017 14:16:21 +0000", "From": "Joseph Myers <joseph@codesourcery.com>", "To": "<libc-alpha@sourceware.org>", "Subject": "Fix bits/math-finite.h _MSUF_ expansion namespace (bug 22028)\n\t[committed]", "Message-ID": "<alpine.DEB.2.20.1708291415580.8800@digraph.polyomino.org.uk>", "User-Agent": "Alpine 2.20 (DEB 67 2015-01-07)", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"US-ASCII\"", "X-ClientProxiedBy": "svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To\n\tsvr-ies-mbx-01.mgc.mentorg.com (139.181.222.1)" }, "content": "The current bits/math-finite.h approach to defining functions for\ndifferent types, involving math.h defining _MSUF_ and _MSUFTO_ for the\nfunction suffixes involved, is not namespace-clean if one of those\nsuffixes (f, l, f128) is defined as a macro by the user before math.h\nis included; too many levels of macro expansion occur. Instead, those\nsuffixes should appear directly in the expansion of the macro using ##\nso they don't get expanded even if defined as macros by the user (that\nis, math.h should be defining __REDIRFROM_X and __REDIRTO_X directly\nto use those suffixes rather than suffixes being passed as an argument\nby macro callers). This patch makes that change.\n\nTested for x86_64. Committed.\n\n2017-08-29 Joseph Myers <joseph@codesourcery.com>\n\n\t[BZ #22028]\n\t* math/math.h [__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0]\n\t(_MSUF_): Remove macro.\n\t[__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0] (_MSUFTO_):\n\tLikewise.\n\t[__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0]\n\t(__REDIRFROM_X): New macro.\n\t[__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0] (__REDIRTO_X):\n\tLikewise.\n\t* math/bits/math-finite.h (__REDIRFROM_X): Remove macro.\n\t(__REDIRTO_X): Likewise.\n\t(__MATH_REDIRCALL): Do not pass _MSUF_ or _MSUFTO_ macro\n\targuments.\n\t(__MATH_REDIRCALL_2): Likewise.\n\t(__MATH_REDIRCALL_INTERNAL): Likewise.\n\t(__REDIRFROM (lgamma, , _MSUF_)): Likewise.\n\t(__REDIRFROM (gamma, , _MSUF_)): Likweise.\n\t(__REDIRFROM (__gamma, _r_finite, _MSUF_)): Likewise.\n\t(__REDIRFROM (tgamma, , _MSUF_)): Likewise.\n\t* math/test-finite-macros.c: New file.\n\t* math/Makefile (tests): Add test-finite-macros.\n\t(CFLAGS-test-finite-macros.c): New variable.", "diff": "diff --git a/math/Makefile b/math/Makefile\nindex 9e88cfc..c47a3a4 100644\n--- a/math/Makefile\n+++ b/math/Makefile\n@@ -196,7 +196,7 @@ tests = test-matherr-3 test-fenv basic-test \\\n \ttest-femode-traps test-iszero-excess-precision \\\n \ttest-iseqsig-excess-precision test-flt-eval-method \\\n \ttest-fp-ilogb-constants test-fp-llogb-constants \\\n-\ttest-fe-snans-always-signal $(tests-static)\n+\ttest-fe-snans-always-signal test-finite-macros $(tests-static)\n tests-static = test-fpucw-static test-fpucw-ieee-static \\\n \t test-signgam-uchar-static test-signgam-uchar-init-static \\\n \t test-signgam-uint-static test-signgam-uint-init-static \\\n@@ -363,6 +363,8 @@ CFLAGS-test-flt-eval-method.c = -fexcess-precision=standard\n \n CFLAGS-test-fe-snans-always-signal.c = -fsignaling-nans\n \n+CFLAGS-test-finite-macros.c = -ffinite-math-only\n+\n include ../Rules\n \n gen-all-calls = $(gen-libm-calls) $(gen-calls)\ndiff --git a/math/bits/math-finite.h b/math/bits/math-finite.h\nindex 4c82958..de57b50 100644\n--- a/math/bits/math-finite.h\n+++ b/math/bits/math-finite.h\n@@ -20,30 +20,26 @@\n # error \"Never use <bits/math-finite.h> directly; include <math.h> instead.\"\n #endif\n \n-#define __REDIRFROM_X(function, reentrant, suffix) \\\n- function ## suffix ## reentrant\n #define __REDIRFROM(...) __REDIRFROM_X(__VA_ARGS__)\n \n-#define __REDIRTO_X(function, reentrant, suffix) \\\n- __ ## function ## suffix ## reentrant ## _finite\n #define __REDIRTO(...) __REDIRTO_X(__VA_ARGS__)\n \n #define __MATH_REDIRCALL_X(from, args, to) \\\n extern _Mdouble_ __REDIRECT_NTH (from, args, to)\n #define __MATH_REDIRCALL(function, reentrant, args) \\\n __MATH_REDIRCALL_X \\\n- (__REDIRFROM (function, reentrant, _MSUF_), args, \\\n- __REDIRTO (function, reentrant, _MSUFTO_))\n+ (__REDIRFROM (function, reentrant), args, \\\n+ __REDIRTO (function, reentrant))\n #define __MATH_REDIRCALL_2(from, reentrant, args, to) \\\n __MATH_REDIRCALL_X \\\n- (__REDIRFROM (from, reentrant, _MSUF_), args, \\\n- __REDIRTO (to, reentrant, _MSUFTO_))\n+ (__REDIRFROM (from, reentrant), args, \\\n+ __REDIRTO (to, reentrant))\n \n #define __MATH_REDIRCALL_INTERNAL(function, reentrant, args) \\\n __MATH_REDIRCALL_X \\\n (__REDIRFROM (__CONCAT (__, function), \\\n-\t\t __CONCAT (reentrant, _finite), _MSUF_), \\\n- args, __REDIRTO (function, _r, _MSUFTO_))\n+\t\t __CONCAT (reentrant, _finite)), \\\n+ args, __REDIRTO (function, _r))\n \n \n /* acos. */\n@@ -129,13 +125,13 @@ __MATH_REDIRCALL_INTERNAL (lgamma, _r, (_Mdouble_, int *));\n && defined __extern_always_inline)\n /* lgamma. */\n __extern_always_inline _Mdouble_\n-__NTH (__REDIRFROM (lgamma, , _MSUF_) (_Mdouble_ __d))\n+__NTH (__REDIRFROM (lgamma, ) (_Mdouble_ __d))\n {\n # if defined __USE_MISC || defined __USE_XOPEN\n- return __REDIRTO (lgamma, _r, _MSUFTO_) (__d, &signgam);\n+ return __REDIRTO (lgamma, _r) (__d, &signgam);\n # else\n int __local_signgam = 0;\n- return __REDIRTO (lgamma, _r, _MSUFTO_) (__d, &__local_signgam);\n+ return __REDIRTO (lgamma, _r) (__d, &__local_signgam);\n # endif\n }\n #endif\n@@ -144,9 +140,9 @@ __NTH (__REDIRFROM (lgamma, , _MSUF_) (_Mdouble_ __d))\n && defined __extern_always_inline) && !__MATH_DECLARING_FLOATN\n /* gamma. */\n __extern_always_inline _Mdouble_\n-__NTH (__REDIRFROM (gamma, , _MSUF_) (_Mdouble_ __d))\n+__NTH (__REDIRFROM (gamma, ) (_Mdouble_ __d))\n {\n- return __REDIRTO (lgamma, _r, _MSUFTO_) (__d, &signgam);\n+ return __REDIRTO (lgamma, _r) (__d, &signgam);\n }\n #endif\n \n@@ -187,21 +183,19 @@ __MATH_REDIRCALL (sqrt, , (_Mdouble_));\n #if defined __USE_ISOC99 && defined __extern_always_inline\n /* tgamma. */\n extern _Mdouble_\n-__REDIRFROM (__gamma, _r_finite, _MSUF_) (_Mdouble_, int *);\n+__REDIRFROM (__gamma, _r_finite) (_Mdouble_, int *);\n \n __extern_always_inline _Mdouble_\n-__NTH (__REDIRFROM (tgamma, , _MSUF_) (_Mdouble_ __d))\n+__NTH (__REDIRFROM (tgamma, ) (_Mdouble_ __d))\n {\n int __local_signgam = 0;\n- _Mdouble_ __res = __REDIRTO (gamma, _r, _MSUFTO_) (__d, &__local_signgam);\n+ _Mdouble_ __res = __REDIRTO (gamma, _r) (__d, &__local_signgam);\n return __local_signgam < 0 ? -__res : __res;\n }\n #endif\n \n #undef __REDIRFROM\n-#undef __REDIRFROM_X\n #undef __REDIRTO\n-#undef __REDIRTO_X\n #undef __MATH_REDIRCALL\n #undef __MATH_REDIRCALL_2\n #undef __MATH_REDIRCALL_INTERNAL\ndiff --git a/math/math.h b/math/math.h\nindex f3eb677..7e41b0d 100644\n--- a/math/math.h\n+++ b/math/math.h\n@@ -644,14 +644,16 @@ iszero (__T __val)\n # define _Mdouble_ double\n # define __MATH_DECLARING_DOUBLE 1\n # define __MATH_DECLARING_FLOATN 0\n-# define _MSUF_\n-# define _MSUFTO_\n+# define __REDIRFROM_X(function, reentrant) \\\n+ function ## reentrant\n+# define __REDIRTO_X(function, reentrant) \\\n+ __ ## function ## reentrant ## _finite\n # include <bits/math-finite.h>\n # undef _Mdouble_\n # undef __MATH_DECLARING_DOUBLE\n # undef __MATH_DECLARING_FLOATN\n-# undef _MSUF_\n-# undef _MSUFTO_\n+# undef __REDIRFROM_X\n+# undef __REDIRTO_X\n \n /* When __USE_ISOC99 is defined, include math-finite for float and\n long double, as well. */\n@@ -661,32 +663,37 @@ iszero (__T __val)\n # define _Mdouble_ float\n # define __MATH_DECLARING_DOUBLE 0\n # define __MATH_DECLARING_FLOATN 0\n-# define _MSUF_ f\n-# define _MSUFTO_ f\n+# define __REDIRFROM_X(function, reentrant) \\\n+ function ## f ## reentrant\n+# define __REDIRTO_X(function, reentrant) \\\n+ __ ## function ## f ## reentrant ## _finite\n # include <bits/math-finite.h>\n # undef _Mdouble_\n # undef __MATH_DECLARING_DOUBLE\n # undef __MATH_DECLARING_FLOATN\n-# undef _MSUF_\n-# undef _MSUFTO_\n+# undef __REDIRFROM_X\n+# undef __REDIRTO_X\n \n /* Include bits/math-finite.h for long double. */\n # ifdef __MATH_DECLARE_LDOUBLE\n # define _Mdouble_ long double\n # define __MATH_DECLARING_DOUBLE 0\n # define __MATH_DECLARING_FLOATN 0\n-# define _MSUF_ l\n+# define __REDIRFROM_X(function, reentrant) \\\n+ function ## l ## reentrant\n # ifdef __NO_LONG_DOUBLE_MATH\n-# define _MSUFTO_\n+# define __REDIRTO_X(function, reentrant) \\\n+ __ ## function ## reentrant ## _finite\n # else\n-# define _MSUFTO_ l\n+# define __REDIRTO_X(function, reentrant) \\\n+ __ ## function ## l ## reentrant ## _finite\n # endif\n # include <bits/math-finite.h>\n # undef _Mdouble_\n # undef __MATH_DECLARING_DOUBLE\n # undef __MATH_DECLARING_FLOATN\n-# undef _MSUF_\n-# undef _MSUFTO_\n+# undef __REDIRFROM_X\n+# undef __REDIRTO_X\n # endif\n \n # endif /* __USE_ISOC99. */\n@@ -697,18 +704,21 @@ iszero (__T __val)\n # define _Mdouble_ _Float128\n # define __MATH_DECLARING_DOUBLE 0\n # define __MATH_DECLARING_FLOATN 1\n-# define _MSUF_ f128\n+# define __REDIRFROM_X(function, reentrant) \\\n+ function ## f128 ## reentrant\n # if __HAVE_DISTINCT_FLOAT128\n-# define _MSUFTO_ f128\n+# define __REDIRTO_X(function, reentrant) \\\n+ __ ## function ## f128 ## reentrant ## _finite\n # else\n-# define _MSUFTO_ l\n+# define __REDIRTO_X(function, reentrant) \\\n+ __ ## function ## l ## reentrant ## _finite\n # endif\n # include <bits/math-finite.h>\n # undef _Mdouble_\n # undef __MATH_DECLARING_DOUBLE\n # undef __MATH_DECLARING_FLOATN\n-# undef _MSUF_\n-# undef _MSUFTO_\n+# undef __REDIRFROM_X\n+# undef __REDIRTO_X\n # endif\n #endif /* __FINITE_MATH_ONLY__ > 0. */\n \ndiff --git a/math/test-finite-macros.c b/math/test-finite-macros.c\nnew file mode 100644\nindex 0000000..94a2f89\n--- /dev/null\n+++ b/math/test-finite-macros.c\n@@ -0,0 +1,35 @@\n+/* Test finite-math-only code does not conflict with user macros (bug 22028).\n+ Copyright (C) 2017 Free Software Foundation, Inc.\n+ This file is part of the GNU C Library.\n+\n+ The GNU C Library is free software; you can redistribute it and/or\n+ modify it under the terms of the GNU Lesser General Public\n+ License as published by the Free Software Foundation; either\n+ version 2.1 of the License, or (at your option) any later version.\n+\n+ The GNU C Library is distributed in the hope that it will be useful,\n+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ Lesser General Public License for more details.\n+\n+ You should have received a copy of the GNU Lesser General Public\n+ License along with the GNU C Library; if not, see\n+ <http://www.gnu.org/licenses/>. */\n+\n+/* The main test is that the inclusion of <math.h> compiles. */\n+#define f first test macro\n+#define l second test macro\n+#define f128 third test macro\n+\n+#include <math.h>\n+\n+volatile float a, b;\n+\n+static int\n+do_test (void)\n+{\n+ b = acosf (a);\n+ return 0;\n+}\n+\n+#include <support/test-driver.c>\n", "prefixes": [] }