From patchwork Tue Nov 17 18:27:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. Murphy" X-Patchwork-Id: 9710 X-Patchwork-Delegate: joseph@codesourcery.com Received: (qmail 37655 invoked by alias); 17 Nov 2015 18:27:46 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 37637 invoked by uid 89); 17 Nov 2015 18:27:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: e35.co.us.ibm.com X-IBM-Helo: d03dlp03.boulder.ibm.com X-IBM-MailFrom: murphyp@linux.vnet.ibm.com X-IBM-RcptTo: libc-alpha@sourceware.org Subject: Re: [PATCH] Prevent multiple definition of MIN/MAX To: Joseph Myers References: <564B61EA.7030200@linux.vnet.ibm.com> Cc: "libc-alpha@sourceware.org" , Tulio Magno Quites Machado Filho , Carlos Eduardo Seo From: "Paul E. Murphy" Message-ID: <564B719B.6000105@linux.vnet.ibm.com> Date: Tue, 17 Nov 2015 12:27:39 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15111718-0013-0000-0000-00001A4EEF5D On 11/17/2015 11:25 AM, Joseph Myers wrote: > On Tue, 17 Nov 2015, Paul E. Murphy wrote: > >> Some recent changes caused a redefinition and error when these >> are unconditionally defined. Such was caused by gmp-impl.h being >> included prior. >> >> 2015-11-17 Paul E. Murphy >> >> * misc/sys/param.h (MIN): Guard against an outside definition. >> (MAX): Likewise. > > This is an installed header, and such guards against the user defining a > macro aren't usual in installed headers; the expectation is that if you > include a system header, you don't define any of its macros first. See > the options I suggested in > . > Point taken. Lets try the more conservative option B: shuffling the includes. Second spin attached. From 7ca7f888f09b76b62e07d32a45383342b01352ab Mon Sep 17 00:00:00 2001 From: "Paul E. Murphy" Date: Tue, 17 Nov 2015 11:41:21 -0600 Subject: [PATCH] Shuffle includes in ldbl-128ibm/mpn2ldl.c Kind of hokey, but errno.h drags in misc/sys/param.h which defines MIN/MAX causing an error. Include system headers first to grab MIN/MAX definition in param.h, and define HAVE_ALLOCA to preserve existing behavior. 2015-11-17 Paul E. Murphy * sysdeps/ieee754/ldbl-128ibm/mpn2ldl.c: Include gmp headers after system headers to prevent MIN/MAX redefinition. Define HAVE_ALLOCA to preserve builtin alloca usage. --- sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c b/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c index 90dae93..c7ebd7e 100644 --- a/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c +++ b/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c @@ -15,13 +15,17 @@ License along with the GNU C Library; if not, see . */ -#include "gmp.h" -#include "gmp-impl.h" #include #include #include #include +/* Need to set this when including gmp headers after system headers. */ +#define HAVE_ALLOCA 1 + +#include "gmp.h" +#include "gmp-impl.h" + /* Convert a multi-precision integer of the needed number of bits (106 for long double) and an integral power of two to a `long double' in IBM extended format. */ -- 2.4.3