This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: PATCH: Don't include <bits/mathinline.h> if __NO_MATH_INLINES isdefined
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 16 Sep 2011 11:38:25 -0700
- Subject: Re: PATCH: Don't include <bits/mathinline.h> if __NO_MATH_INLINES isdefined
- References: <20110916051459.GA10683@intel.com><20110916053123.GA10853@intel.com>
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
On Thu, Sep 15, 2011 at 10:31:23PM -0700, H.J. Lu wrote:
> On Thu, Sep 15, 2011 at 10:14:59PM -0700, H.J. Lu wrote:
> > Hi,
> >
> > GCC 4.7 failed to compile math/test-tgmath.o and math/test-tgmath2.o
> > on Linux/x86-64:
> >
> > test-tgmath.c: In function âmainâ:
> > test-tgmath.c:698:4: error: inlining failed in call to always_inline
> > âlrintâ: function not inlinable
> > test-tgmath.c:267:7: error: called from here
> > test-tgmath.c:714:4: error: inlining failed in call to always_inline
> > âllrintâ: function not inlinable
> > test-tgmath.c:268:7: error: called from here
> > In file included from test-tgmath.c:201:0:
> > test-tgmath.c:698:1: error: inlining failed in call to always_inline
> > âlrintfâ: function not inlinable
> > test-tgmath.c:267:7: error: called from here
> > test-tgmath.c:714:1: error: inlining failed in call to always_inline
> > âllrintfâ: function not inlinable
> > test-tgmath.c:268:7: error: called from here
> >
> > It defines __NO_MATH_INLINES. But <bits/mathinline.h> is still
> > included. This patch fixes it.
> >
> >
> > H.J.
> > ----
> > 2011-09-15 H.J. Lu <hongjiu.lu@intel.com>
> >
> > * math/math.h: Don't include <bits/mathinline.h> if
> > __NO_MATH_INLINES is defined.
> >
>
> When __LIBC_INTERNAL_MATH_INLINES is defined, <bits/mathinline.h>
> should be included since libm is compiled with
>
> -D__NO_MATH_INLINES -D__LIBC_INTERNAL_MATH_INLINES
>
>
We also need to undef __LIBC_INTERNAL_MATH_INLINES in math/test-tgmath.c
and math/test-tgmath2.c since -D__LIBC_INTERNAL_MATH_INLINES is used
to compile them.
H.J.
---
2011-09-16 H.J. Lu <hongjiu.lu@intel.com>
* math/math.h: Include <bits/mathinline.h> if
__LIBC_INTERNAL_MATH_INLINES is defined or __NO_MATH_INLINES
isn't defined.
* math/test-tgmath.c: Undef __LIBC_INTERNAL_MATH_INLINES.
* math/test-tgmath2.c: Likewise.
diff --git a/math/math.h b/math/math.h
index aeb54d9..f6f9fbc 100644
--- a/math/math.h
+++ b/math/math.h
@@ -412,7 +412,8 @@ extern int matherr (struct exception *__exc);
#endif
/* Get machine-dependent inline versions (if there are any). */
-#ifdef __USE_EXTERN_INLINES
+#if defined __USE_EXTERN_INLINES \
+ && (defined __LIBC_INTERNAL_MATH_INLINES || !defined __NO_MATH_INLINES)
# include <bits/mathinline.h>
#endif
diff --git a/math/test-tgmath.c b/math/test-tgmath.c
index 8ec7fc4..138e3c0 100644
--- a/math/test-tgmath.c
+++ b/math/test-tgmath.c
@@ -22,6 +22,7 @@
#ifndef HAVE_MAIN
#undef __NO_MATH_INLINES
#define __NO_MATH_INLINES 1
+#undef __LIBC_INTERNAL_MATH_INLINES
#include <math.h>
#include <stdio.h>
#include <tgmath.h>
diff --git a/math/test-tgmath2.c b/math/test-tgmath2.c
index edb723c..c7f8123 100644
--- a/math/test-tgmath2.c
+++ b/math/test-tgmath2.c
@@ -21,6 +21,7 @@
#ifndef HAVE_MAIN
#undef __NO_MATH_INLINES
#define __NO_MATH_INLINES 1
+#undef __LIBC_INTERNAL_MATH_INLINES
#include <math.h>
#include <complex.h>
#include <stdio.h>