From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16043 invoked by alias); 6 Nov 2004 23:36:47 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 16026 invoked from network); 6 Nov 2004 23:36:46 -0000 Received: from unknown (HELO smtp3.fuse.net) (216.68.8.176) by sourceware.org with SMTP; 6 Nov 2004 23:36:46 -0000 Received: from gx5.fuse.net ([66.42.245.166]) by smtp3.fuse.net (InterMail vM.6.01.03.04 201-2131-111-106-20040729) with ESMTP id <20041106233613.WLCQ5247.smtp3.fuse.net@gx5.fuse.net> for ; Sat, 6 Nov 2004 18:36:13 -0500 Received: from dellpi.pinski.fam ([66.42.245.166]) by gx5.fuse.net (InterMail vG.1.00.00.00 201-2136-104-20040331) with ESMTP id <20041106233559.UHXG8092.gx5.fuse.net@dellpi.pinski.fam> for ; Sat, 6 Nov 2004 18:35:59 -0500 Received: from [10.0.0.80] (zhivago.i.pinski.fam [10.0.0.80]) by dellpi.pinski.fam (8.12.2/8.12.1) with ESMTP id iA6NagVT007105 for ; Sat, 6 Nov 2004 18:36:42 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v619) To: "gcc-patches@gcc.gnu.org Patches" Message-Id: Content-Type: multipart/mixed; boundary=Apple-Mail-8--929565693 From: Andrew Pinski Subject: Fix assert.h on darwin (before 8.0) Date: Sun, 07 Nov 2004 00:34:00 -0000 X-SW-Source: 2004-11/txt/msg00517.txt.bz2 --Apple-Mail-8--929565693 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Content-length: 502 Darwin (before 8) has a very messed up assert.h and uses __eprintf which is very wrong. This patch fixes that by adding an assert.h which does not use __eprintf at all. OK? Bootstrapped and tested on powerpc-darwin7.6.0 and fixes the last two libjava failures. Thanks, Andrew Pinski ChangeLog: * config.gcc (*-*-darwin*): Add t-darwin-pre8 for pre darwin 8 targets. * config/t-darwin-pre8: New file. Add assert.h to the EXTRA_HEADERS. * config/darwin-assert.h: New file. Assert.h for darwin. --Apple-Mail-8--929565693 Content-Transfer-Encoding: 7bit Content-Type: text/plain; x-unix-mode=0644; name="fixDarwin-Assert.diff.txt" Content-Disposition: attachment; filename=fixDarwin-Assert.diff.txt Content-length: 1887 Index: config.gcc =================================================================== RCS file: /cvs/gcc/gcc/gcc/config.gcc,v retrieving revision 1.495 diff -u -p -r1.495 config.gcc --- config.gcc 21 Oct 2004 22:28:22 -0000 1.495 +++ config.gcc 6 Nov 2004 20:02:50 -0000 @@ -338,6 +338,10 @@ case ${target} in tm_file="${tm_file} darwin.h" tm_p_file="${tm_p_file} darwin-protos.h" tmake_file="t-darwin t-slibgcc-darwin" + case ${target} in + *-darwin[0-7]*) tmake_file="${tmake_file} t-darwin-pre8";; + *) ;; + esac target_gtfiles="\$(srcdir)/config/darwin.c" c_target_objs="darwin-c.o" cxx_target_objs="darwin-c.o" Index: config/t-darwin-pre8 =================================================================== RCS file: config/t-darwin-pre8 diff -N config/t-darwin-pre8 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ config/t-darwin-pre8 6 Nov 2004 20:03:25 -0000 @@ -0,0 +1,5 @@ +EXTRA_HEADERS += $(objdir)/darwininclude/assert.h +$(objdir)/darwininclude/assert.h: $(srcdir)/config/darwin-assert.h + mkdir -p $(objdir)/darwininclude + cp $(srcdir)/config/darwin-assert.h $(objdir)/darwininclude/assert.h + Index: config/darwin-assert.h =================================================================== RCS file: config/darwin-assert.h diff -N config/darwin-assert.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ config/darwin-assert.h 6 Nov 2004 20:03:25 -0000 @@ -0,0 +1,20 @@ +#include +#include + +/* 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 + +#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) + +#endif --Apple-Mail-8--929565693--