This patch:
2008-07-25 Jan Hubicka <[email protected]>
* typeck.c (inline_conversion): Remove.
(cp_build_function_call): Do not use inline_conversion.
* decl.c (duplicate_decls): Do not insist on inline being declared
early.
(start_cleanup_fn): Do not assume that INLINE flags prevent function
from being output. We now remove static functions always.
(finish_function): Do return warning on all static functions.
* call.c (build_over_call): Do not use inline_conversion.
* cp-tree.h (possibly_inlined_p): Declare.
(inline_conversion): Remove.
* pt.c (instantiate_decl): Use possibly_inlined_p predicate.
* decl2.c (cp_write_global_declarations): Likewise.
(mark_used): Likewise.
(possibly_inlined_p): New functions.
breaks all combinations of C++ and Java using CNI, resulting in
/usr/lib/gcc/x86_64-redhat-linux/4.4.0/../../../../include/c++/4.4.0/bits/ostream_insert.h:107:
error: mixing C++ and Java catches in a single translation unit
This happens because we now instantiate template functions based on
possibly_inlined_p() rather than DECL_INLINE. In turn this causes us
to generate catch blocks for C++ exceptions, and these can't be mixed
in the same translation unit as Java exceptions.
Here's a test case. I have a patch for this that I'll send in a subsequent
mail.
Andrew.
javac TryCNI.java
gcj -c TryCNI.class
g++ -c natTryCNI.cc -O2
gcj -o TryCNI --main=TryCNI TryCNI.o natTryCNI.o -o TryCNI -lstdc++
#include "TryCNI.h"
#include <gcj/cni.h>
#include <iostream>
void
TryCNI::plonk()
{
jstring s = barf();
int len = JvGetStringUTFLength (s);
char buf[len+1];
JvGetStringUTFRegion (s, 0, len, buf);
buf[len] = 0;
std::cout << buf << "\n";
}
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
#ifndef __TryCNI__
#define __TryCNI__
#pragma interface
#include <java/lang/Object.h>
#include <gcj/array.h>
extern "Java"
{
class TryCNI;
}
class TryCNI : public ::java::lang::Object
{
public:
TryCNI();
public: // actually package-private
static ::java::lang::String * barf();
static void plonk();
public:
static void main(JArray< ::java::lang::String * > *);
static ::java::lang::Class class$;
};
#endif // __TryCNI__
public class TryCNI
{
static String barf()
{
return "barf!";
}
static native void plonk();
public static void main(String[] argv)
{
plonk();
}
}