public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix assert.h on darwin (before 8.0)
@ 2004-11-07  0:34 Andrew Pinski
  2004-11-07  0:35 ` Joseph S. Myers
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Pinski @ 2004-11-07  0:34 UTC (permalink / raw)
  To: gcc-patches@gcc.gnu.org Patches

[-- Attachment #1: Type: text/plain, Size: 502 bytes --]

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.



[-- Attachment #2: fixDarwin-Assert.diff.txt --]
[-- Type: text/plain, Size: 1887 bytes --]

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 <stdlib.h>
+#include <stdio.h>
+
+/* 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-11-08 21:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-07  0:34 Fix assert.h on darwin (before 8.0) Andrew Pinski
2004-11-07  0:35 ` Joseph S. Myers
2004-11-08 21:43   ` Andrew Pinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).