diff options
author | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-08 20:38:13 +0000 |
---|---|---|
committer | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-08 20:38:13 +0000 |
commit | de83d4725adf72fb9808b30a01a5c4ec05ae8a51 (patch) | |
tree | cf833007c737395cb44ea9f031474173d9ab680a | |
parent | 862ad8b433732c1533f670040617716f641d3a55 (diff) | |
download | gcc-de83d4725adf72fb9808b30a01a5c4ec05ae8a51.tar.gz |
2006-02-08 Bryce McKinlay <mckinlay@redhat.com>
* link.cc (_Jv_Linker::print_class_loaded): Declare string constants
as "const char *".
* verify.cc (verify_fail): Likewise.
* gnu/classpath/natSystemProperties.cc (file_encoding): Likewise.
* interpret.cc (throw_internal_error, throw_class_format_error):
Likewise.
* gcj/javaprims.h (_Jv_hashUtf8String, _Jv_Utf8Const::space_needed,
_Jv_Utf8Const::init, _Jv_makeUtf8Const): Likewise.
* java/lang/Class.h (_Jv_InitPrimClass): Likewise.
* include/jvm.h (_Jv_strLengthUtf8, _Jv_makeUtf8Const): Likewise.
* defineclass.cc (throw_internal_error, throw_no_class_def_found_error,
is_attribute_name): Likewise.
* prims.cc (_Jv_strLengthUtf8, _Jv_hashUtf8String, _Jv_Utf8Const::init,
_Jv_makeUtf8Const, _Jv_InitPrimClass): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110767 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libjava/ChangeLog | 17 | ||||
-rw-r--r-- | libjava/defineclass.cc | 16 | ||||
-rw-r--r-- | libjava/gcj/javaprims.h | 8 | ||||
-rw-r--r-- | libjava/gnu/classpath/natSystemProperties.cc | 6 | ||||
-rw-r--r-- | libjava/include/jvm.h | 4 | ||||
-rw-r--r-- | libjava/interpret.cc | 8 | ||||
-rw-r--r-- | libjava/java/lang/Class.h | 4 | ||||
-rw-r--r-- | libjava/link.cc | 4 | ||||
-rw-r--r-- | libjava/prims.cc | 10 | ||||
-rw-r--r-- | libjava/verify.cc | 2 |
10 files changed, 48 insertions, 31 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index c04f560913b..91b7019bb62 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,20 @@ +2006-02-08 Bryce McKinlay <mckinlay@redhat.com> + + * link.cc (_Jv_Linker::print_class_loaded): Declare string constants + as "const char *". + * verify.cc (verify_fail): Likewise. + * gnu/classpath/natSystemProperties.cc (file_encoding): Likewise. + * interpret.cc (throw_internal_error, throw_class_format_error): + Likewise. + * gcj/javaprims.h (_Jv_hashUtf8String, _Jv_Utf8Const::space_needed, + _Jv_Utf8Const::init, _Jv_makeUtf8Const): Likewise. + * java/lang/Class.h (_Jv_InitPrimClass): Likewise. + * include/jvm.h (_Jv_strLengthUtf8, _Jv_makeUtf8Const): Likewise. + * defineclass.cc (throw_internal_error, throw_no_class_def_found_error, + is_attribute_name): Likewise. + * prims.cc (_Jv_strLengthUtf8, _Jv_hashUtf8String, _Jv_Utf8Const::init, + _Jv_makeUtf8Const, _Jv_InitPrimClass): Likewise. + 2006-02-08 Tom Tromey <tromey@redhat.com> PR libgcj/26063, PR libgcj/17978, PR libgcj/10598: diff --git a/libjava/defineclass.cc b/libjava/defineclass.cc index c15cc2265d6..03d73a2c266 100644 --- a/libjava/defineclass.cc +++ b/libjava/defineclass.cc @@ -47,11 +47,11 @@ using namespace gcj; // these go in some separate functions, to avoid having _Jv_InitClass // inserted all over the place. -static void throw_internal_error (char *msg) +static void throw_internal_error (const char *msg) __attribute__ ((__noreturn__)); static void throw_no_class_def_found_error (jstring msg) __attribute__ ((__noreturn__)); -static void throw_no_class_def_found_error (char *msg) +static void throw_no_class_def_found_error (const char *msg) __attribute__ ((__noreturn__)); static void throw_class_format_error (jstring msg) __attribute__ ((__noreturn__)); @@ -258,10 +258,10 @@ struct _Jv_ClassReader void read_one_method_attribute (int method); void read_one_code_attribute (int method); void read_one_field_attribute (int field); - void throw_class_format_error (char *msg); + void throw_class_format_error (const char *msg); /** check an utf8 entry, without creating a Utf8Const object */ - bool is_attribute_name (int index, char *name); + bool is_attribute_name (int index, const char *name); /** here goes the class-loader members defined out-of-line */ void handleConstantPool (); @@ -469,7 +469,7 @@ void _Jv_ClassReader::read_fields () } bool -_Jv_ClassReader::is_attribute_name (int index, char *name) +_Jv_ClassReader::is_attribute_name (int index, const char *name) { check_tag (index, JV_CONSTANT_Utf8); int len = get2u (bytes+offsets[index]); @@ -1418,7 +1418,7 @@ void _Jv_ClassReader::handleMethodsEnd () } } -void _Jv_ClassReader::throw_class_format_error (char *msg) +void _Jv_ClassReader::throw_class_format_error (const char *msg) { jstring str; if (def->name != NULL) @@ -1460,7 +1460,7 @@ throw_no_class_def_found_error (jstring msg) } static void -throw_no_class_def_found_error (char *msg) +throw_no_class_def_found_error (const char *msg) { throw_no_class_def_found_error (JvNewStringLatin1 (msg)); } @@ -1474,7 +1474,7 @@ throw_class_format_error (jstring msg) } static void -throw_internal_error (char *msg) +throw_internal_error (const char *msg) { throw new java::lang::InternalError (JvNewStringLatin1 (msg)); } diff --git a/libjava/gcj/javaprims.h b/libjava/gcj/javaprims.h index f8c2ed680c7..a9dd8459d02 100644 --- a/libjava/gcj/javaprims.h +++ b/libjava/gcj/javaprims.h @@ -489,7 +489,7 @@ extern "C" jstring _Jv_NewStringLatin1(const char*, jsize) __attribute__((__malloc__)); extern "C" jsize _Jv_GetStringUTFLength (jstring); extern "C" jsize _Jv_GetStringUTFRegion (jstring, jsize, jsize, char *); -extern "C" jint _Jv_hashUtf8String (char*, int); +extern "C" jint _Jv_hashUtf8String (const char*, int); struct _Jv_VMOption { @@ -561,17 +561,17 @@ class _Jv_Utf8Const jstring toString() { return _Jv_NewStringUTF(data); } /** Given an UTF8 string, how many bytes needed for a UTF8Const, including struct header, and final NUL. I.e. what to pas to malloc. */ - static int space_needed (char *, int len) + static int space_needed (const char *, int len) { return sizeof (_Jv_Utf8Const) + len + 1; } /** Given an allocated _Jv_Utf8Const, copy / fill it in. */ - void init (char *s, int len); + void init (const char *s, int len); friend jboolean _Jv_equalUtf8Consts (const _Jv_Utf8Const*, const _Jv_Utf8Const *); friend jboolean _Jv_equal (_Jv_Utf8Const*, jstring, jint); friend jboolean _Jv_equaln (_Jv_Utf8Const*, jstring, jint); friend jboolean _Jv_equalUtf8Classnames (const _Jv_Utf8Const*, const _Jv_Utf8Const*); friend jboolean _Jv_isPrimitiveOrDerived (const _Jv_Utf8Const*); - friend _Jv_Utf8Const *_Jv_makeUtf8Const (char*, int); + friend _Jv_Utf8Const *_Jv_makeUtf8Const (const char*, int); friend _Jv_Utf8Const *_Jv_makeUtf8Const (jstring); friend jstring _Jv_NewStringUtf8Const (_Jv_Utf8Const*); }; diff --git a/libjava/gnu/classpath/natSystemProperties.cc b/libjava/gnu/classpath/natSystemProperties.cc index 5d230254d9b..f21220f1f6d 100644 --- a/libjava/gnu/classpath/natSystemProperties.cc +++ b/libjava/gnu/classpath/natSystemProperties.cc @@ -62,11 +62,11 @@ _Jv_SetDLLSearchPath (const char *) #if ! defined (DEFAULT_FILE_ENCODING) && defined (HAVE_ICONV) \ && defined (HAVE_NL_LANGINFO) -static char * +static const char * file_encoding () { setlocale (LC_CTYPE, ""); - char *e = nl_langinfo (CODESET); + const char *e = nl_langinfo (CODESET); if (e == NULL || *e == '\0') e = "8859_1"; return e; @@ -80,7 +80,7 @@ file_encoding () #define DEFAULT_FILE_ENCODING "8859_1" #endif -static char *default_file_encoding = DEFAULT_FILE_ENCODING; +static const char *default_file_encoding = DEFAULT_FILE_ENCODING; #if HAVE_GETPWUID_R /* Use overload resolution to find out the signature of getpwuid_r. */ diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h index e5187f4d3f0..28942246585 100644 --- a/libjava/include/jvm.h +++ b/libjava/include/jvm.h @@ -132,10 +132,10 @@ union _Jv_value ? (((PTR)[-3]&0x0F) << 12) + (((PTR)[-2]&0x3F) << 6) + ((PTR)[-1]&0x3F) \ : ((PTR)++, -1)) -extern int _Jv_strLengthUtf8(char* str, int len); +extern int _Jv_strLengthUtf8(const char* str, int len); typedef struct _Jv_Utf8Const Utf8Const; -_Jv_Utf8Const *_Jv_makeUtf8Const (char *s, int len); +_Jv_Utf8Const *_Jv_makeUtf8Const (const char *s, int len); _Jv_Utf8Const *_Jv_makeUtf8Const (jstring string); extern jboolean _Jv_equalUtf8Consts (const _Jv_Utf8Const *, const _Jv_Utf8Const *); extern jboolean _Jv_equal (_Jv_Utf8Const *, jstring, jint); diff --git a/libjava/interpret.cc b/libjava/interpret.cc index f95671d267b..4e5e5df7028 100644 --- a/libjava/interpret.cc +++ b/libjava/interpret.cc @@ -47,7 +47,7 @@ _Jv_InterpreterEngine _Jv_soleInterpreterEngine; using namespace gcj; -static void throw_internal_error (char *msg) +static void throw_internal_error (const char *msg) __attribute__ ((__noreturn__)); static void throw_incompatible_class_change_error (jstring msg) __attribute__ ((__noreturn__)); @@ -58,7 +58,7 @@ static void throw_null_pointer_exception () static void throw_class_format_error (jstring msg) __attribute__ ((__noreturn__)); -static void throw_class_format_error (char *msg) +static void throw_class_format_error (const char *msg) __attribute__ ((__noreturn__)); #ifdef DIRECT_THREADED @@ -3294,7 +3294,7 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args, _Jv_InterpMethod *meth) } static void -throw_internal_error (char *msg) +throw_internal_error (const char *msg) { throw new java::lang::InternalError (JvNewStringLatin1 (msg)); } @@ -3817,7 +3817,7 @@ throw_class_format_error (jstring msg) } static void -throw_class_format_error (char *msg) +throw_class_format_error (const char *msg) { throw_class_format_error (JvNewStringLatin1 (msg)); } diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h index 2ddc8e16752..c94b6d39217 100644 --- a/libjava/java/lang/Class.h +++ b/libjava/java/lang/Class.h @@ -261,7 +261,7 @@ jclass _Jv_NewClass (_Jv_Utf8Const *name, jclass superclass, void _Jv_InitNewClassFields (jclass klass); // Friend functions and classes in prims.cc -void _Jv_InitPrimClass (jclass, char *, char, int); +void _Jv_InitPrimClass (jclass, const char *, char, int); jstring _Jv_GetMethodString (jclass, _Jv_Method *, jclass = NULL); jboolean _Jv_CheckAccess (jclass self_klass, jclass other_klass, @@ -494,7 +494,7 @@ private: friend void ::_Jv_InitNewClassFields (jclass klass); // in prims.cc - friend void ::_Jv_InitPrimClass (jclass, char *, char, int); + friend void ::_Jv_InitPrimClass (jclass, const char *, char, int); friend jstring (::_Jv_GetMethodString) (jclass, _Jv_Method *, jclass); diff --git a/libjava/link.cc b/libjava/link.cc index 26bf8984e24..395b2c731b6 100644 --- a/libjava/link.cc +++ b/libjava/link.cc @@ -1848,9 +1848,9 @@ _Jv_Linker::print_class_loaded (jclass klass) } } if (codesource == NULL) - codesource = "<no code source>"; + codesource = (char *) "<no code source>"; - char *abi; + const char *abi; if (_Jv_IsInterpretedClass (klass)) abi = "bytecode"; else if (_Jv_IsBinaryCompatibilityABI (klass)) diff --git a/libjava/prims.cc b/libjava/prims.cc index 0352669315d..1ef56742398 100644 --- a/libjava/prims.cc +++ b/libjava/prims.cc @@ -353,7 +353,7 @@ _Jv_equalUtf8Classnames (const Utf8Const *a, const Utf8Const *b) /* Count the number of Unicode chars encoded in a given Ut8 string. */ int -_Jv_strLengthUtf8(char* str, int len) +_Jv_strLengthUtf8(const char* str, int len) { unsigned char* ptr; unsigned char* limit; @@ -374,7 +374,7 @@ _Jv_strLengthUtf8(char* str, int len) * This returns the same hash value as specified or java.lang.String.hashCode. */ jint -_Jv_hashUtf8String (char* str, int len) +_Jv_hashUtf8String (const char* str, int len) { unsigned char* ptr = (unsigned char*) str; unsigned char* limit = ptr + len; @@ -391,7 +391,7 @@ _Jv_hashUtf8String (char* str, int len) } void -_Jv_Utf8Const::init(char *s, int len) +_Jv_Utf8Const::init(const char *s, int len) { ::memcpy (data, s, len); data[len] = 0; @@ -400,7 +400,7 @@ _Jv_Utf8Const::init(char *s, int len) } _Jv_Utf8Const * -_Jv_makeUtf8Const (char* s, int len) +_Jv_makeUtf8Const (const char* s, int len) { if (len < 0) len = strlen (s); @@ -794,7 +794,7 @@ DECLARE_PRIM_TYPE(double) DECLARE_PRIM_TYPE(void) void -_Jv_InitPrimClass (jclass cl, char *cname, char sig, int len) +_Jv_InitPrimClass (jclass cl, const char *cname, char sig, int len) { using namespace java::lang::reflect; diff --git a/libjava/verify.cc b/libjava/verify.cc index 4df6ead95c5..90890a6257a 100644 --- a/libjava/verify.cc +++ b/libjava/verify.cc @@ -206,7 +206,7 @@ private: return r; } - __attribute__ ((__noreturn__)) void verify_fail (char *s, jint pc = -1) + __attribute__ ((__noreturn__)) void verify_fail (const char *s, jint pc = -1) { using namespace java::lang; StringBuffer *buf = new StringBuffer (); |