diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-13 01:28:18 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-13 01:28:18 +0000 |
commit | 6df8a9dd552113f43274ba4bf09830d2525ff4e9 (patch) | |
tree | 49246e78a7ee8c4a59b8982faf4c2837e13775cb /libjava | |
parent | 73eaf1ba572d0f5c415459c0b5290104e8a953a8 (diff) | |
download | gcc-6df8a9dd552113f43274ba4bf09830d2525ff4e9.tar.gz |
gcc/cp:
* except.c (choose_personality_routine): Export. Add
explanatory comment. Take an enum languages, not a boolean.
(initialize_handler_parm): Adjust to match.
* cp-tree.h: Prototype choose_personality_routine.
* lex.c (handle_pragma_java_exceptions): New function.
(init_cp_pragma): Register #pragma GCC java_exceptions.
gcc:
* extend.texi: Document #pragma GCC java_exceptions.
libjava:
* Makefile.am (libgcj_la_OBJECTS): Remove libsupc++convenience.la.
* Makefile.in: Regenerate (by hand).
* include/jvm.h: Add #pragma GCC java_exceptions at top of file.
* doc/cni.sgml: Document #pragma GCC java_exceptions.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42027 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 7 | ||||
-rw-r--r-- | libjava/Makefile.am | 1 | ||||
-rw-r--r-- | libjava/Makefile.in | 1 | ||||
-rw-r--r-- | libjava/doc/cni.sgml | 25 | ||||
-rw-r--r-- | libjava/include/jvm.h | 3 |
5 files changed, 35 insertions, 2 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 379a43bfa58..56784e0dbe3 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,10 @@ +2001-05-12 Zack Weinberg <zackw@stanford.edu> + + * Makefile.am (libgcj_la_OBJECTS): Remove libsupc++convenience.la. + * Makefile.in: Regenerate (by hand). + * include/jvm.h: Add #pragma GCC java_exceptions at top of file. + * doc/cni.sgml: Document #pragma GCC java_exceptions. + 2001-05-11 Richard Henderson <rth@redhat.com> * configure.in (ia64-*): Don't set SYSDEP_SOURCES. diff --git a/libjava/Makefile.am b/libjava/Makefile.am index d5644a1590d..3760b32c102 100644 --- a/libjava/Makefile.am +++ b/libjava/Makefile.am @@ -260,7 +260,6 @@ libgcj.la: $(libgcj_la_OBJECTS) $(libgcj_la_DEPENDENCIES) @echo $(libgcj_la_OBJECTS) > libgcj.objectlist; @echo $(libgcj_la_LIBADD) >> libgcj.objectlist; $(libgcj_la_LINK) -objectlist libgcj.objectlist \ - ../libstdc++-v3/libsupc++/libsupc++convenience.la \ ../libffi/libfficonvenience.la \ -rpath $(toolexeclibdir) $(libgcj_la_LDFLAGS) $(LIBS) diff --git a/libjava/Makefile.in b/libjava/Makefile.in index d4435b6d8d3..2002567e72f 100644 --- a/libjava/Makefile.in +++ b/libjava/Makefile.in @@ -2466,7 +2466,6 @@ libgcj.la: $(libgcj_la_OBJECTS) $(libgcj_la_DEPENDENCIES) @echo $(libgcj_la_OBJECTS) > libgcj.objectlist; @echo $(libgcj_la_LIBADD) >> libgcj.objectlist; $(libgcj_la_LINK) -objectlist libgcj.objectlist \ - ../libstdc++-v3/libsupc++/libsupc++convenience.la \ ../libffi/libfficonvenience.la \ -rpath $(toolexeclibdir) $(libgcj_la_LDFLAGS) $(LIBS) diff --git a/libjava/doc/cni.sgml b/libjava/doc/cni.sgml index 0c82ca67ddd..495e3e9c5a5 100644 --- a/libjava/doc/cni.sgml +++ b/libjava/doc/cni.sgml @@ -779,6 +779,31 @@ if (i >= count) throw new java::lang::IndexOutOfBoundsException(); </programlisting> </para> +<para> +Normally, GNU C++ will automatically detect when you are writing C++ +code that uses Java exceptions, and handle them appropriately. +However, if C++ code only needs to execute destructors when Java +exceptions are thrown through it, GCC will guess incorrectly. Sample +problematic code: +<programlisting> + struct S { ~S(); }; + extern void bar(); // is implemented in Java and may throw exceptions + void foo() + { + S s; + bar(); + } +</programlisting> +The usual effect of an incorrect guess is a link failure, complaining of +a missing routine called <literal>__gxx_personality_v0</literal>. +</para> +<para> +You can inform the compiler that Java exceptions are to be used in a +translation unit, irrespective of what it might think, by writing +<literal>#pragma GCC java_exceptions</literal> at the head of the +file. This <literal>#pragma</literal> must appear before any +functions that throw or catch exceptions, or run destructors when +exceptions are thrown through them.</para> </sect1> <sect1><title>Synchronization</title> diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h index 50af7569fb2..1e80fbc3218 100644 --- a/libjava/include/jvm.h +++ b/libjava/include/jvm.h @@ -11,6 +11,9 @@ details. */ #ifndef __JAVA_JVM_H__ #define __JAVA_JVM_H__ +// Force C++ compiler to use Java-style exceptions. +#pragma GCC java_exceptions + #include <gcj/javaprims.h> #include <java-assert.h> |