This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Patch to fix regenerating libiberty/config.in
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: ebotcazou at libertysurf dot fr
- Cc: binutils at sources dot redhat dot com, dj at redhat dot com, gcc-patches at gcc dot gnu dot org, gdr at integrable-solutions dot net, mark at codesourcery dot com
- Date: Sun, 13 Apr 2003 13:17:46 -0400 (EDT)
- Subject: Re: Patch to fix regenerating libiberty/config.in
- References: <200302121958.OAA06795@caip.rutgers.edu> <200304101258.26650.ebotcazou@libertysurf.fr> <200304122053.05252.ebotcazou@libertysurf.fr>
> From: Eric Botcazou <ebotcazou at libertysurf dot fr>
>
> > > 2003-02-12 Kaveh R. Ghazi <ghazi at caip dot rutgers dot edu>
> > >
> > > * acconfig.h: New file. Add uintptr_t.
> > > * config.in: Regenerated.
> >
> > This patch breaks bootstrap on sparc-sun-solaris2.5.1:
> >
> > "../src/libiberty/regex.c", line 305: invalid type combination
> > "../src/libiberty/regex.c", line 305: warning: useless declaration
> > "../src/libiberty/regex.c", line 305: warning: typedef declares no type
> > name
>
> The problem is pretty obvious: config.h contains these lines
> /* Define to `unsigned long' if <sys/types.h> doesn't define. */
> #define uintptr_t unsigned long
> /* Define if you have the `uintptr_t' type. */
> /* #undef HAVE_UINTPTR_T */
> and regex.c contains these lines
> # if !defined _LIBC && !defined HAVE_UINTPTR_T
> typedef unsigned long int uintptr_t;
> # endif
> so there is a conflict. Reverting the patch or removing the typedef appears
> to be sufficient to restore bootstrap, but I don't know enough libiberty to
> decide which solution is the best/safest. Thanks in advance for your help.
> Eric Botcazou
I had a chance to look more closely this morning.
While reverting the original patch may restore bootstrap, I think that
would be wrong. See the original motivation for it here:
http://gcc.gnu.org/ml/gcc-patches/2003-02/msg00938.html
I'd also prefer not to remove the typedef in regex.c since we want to
avoid gratuitous diffs with the upstream glibc copy.
I believe the following patch is the proper solution. What we had was
a genuine bug in configure.in. In there we check for uintptr_t and
provide a fallback define if that type doesn't exist. Then we'd check
the shell variable result of the test and define HAVE_UINTPTR_T only
if the test succeeded. That's bogus.
Since the fallback macro ensures we always have uintptr_t in some
form, we should unconditionally define HAVE_UINTPTR_T for the benefit
of regex.c and anyone else in libiberty who might rely on it.
(Currently no other files in 3.2.x do.)
I bootstrapped this on sparc-sun-solaris2.7, but that's not much of a
test since solaris2.7 has a uintptr_t and never saw your problem.
Can you please try the patch with 3.2.x on solaris2.5.1 and see if it
cures your bootstrap breakage?
If it does, ok everywhere?
Thanks,
--Kaveh
2003-04-13 Kaveh R. Ghazi <ghazi at caip dot rutgers dot edu>
* configure.in (HAVE_UINTPTR_T): Always define.
diff -rup orig/egcc-3.2-CVS20030413/libiberty/configure.in egcc-3.2-CVS20030413/libiberty/configure.in
--- orig/egcc-3.2-CVS20030413/libiberty/configure.in Sun Feb 2 23:05:46 2003
+++ egcc-3.2-CVS20030413/libiberty/configure.in Sun Apr 13 12:01:58 2003
@@ -134,11 +134,10 @@ AC_HEADER_TIME
libiberty_AC_DECLARE_ERRNO
AC_CHECK_TYPE(uintptr_t, unsigned long)
-
-if test $ac_cv_type_uintptr_t = yes
-then
- AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if you have the \`uintptr_t' type.])
-fi
+# Given the above check, we always have uintptr_t or a fallback
+# definition. So define HAVE_UINTPTR_T in case any imported code
+# relies on it.
+AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if you have the \`uintptr_t' type.])
# This is the list of functions which libiberty will provide if they
# are not available on the host.