ia64-frame.h: Removed.
[gcc.git] / libjava / gcj / array.h
index 7c6592416812dbc2438a28ad7f491c8a96adf22a..4f134f33c5ccb49f1646e36fa0dd90eca0298efd 100644 (file)
@@ -1,6 +1,6 @@
 // array.h - Header file for CNI arrays.  -*- c++ -*-
 
-/* Copyright (C) 1998, 1999, 2000  Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -18,22 +18,25 @@ extern "Java" {
 class __JArray : public java::lang::Object
 {
 protected:
-  // FIXME: this is a hack to work around a bug in the g++ Java
-  // support.  If we add a constructor with a jsize argument to
-  // JArray<T>, then g++ complains.
+  // This is just a hack to work around a warning emitted by the C++
+  // compiler.  We initialize `length' evilly, but it doesn't know
+  // that.
   __JArray () : length (0)
   {
   }
 public:
   const jsize length;
   friend jsize JvGetArrayLength (__JArray*);
-
-  // This probably shouldn't be public.
-  __JArray (jsize l) : length (l)
-  {
-  }
 };
 
+template<class T>
+class JArray;
+
+template<class T>
+inline T* elements(JArray<T>& x);
+template<class T>
+inline T* elements(JArray<T>* x);
+
 template<class T>
 class JArray : public __JArray
 {
@@ -50,7 +53,7 @@ inline T* elements(JArray<T>& x) { return x.data; }
 template<class T>
 inline T* elements(JArray<T>* x) { return x->data; }
 
-}; // end extern "Java"
+} // end extern "Java"
 
 /* These typesdefs match those in JNI. */
 typedef __JArray *jarray;
@@ -65,10 +68,12 @@ typedef JArray<jfloat> *jfloatArray;
 typedef JArray<jdouble> *jdoubleArray;
 typedef JArray<jstring> *jstringArray;
 
-extern class _Jv_PrimClass _Jv_byteClass, _Jv_shortClass, _Jv_intClass,
+extern java::lang::Class _Jv_byteClass, _Jv_shortClass, _Jv_intClass,
   _Jv_longClass, _Jv_booleanClass, _Jv_charClass, _Jv_floatClass,
   _Jv_doubleClass, _Jv_voidClass;
-#define JvPrimClass(TYPE) ((jclass) & _Jv_##TYPE##Class)
+/* The definition of this macro cannot be enclosed in parentheses
+   because "JvPrimClass(x)" is used as a template argument.  */
+#define JvPrimClass(TYPE) & _Jv_##TYPE##Class
 
 extern "C" jobjectArray _Jv_NewObjectArray(jsize length, jclass, jobject init);
 extern "C" jobject _Jv_NewPrimArray (jclass eltype, jint count);