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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

WIN-18: remove exception.cc dependancy on libstdc++-v3 headers



Well, it turns out that out of the entire, huge mass of libjava code,
there are three lines that depend on the libstdc++-v3 headers.

Given that it's so small, I figure that removing this dependancy is a
good thing -- it means that libjava can be ported to platforms where
libstdc++-v3 doesn't work (cough, cough, mingw...)

Sound idea?

Anyways, the fix consists of two parts:

1) Use the stdlib.h abort() instead of std::abort() in exception.cc

2) Hack a std::abort() before #including unwind-pe.h, since unwind-pe
   assumes that if you're compiling with a C++ compiler, you
   automatically must have libstdc++-v3 available (faulty assumption,
   IMHO).

The fix for #2 is a bit hackish, if anybody knows of a better way to
do this, please let me know.

Ok to commit?

  - a


Index: exception.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/exception.cc,v
retrieving revision 1.18
diff -u -r1.18 exception.cc
--- exception.cc        2001/09/10 01:21:08     1.18
+++ exception.cc        2002/02/11 07:15:04
@@ -11,13 +11,20 @@
 #include <config.h>
 
 #include <stddef.h>
-#include <cstdlib>
+#include <stdlib.h>
 
 #include <java/lang/Class.h>
 #include <java/lang/NullPointerException.h>
 #include <gcj/cni.h>
 #include <jvm.h>
 
+namespace std {
+  void
+  abort()
+  {
+    ::abort();
+  }
+}
 #include "unwind.h"
 
 
@@ -97,7 +104,7 @@
      recover.  As is the way of such things, almost certainly we will have
      crashed before now, rather than actually being able to diagnose the
      problem.  */
-  std::abort ();
+  abort();
 }
 
 
@@ -344,7 +351,7 @@
              // ??? Perhaps better to make them an index into a table
              // of null-terminated strings instead of playing games
              // with Utf8Const+1 as above.
-             std::abort ();
+             abort ();
            }
 
          if (ar_disp == 0)


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