This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [3.0 critical] Make fixproto deal with assert.h
On Thu, May 10, 2001 at 03:12:36PM -0700, Mark Mitchell wrote:
>
> Zack> Or I could get rid of assert.h and not bother changing its
> Zack> users. Autoconf uses assert.h unconditionally in
> Zack> AC_CHECK_FUNC and no one's complained -- suggests that it's
> Zack> near-universal on systems people actually care about.
>
> Zack> What would you prefer?
>
> I like that solution, and I think its usage in AC_CHECK_FUNC is very
> good evidence for its universality.
Okay, that's only a small change. Here's a revised patch.
--
zw This APT has Super Cow Powers.
-- apt-get 0.5
* Makefile.in: Exterminate all references to assert.h.
* cross-make: Likewise.
* assert.h: Delete.
* configure.in: Correct commentary.
* configure: Regenerate.
* po/POTFILES.in: Remove assert.h.
* libgcc-std.ver, libgcc2.c, libgcc2.h, sys-protos.h:
Remove __eprintf.
* config/t-freebsd, config/t-linux, config/t-linux-aout,
config/t-netbsd, config/t-rtems, config/x-linux,
config/i386/t-beos, config/mcore/t-mcore, config/mcore/t-mcore-pe:
No need to override INSTALL_ASSERT_H.
* fixinc/fixinc.dgux, fixinc/fixinc.interix, fixinc/fixinc.ptx,
fixinc/fixinc.svr4, fixinc/fixinc.winnt, fixinc/fixinc.wrap,
fixinc/fixincl.sh: Don't install assert.h into objdir/include.
===================================================================
Index: Makefile.in
--- Makefile.in 2001/05/09 14:19:59 1.602.2.16
+++ Makefile.in 2001/05/11 00:17:21
@@ -182,10 +182,6 @@ USER_H = $(srcdir)/ginclude/stdarg.h $(s
$(srcdir)/ginclude/stdbool.h $(srcdir)/ginclude/iso646.h \
$(EXTRA_HEADERS) $(LANG_EXTRA_HEADERS)
-# Target to use whe installing assert.h. Some systems may
-# want to set this empty.
-INSTALL_ASSERT_H = install-assert-h
-
# The GCC to use for compiling libgcc.a, enquire, and libgcc1-test.
# Usually the one we just built.
# Don't use this as a dependency--use $(GCC_PASSES) or $(GCC_PARTS).
@@ -320,9 +316,6 @@ build_tooldir = $(exec_prefix)/$(target_
gcc_gxx_include_dir = @gcc_gxx_include_dir@
# Directory to search for site-specific includes.
includedir = $(local_prefix)/include
-# assertdir is overridden in cross-make.
-# (But this currently agrees with what is in cross-make.)
-assertdir = $(gcc_tooldir)/include
# where the info files go
infodir = @infodir@
# Where cpp should go besides $prefix/bin if necessary
@@ -2107,8 +2100,8 @@ stmp-fixinc: fixinc.sh gsyslimits.h
rm -rf include; mkdir include
-chmod a+rx include
(TARGET_MACHINE=$(target); srcdir=`cd $(srcdir); pwd`; \
- INSTALL_ASSERT_H=$(INSTALL_ASSERT_H); SHELL=$(SHELL) ;\
- export TARGET_MACHINE srcdir INSTALL_ASSERT_H SHELL ; \
+ SHELL=$(SHELL) ;\
+ export TARGET_MACHINE srcdir SHELL ; \
$(SHELL) ./fixinc.sh `pwd`/include $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS); \
rm -f include/syslimits.h; \
if [ -f include/limits.h ]; then \
@@ -2486,7 +2479,6 @@ installdirs:
-if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; chmod a+rx $(bindir) ; fi
-if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; chmod a+rx $(includedir) ; fi
-if [ -d $(gcc_tooldir) ] ; then true ; else mkdir $(gcc_tooldir) ; chmod a+rx $(gcc_tooldir) ; fi
- -if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; chmod a+rx $(assertdir) ; fi
-if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; chmod a+rx $(infodir) ; fi
-if [ -d $(slibdir) ] ; then true ; else mkdir $(slibdir) ; chmod a+rx $(slibdir) ; fi
# We don't use mkdir -p to create the parents of man1dir,
@@ -2670,7 +2662,7 @@ install-multilib: stmp-multilib installd
-f libgcc.mk install
# Install all the header files built in the include subdirectory.
-install-headers: install-include-dir $(INSTALL_HEADERS_DIR) $(INSTALL_ASSERT_H)
+install-headers: install-include-dir $(INSTALL_HEADERS_DIR)
# Fix symlinks to absolute paths in the installed include directory to
# point to the installed directory, not the build directory.
# Don't need to use LN_S here since we really do need ln -s and no substitutes.
@@ -2709,29 +2701,6 @@ install-headers-cpio: stmp-int-hdrs $(ST
# See discussion about the use of `pwd` above
cd `pwd`/include ; \
find . -print | cpio -pdum $(libsubdir)/include
-
-# Put assert.h where it won't override GNU libc's assert.h.
-# It goes in a dir that is searched after GNU libc's headers;
-# thus, the following conditionals are no longer needed.
-# But it's not worth deleting them now.
-## Don't replace the assert.h already there if it is not from GCC.
-## This code would be simpler if it tested for -f ... && ! grep ...
-## but supposedly the ! operator is missing in sh on some systems.
-install-assert-h: assert.h installdirs
- if [ -f $(assertdir)/assert.h ]; \
- then \
- if grep "__eprintf" $(assertdir)/assert.h >/dev/null; \
- then \
- rm -f $(assertdir)/assert.h; \
- $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
- chmod a-x $(assertdir)/assert.h; \
- else true; \
- fi; \
- else \
- rm -f $(assertdir)/assert.h; \
- $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
- chmod a-x $(assertdir)/assert.h; \
- fi
# Use this target to install the program `collect2' under the name `collect2'.
install-collect2: collect2 installdirs
===================================================================
Index: assert.h
--- assert.h Thu May 10 17:17:23 2001
+++ assert.h Tue May 5 13:32:27 1998
@@ -1,54 +0,0 @@
-/* Allow this file to be included multiple times
- with different settings of NDEBUG. */
-#undef assert
-#undef __assert
-
-#ifdef NDEBUG
-#define assert(ignore) ((void) 0)
-#else
-
-#ifndef __GNUC__
-
-#define assert(expression) \
- ((void) ((expression) ? 0 : __assert (expression, __FILE__, __LINE__)))
-
-#define __assert(expression, file, lineno) \
- (printf ("%s:%u: failed assertion\n", file, lineno), \
- abort (), 0)
-
-#else
-
-#if defined(__STDC__) || defined (__cplusplus)
-
-/* Defined in libgcc.a */
-#ifdef __cplusplus
-extern "C" {
-extern void __eprintf (const char *, const char *, unsigned, const char *)
- __attribute__ ((noreturn));
-}
-#else
-extern void __eprintf (const char *, const char *, unsigned, const char *)
- __attribute__ ((noreturn));
-#endif
-
-#define assert(expression) \
- ((void) ((expression) ? 0 : __assert (#expression, __FILE__, __LINE__)))
-
-#define __assert(expression, file, line) \
- (__eprintf ("%s:%u: failed assertion `%s'\n", \
- file, line, expression), 0)
-
-#else /* no __STDC__ and not C++; i.e. -traditional. */
-
-extern void __eprintf () __attribute__ ((noreturn)); /* Defined in libgcc.a */
-
-#define assert(expression) \
- ((void) ((expression) ? 0 : __assert (expression, __FILE__, __LINE__)))
-
-#define __assert(expression, file, lineno) \
- (__eprintf ("%s:%u: failed assertion `%s'\n", \
- file, lineno, "expression"), 0)
-
-#endif /* no __STDC__ and not C++; i.e. -traditional. */
-#endif /* no __GNU__; i.e., /bin/cc. */
-#endif
===================================================================
Index: configure.in
--- configure.in 2001/04/26 04:32:10 1.483.2.11
+++ configure.in 2001/05/11 00:17:21
@@ -1033,10 +1033,9 @@ fi
# have its own set of headers then define
# inhibit_libc
-# If this is using newlib, then define inhibit_libc in
-# LIBGCC2_CFLAGS. This will cause __eprintf to be left out of
-# libgcc.a, but that's OK because newlib should have its own version of
-# assert.h.
+# If this is using newlib, then define inhibit_libc in LIBGCC2_CFLAGS.
+# This prevents libgcc2 from containing any code which requires libc
+# support.
inhibit_libc=
if [test x$host != x$target] && [test x$with_headers = x]; then
inhibit_libc=-Dinhibit_libc
===================================================================
Index: cross-make
--- cross-make 2000/01/13 00:37:05 1.7
+++ cross-make 2001/05/11 00:17:21
@@ -9,6 +9,3 @@ SYSTEM_HEADER_DIR = $(CROSS_SYSTEM_HEADE
# Don't try to compile the things we can't compile.
ALL = all.cross
-
-# Don't install assert.h in /usr/local/include.
-assertdir = $(tooldir)/include
===================================================================
Index: libgcc-std.ver
--- libgcc-std.ver 2001/04/25 00:04:37 1.4.4.2
+++ libgcc-std.ver 2001/05/11 00:17:22
@@ -107,7 +107,6 @@ GCC_3.0 {
# ??? Symbols that perhaps unused should be nuked.
__clear_cache
- __eprintf
__gcc_bcmp
# EH symbols
===================================================================
Index: libgcc2.c
--- libgcc2.c 2001/04/25 00:04:37 1.115.2.1
+++ libgcc2.c 2001/05/11 00:17:22
@@ -1238,24 +1238,6 @@ __gcc_bcmp (const unsigned char *s1, con
}
#endif
-
-#ifdef L_eprintf
-#ifndef inhibit_libc
-
-#undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch. */
-#include <stdio.h>
-/* This is used by the `assert' macro. */
-void
-__eprintf (const char *string, const char *expression,
- unsigned int line, const char *filename)
-{
- fprintf (stderr, string, expression, line, filename);
- fflush (stderr);
- abort ();
-}
-
-#endif
-#endif
#ifdef L_bb
===================================================================
Index: libgcc2.h
--- libgcc2.h 2001/04/25 00:04:38 1.14.2.1
+++ libgcc2.h 2001/05/11 00:17:22
@@ -40,8 +40,6 @@ extern void __rethrow (void *);
extern void __throw (void);
extern void __sjthrow (void) __attribute__ ((__noreturn__));
extern void __sjpopnthrow (void) __attribute__ ((__noreturn__));
-extern void __eprintf (const char *, const char *, unsigned int, const char *)
- __attribute__ ((__noreturn__));
extern void *__eh_alloc (size_t);
extern void __eh_free (void *);
===================================================================
Index: sys-protos.h
--- sys-protos.h 2000/07/17 09:23:16 1.6
+++ sys-protos.h 2001/05/11 00:17:22
@@ -16,7 +16,6 @@ extern int __aread(in
extern void __assert(const char *, const char *, int);
extern int __asyncio(int, aioop_t *, int);
extern int __awrite(int, int, char *, uint, ecb_t *);
-extern void __eprintf(const char *);
extern int __evcntl(evver_t, evcntlcmds_t, long int, long int);
extern int __evexit(evver_t, idtype_t, id_t, const ecb_t *);
extern int __evexitset(evver_t, const procset_t *, hostid_t, const ecb_t *);
===================================================================
Index: config/t-freebsd
--- config/t-freebsd 2001/05/03 21:27:34 1.3.14.1
+++ config/t-freebsd 2001/05/11 00:17:22
@@ -1,8 +1,5 @@
# Don't run fixproto
STMP_FIXPROTO =
-# Don't install "assert.h" in gcc. We use the system one.
-INSTALL_ASSERT_H =
-
# Compile crtbeginS.o and crtendS.o with pic.
CRTSTUFF_T_CFLAGS_S = -fPIC
===================================================================
Index: config/t-linux
--- config/t-linux 2001/01/07 21:55:09 1.8
+++ config/t-linux 2001/05/11 00:17:22
@@ -1,9 +1,6 @@
# Don't run fixproto
STMP_FIXPROTO =
-# Don't install "assert.h" in gcc. We use the one in glibc.
-INSTALL_ASSERT_H =
-
# Compile crtbeginS.o and crtendS.o with pic.
CRTSTUFF_T_CFLAGS_S = -fPIC
# Compile libgcc2.a with pic.
===================================================================
Index: config/t-linux-aout
--- config/t-linux-aout 1998/12/16 21:00:10 1.3
+++ config/t-linux-aout 2001/05/11 00:17:22
@@ -1,9 +1,6 @@
# Don't run fixproto
STMP_FIXPROTO =
-# Don't install "assert.h" in gcc. We use the one in glibc.
-INSTALL_ASSERT_H =
-
# Do not build libgcc1. Let gcc generate those functions. The GNU/Linux
# C library can handle them.
LIBGCC1 =
===================================================================
Index: config/t-netbsd
--- config/t-netbsd 1998/12/16 21:00:12 1.3
+++ config/t-netbsd 2001/05/11 00:17:22
@@ -4,6 +4,3 @@ LIBGCC1_TEST=
# Don't run fixproto
STMP_FIXPROTO =
-
-# Don't install "assert.h" in gcc. We use the one in glibc.
-INSTALL_ASSERT_H =
===================================================================
Index: config/t-rtems
--- config/t-rtems 1999/03/31 00:50:40 1.4
+++ config/t-rtems 2001/05/11 00:17:22
@@ -1,9 +1,6 @@
# RTEMS uses newlib which does not require prototype fixing
STMP_FIXPROTO =
-# Don't install "assert.h" in gcc. RTEMS uses the one in newlib.
-INSTALL_ASSERT_H =
-
# RTEMS always has limits.h.
LIMITS_H_TEST = true
===================================================================
Index: config/x-linux
--- config/x-linux 1998/12/16 21:00:15 1.2
+++ config/x-linux 2001/05/11 00:17:22
@@ -1,5 +1,2 @@
# Don't run fixproto
STMP_FIXPROTO =
-
-# Don't install "assert.h" in gcc. We use the one in glibc.
-INSTALL_ASSERT_H =
===================================================================
Index: config/i386/t-beos
--- config/i386/t-beos 2000/08/02 07:04:33 1.2
+++ config/i386/t-beos 2001/05/11 00:17:22
@@ -6,6 +6,3 @@ CROSS_LIBGCC1 =
# we are most likely to want to apply any fixes to.
SYSTEM_HEADER_DIR = /boot/develop/headers/posix
CROSS_SYSTEM_HEADER_DIR = $(tooldir)/sys-include/posix
-
-# Use the system assert.h
-INSTALL_ASSERT_H =
===================================================================
Index: config/mcore/t-mcore
--- config/mcore/t-mcore 2000/02/14 22:51:36 1.1
+++ config/mcore/t-mcore 2001/05/11 00:17:22
@@ -38,9 +38,6 @@ TARGET_LIBGCC2_CFLAGS=-O3 -DNO_FLOATLIB_
# We have values for float.h.
CROSS_FLOAT_H = $(srcdir)/config/mcore/gfloat.h
-# let the library provider supply an <assert.h>
-INSTALL_ASSERT_H=
-
# If support for -m4align is ever re-enabled then comment out the
# following line and uncomment the mutlilib lines below.
===================================================================
Index: config/mcore/t-mcore-pe
--- config/mcore/t-mcore-pe 2000/02/14 22:51:36 1.1
+++ config/mcore/t-mcore-pe 2001/05/11 00:17:22
@@ -29,9 +29,6 @@ TARGET_LIBGCC2_CFLAGS=-O3 -DNO_FLOATLIB_
# We have values for float.h.
CROSS_FLOAT_H = $(srcdir)/config/mcore/gfloat.h
-# let the library provider supply an <assert.h>
-INSTALL_ASSERT_H=
-
MULTILIB_OPTIONS = mbig-endian/mlittle-endian m210/m340
MULTILIB_DIRNAMES = big little m210 m340
MULTILIB_MATCHES =
===================================================================
Index: fixinc/fixinc.dgux
--- fixinc/fixinc.dgux 1999/05/28 21:33:05 1.6
+++ fixinc/fixinc.dgux 2001/05/11 00:17:22
@@ -221,12 +221,4 @@ fi
done
-if [ x${INSTALL_ASSERT_H} != x ]
-then
- cd ${ORIG_DIR}
- rm -f include/assert.h
- cp ${srcdir}/assert.h include/assert.h || exit 1
- chmod a+r include/assert.h
-fi
-
exit 0
===================================================================
Index: fixinc/fixinc.interix
--- fixinc/fixinc.interix 1999/04/11 11:35:44 1.2
+++ fixinc/fixinc.interix 2001/05/11 00:17:22
@@ -162,12 +162,4 @@ done
done # for include directory list
-if [ x${INSTALL_ASSERT_H} != x ]
-then
- cd ${ORIG_DIR}
- rm -f include/assert.h
- cp ${srcdir}/assert.h include/assert.h || exit 1
- chmod a+r include/assert.h
-fi
-
exit 0
===================================================================
Index: fixinc/fixinc.ptx
--- fixinc/fixinc.ptx 2000/02/01 21:42:05 1.6
+++ fixinc/fixinc.ptx 2001/05/11 00:17:22
@@ -263,12 +263,4 @@ fi
done
-if [ x${INSTALL_ASSERT_H} != x ]
-then
- cd ${ORIG_DIR}
- rm -f include/assert.h
- cp ${srcdir}/assert.h include/assert.h || exit 1
- chmod a+r include/assert.h
-fi
-
exit 0
===================================================================
Index: fixinc/fixinc.svr4
--- fixinc/fixinc.svr4 2000/02/17 00:32:50 1.9
+++ fixinc/fixinc.svr4 2001/05/11 00:17:23
@@ -1806,12 +1806,4 @@ chmod a+r ${LIB}/sys/byteorder.h
done
-if [ x${INSTALL_ASSERT_H} != x ]
-then
- cd ${ORIG_DIR}
- rm -f include/assert.h
- cp ${srcdir}/assert.h include/assert.h || exit 1
- chmod a+r include/assert.h
-fi
-
exit 0
===================================================================
Index: fixinc/fixinc.winnt
--- fixinc/fixinc.winnt 2000/02/01 21:42:05 1.6
+++ fixinc/fixinc.winnt 2001/05/11 00:17:23
@@ -229,12 +229,4 @@ for file in $files; do
rmdir $LIB/$file > NUL 2>&1
done
-if [ x${INSTALL_ASSERT_H} != x ]
-then
- cd ${ORIG_DIR}
- rm -f include/assert.h
- cp ${srcdir}/assert.h include/assert.h || exit 1
- chmod a+r include/assert.h
-fi
-
exit 0
===================================================================
Index: fixinc/fixinc.wrap
--- fixinc/fixinc.wrap 2000/04/02 22:50:55 1.6
+++ fixinc/fixinc.wrap 2001/05/11 00:17:23
@@ -133,12 +133,4 @@ fi
done
-if [ x${INSTALL_ASSERT_H} != x ]
-then
- cd ${ORIG_DIR}
- rm -f include/assert.h
- cp ${srcdir}/assert.h include/assert.h || exit 1
- chmod a+r include/assert.h
-fi
-
exit 0
===================================================================
Index: fixinc/fixincl.sh
--- fixinc/fixincl.sh 2000/12/27 15:46:42 1.34
+++ fixinc/fixincl.sh 2001/05/11 00:17:23
@@ -470,11 +470,3 @@ then echo fixincludes is done ; fi
done
#
# # # # # # # # # # # # # # # # # # # # #
-
-if [ x${INSTALL_ASSERT_H} != x ] && [ -f ${srcdir}/assert.h ]
-then
- cd $ORIGDIR
- rm -f include/assert.h
- cp ${srcdir}/assert.h include/assert.h || exit 1
- chmod a+r include/assert.h
-fi
===================================================================
Index: po/POTFILES.in
--- po/POTFILES.in 2000/12/17 06:30:40 1.39
+++ po/POTFILES.in 2001/05/11 00:17:23
@@ -50,7 +50,6 @@
acconfig.h
alias.c
-assert.h
basic-block.h
bb-reorder.c
bitmap.c