mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-18 15:39:53 +08:00
d17811fd1a
* fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * cp-tree.def (NON_DEPENDENT_EXPR): New node. * cp-tree.h (build_call_from_tree): Remove. (build_member_call): Likewise. (dependent_template_arg_p): Remove. (any_dependent_template_arguments_p): New function. (dependent_template_id_p): Likewise. (any_type_dependent_arguments_p): Likewise. (build_non_dependent_expr): Likewise. (build_non_dependent_args): Likewise. (build_x_compound_expr): Adjust prototype. * call.c (build_new_method_call): Handle non-dependent expressions correctly. * decl2.c (grok_array_decl): Likewise. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Remove. * error.c (dump_decl): Handle NON_DEPENDENT_EXPR. (dump_expr): Likewise. * init.c (build_member_call): Remove. * mangle.c (write_expression): Update handling for template-ids. * parser.c (cp_parser_primary_expression): Use any_dependent_template_arguments_p. Update constant-expression handling. (cp_parser_postfix_expression): Use any_type_dependent_arguments_p. Simplify call processing. (cp_parser_unary_expression): Simplify. (cp_parser_expression): Adjust for changes to build_x_compound_expr. (cp_parser_template_argument): Implement standard-conforming parsing of non-type template arguments. (cp_parser_direct_declarator): Use cp_parser_fold_non_dependent_expr. (cp_parser_fold_non_dependent_expr): New function. (cp_parser_next_token_ends_template_argument_p): Likewise. * pt.c (convert_template_argument): Do not call maybe_fold_nontype_arg. (tsubst_baselink): Likewise. (tsubst_copy_and_build): Share common code. Make sizeof/alignof processing work correctly for non-dependent expressions. Adjust handling of COMPOUND_EXPR. Simplify call processing. (value_dependent_expression_p): Deal with functional casts and sizeof/alignof correctly. (type_dependent_expression_p): Handle overloaded functions. (any_type_dependent_arguments_p): New function. (any_dependent_template_arguments_p): Likewise. (dependent_template_p): Treat SCOPE_REFs as dependent. (dependent_template_id_p): Simplify. (build_non_dependent_expr): New function. (build_non_dependent_args): Likewise. * semantics.c (finish_stmt_expr): Don't make dependent statement-expresions have void type. (finish_call_expr): Handle non-dependent expressions correctly. * tree.c (lvalue_p_1): Treat NON_DEPENDENT_EXPRs as lvalues. * typeck.c (cxx_sizeof_or_alignof_type): Give the expression type size_t, even in templates. (expr_sizeof): Likewise. (finish_class_member_access_expr): Handle non-dependent expressions correctly. (build_x_indirect_ref): Likewise. (build_x_binary_op): Likewise. (build_x_unary_op): Likewise. (build_x_conditional_expr): Likewise. (build_x_compound_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * g++.dg/abi/mangle17.C: Make sure template expressions are dependent. * g++.dg/abi/mangle4.C: Mark erroneous casts. * g++.dg/debug/debug7.C: Mark erronous new-declarator. * g++.dg/opt/stack1.C: Remove erroneous code. * g++.dg/parse/template7.C: New test. * g++.dg/template/dependent-expr1.C: Mark erroneous code. * g++.old-deja/g++.pt/crash4.C: Likewise. 2003-07-09 Mark Mitchell <mark@codesourcery.com> * gcj/array.h (JvPrimClass): Don't parenthesize the output. From-SVN: r69130
141 lines
3.5 KiB
C++
141 lines
3.5 KiB
C++
// array.h - Header file for CNI arrays. -*- c++ -*-
|
|
|
|
/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
|
|
|
|
This file is part of libgcj.
|
|
|
|
This software is copyrighted work licensed under the terms of the
|
|
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
|
details. */
|
|
|
|
#ifndef __GCJ_ARRAY_H__
|
|
#define __GCJ_ARRAY_H__
|
|
|
|
#include <java/lang/Object.h>
|
|
|
|
extern "Java" {
|
|
|
|
class __JArray : public java::lang::Object
|
|
{
|
|
protected:
|
|
// 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*);
|
|
};
|
|
|
|
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
|
|
{
|
|
T data[0];
|
|
public:
|
|
friend T* elements<>(JArray<T>& x);
|
|
friend T* elements<>(JArray<T>* x);
|
|
// T* getData() { return data; }
|
|
// T& operator[](jint i) { return data[i]; }
|
|
};
|
|
|
|
template<class T>
|
|
inline T* elements(JArray<T>& x) { return x.data; }
|
|
template<class T>
|
|
inline T* elements(JArray<T>* x) { return x->data; }
|
|
|
|
} // end extern "Java"
|
|
|
|
/* These typesdefs match those in JNI. */
|
|
typedef __JArray *jarray;
|
|
typedef JArray<jobject> *jobjectArray;
|
|
typedef JArray<jboolean> *jbooleanArray;
|
|
typedef JArray<jbyte> *jbyteArray;
|
|
typedef JArray<jchar> *jcharArray;
|
|
typedef JArray<jshort> *jshortArray;
|
|
typedef JArray<jint> *jintArray;
|
|
typedef JArray<jlong> *jlongArray;
|
|
typedef JArray<jfloat> *jfloatArray;
|
|
typedef JArray<jdouble> *jdoubleArray;
|
|
typedef JArray<jstring> *jstringArray;
|
|
|
|
extern java::lang::Class _Jv_byteClass, _Jv_shortClass, _Jv_intClass,
|
|
_Jv_longClass, _Jv_booleanClass, _Jv_charClass, _Jv_floatClass,
|
|
_Jv_doubleClass, _Jv_voidClass;
|
|
/* 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);
|
|
|
|
extern inline jobjectArray
|
|
JvNewObjectArray (jsize length, jclass cls, jobject init)
|
|
{
|
|
return _Jv_NewObjectArray (length, cls, init);
|
|
}
|
|
|
|
extern inline jcharArray
|
|
JvNewCharArray (jint length)
|
|
{
|
|
return (jcharArray) _Jv_NewPrimArray (JvPrimClass (char), length);
|
|
}
|
|
|
|
extern inline jbooleanArray
|
|
JvNewBooleanArray (jint length)
|
|
{
|
|
return (jbooleanArray) _Jv_NewPrimArray (JvPrimClass (boolean), length);
|
|
}
|
|
|
|
extern inline jbyteArray
|
|
JvNewByteArray (jint length)
|
|
{
|
|
return (jbyteArray) _Jv_NewPrimArray (JvPrimClass (byte), length);
|
|
}
|
|
|
|
extern inline jshortArray
|
|
JvNewShortArray (jint length)
|
|
{
|
|
return (jshortArray) _Jv_NewPrimArray (JvPrimClass (short), length);
|
|
}
|
|
|
|
extern inline jintArray
|
|
JvNewIntArray (jint length)
|
|
{
|
|
return (jintArray) _Jv_NewPrimArray (JvPrimClass (int), length);
|
|
}
|
|
|
|
extern inline jlongArray
|
|
JvNewLongArray (jint length)
|
|
{
|
|
return (jlongArray) _Jv_NewPrimArray (JvPrimClass (long), length);
|
|
}
|
|
|
|
extern inline jfloatArray
|
|
JvNewFloatArray (jint length)
|
|
{
|
|
return (jfloatArray) _Jv_NewPrimArray (JvPrimClass (float), length);
|
|
}
|
|
|
|
extern inline jdoubleArray
|
|
JvNewDoubleArray (jint length)
|
|
{
|
|
return (jdoubleArray) _Jv_NewPrimArray (JvPrimClass (double), length);
|
|
}
|
|
|
|
|
|
extern "C" jstringArray JvConvertArgv(int argc, const char **argv);
|
|
|
|
inline jsize JvGetArrayLength (jarray array) { return array->length; }
|
|
|
|
#endif /* __GCJ_ARRAY_H__ */
|