This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch to fix irix6 bootstrap failure in mkdeps.c / basename


The following patch fixes the irix6 bootstrap failure in mkdeps.c
reported here:

http://gcc.gnu.org/ml/gcc-bugs/2001-02/msg00350.html

The problem is that irix6 has no decl for basename in the system
headers.  And the DECL test for basename is (bogusly) passing.  Other
platforms (solaris2) see this also, but their compilers only issue a
warning.

This happens only for basename, not the other decls we test for.  The
reason is because of the way libiberty.h provides a backup decl.  (We
get libiberty.h via system.h during the test.)  Libiberty.h provides a
backup prototype when HAVE_DECL_BASENAME is 0.  Additionally, it
provides a no-argument decl when HAVE_DECL_BASENAME is undefined.  The
macro is undef'ed when the test is run.  Libiberty.h is doing the
right thing because it needs to ensure the return type for basename is
set to char* when someone using libiberty.h hasn't checked for the
decl.  Thus the proper thing to do is to ensure the decl tests elide
any backup decl by pretending HAVE_DECL_* is already 1 during the
test.

Tested on irix6.2 by builing stage1 mkdeps.o (and cc1).
Ok to install?

		--Kaveh


2001-02-16  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* aclocal.m4 (gcc_AC_CHECK_DECL): Before attempting the test,
	define HAVE_DECL_* to 1 to mask potential backup declarations.

diff -rup orig/egcs-CVS20010215/gcc/aclocal.m4 egcs-CVS20010215/gcc/aclocal.m4
--- orig/egcs-CVS20010215/gcc/aclocal.m4	Sun Jan 21 07:23:37 2001
+++ egcs-CVS20010215/gcc/aclocal.m4	Fri Feb 16 11:08:25 2001
@@ -42,6 +42,15 @@ changequote([, ])dnl
 gcc_AC_CHECK_DECL($ac_func,
   [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
   [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
+dnl It is possible that the include files passed in here are local headers
+dnl which supply a backup declaration for the relevant prototype based on
+dnl the definition of (or lack of) the HAVE_DECL_ macro.  If so, this test
+dnl will always return success.  E.g. see libiberty.h's handling of
+dnl `basename'.  To avoid this, we define the relevant HAVE_DECL_ macro to
+dnl 1 so that any local headers used do not provide their own prototype
+dnl during this test.
+#undef $ac_tr_decl
+#define $ac_tr_decl 1
   $4
 )
 done


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]