gjavah.c (print_name, [...]): Add static prototype.

* gjavah.c (print_name, print_base_classname, utf8_cmp,
	cxx_keyword_subst, generate_access, name_is_method_p,
	get_field_name, print_field_name, super_class_name, print_include,
	decode_signature_piece, print_class_decls, usage, help,
	java_no_argument, version, add_namelet, print_namelet): Add static
	prototype.
	(print_base_classname, utf8_cmp, cxx_keyword_subst,
	name_is_method_p): Constify a char*.
	(get_field_name): Likewise.  Prefer xstrdup over malloc/strcpy.
	Provide a final else clause in an if-else-if.
	(print_field_info): Add missing final arg in function call to
	`print_field_name'.
	(print_method_info, decompile_method, decode_signature_piece,
	print_c_decl, print_full_cxx_name, print_stub,
	print_mangled_classname, super_class_name, print_include,
	add_namelet, add_class_decl, print_class_decls, process_file,
	help): Constify a char*.

	* jcf-write.c (jcf_handler, push_constant1, push_constant2,
	push_int_const, find_constant_wide, find_constant_index,
	push_long_const, field_op, maybe_wide, emit_dup, emit_pop,
	emit_iinc, emit_load_or_store, emit_load, emit_store, emit_unop,
	emit_binop, emit_reloc, emit_switch_reloc, emit_case_reloc,
	emit_if, emit_goto, emit_jsr, call_cleanups,
	make_class_file_name): Add static prototypes.
	(generate_bytecode_return, generate_bytecode_insns): Pass a
	NULL_PTR, not a NULL_TREE.

	* jv-scan.c: Include "jcf.h".
	(main): Declare using DEFUN macro.

	* jvspec.c (find_spec_file, lang_specific_pre_link,
	lang_specific_driver): Add prototypes.
	(find_spec_file): Constify a char*.

	* keyword.gperf (hash, java_keyword): Add prototypes.

	* lang.c (lang_print_error): Add static prototype.
	(lang_init): Prefer memcpy over bcopy to avoid casts.

	* lex.c (yylex): Add static prototype.

	* parse-scan.y: Include "lex.c" earlier.

	* parse.h: Remove redundant declaration for `yylex'.

	* parse.y (java_decl_equiv, binop_compound_p, search_loop,
	labeled_block_contains_loop_p): Add static prototypes.
	(not_accessible_p): Make static to match prototype.

	* verify.c (start_pc_cmp): Don't needlessly cast away const.

From-SVN: r28862
This commit is contained in:
Kaveh R. Ghazi 1999-08-25 13:59:28 +00:00 committed by Kaveh Ghazi
parent ffee6d9387
commit be245ac0a0
15 changed files with 773 additions and 629 deletions

View File

@ -1,3 +1,57 @@
1999-08-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gjavah.c (print_name, print_base_classname, utf8_cmp,
cxx_keyword_subst, generate_access, name_is_method_p,
get_field_name, print_field_name, super_class_name, print_include,
decode_signature_piece, print_class_decls, usage, help,
java_no_argument, version, add_namelet, print_namelet): Add static
prototype.
(print_base_classname, utf8_cmp, cxx_keyword_subst,
name_is_method_p): Constify a char*.
(get_field_name): Likewise. Prefer xstrdup over malloc/strcpy.
Provide a final else clause in an if-else-if.
(print_field_info): Add missing final arg in function call to
`print_field_name'.
(print_method_info, decompile_method, decode_signature_piece,
print_c_decl, print_full_cxx_name, print_stub,
print_mangled_classname, super_class_name, print_include,
add_namelet, add_class_decl, print_class_decls, process_file,
help): Constify a char*.
* jcf-write.c (jcf_handler, push_constant1, push_constant2,
push_int_const, find_constant_wide, find_constant_index,
push_long_const, field_op, maybe_wide, emit_dup, emit_pop,
emit_iinc, emit_load_or_store, emit_load, emit_store, emit_unop,
emit_binop, emit_reloc, emit_switch_reloc, emit_case_reloc,
emit_if, emit_goto, emit_jsr, call_cleanups,
make_class_file_name): Add static prototypes.
(generate_bytecode_return, generate_bytecode_insns): Pass a
NULL_PTR, not a NULL_TREE.
* jv-scan.c: Include "jcf.h".
(main): Declare using DEFUN macro.
* jvspec.c (find_spec_file, lang_specific_pre_link,
lang_specific_driver): Add prototypes.
(find_spec_file): Constify a char*.
* keyword.gperf (hash, java_keyword): Add prototypes.
* lang.c (lang_print_error): Add static prototype.
(lang_init): Prefer memcpy over bcopy to avoid casts.
* lex.c (yylex): Add static prototype.
* parse-scan.y: Include "lex.c" earlier.
* parse.h: Remove redundant declaration for `yylex'.
* parse.y (java_decl_equiv, binop_compound_p, search_loop,
labeled_block_contains_loop_p): Add static prototypes.
(not_accessible_p): Make static to match prototype.
* verify.c (start_pc_cmp): Don't needlessly cast away const.
Sun Aug 22 11:07:41 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (check_method_redefinition): Changed leading comment.

View File

@ -119,6 +119,23 @@ static void add_class_decl PROTO ((FILE*, JCF*, JCF_u2));
static int java_float_finite PROTO ((jfloat));
static int java_double_finite PROTO ((jdouble));
static void print_name PROTO ((FILE *, JCF *, int));
static void print_base_classname PROTO ((FILE *, JCF *, int));
static int utf8_cmp PROTO ((const unsigned char *, int, const char *));
static const char *cxx_keyword_subst PROTO ((const unsigned char *, int));
static void generate_access PROTO ((FILE *, JCF_u2));
static int name_is_method_p PROTO ((const unsigned char *, int));
static char *get_field_name PROTO ((JCF *, int, JCF_u2));
static void print_field_name PROTO ((FILE *, JCF *, int, JCF_u2));
static const unsigned char *super_class_name PROTO ((JCF *, int *));
static void print_include PROTO ((FILE *, const unsigned char *, int));
static const unsigned char *decode_signature_piece
PROTO ((FILE *, const unsigned char *, const unsigned char *, int *));
static void print_class_decls PROTO ((FILE *, JCF *, int));
static void usage PROTO ((void)) ATTRIBUTE_NORETURN;
static void help PROTO ((void)) ATTRIBUTE_NORETURN;
static void java_no_argument PROTO ((const char *)) ATTRIBUTE_NORETURN;
static void version PROTO ((void)) ATTRIBUTE_NORETURN;
JCF_u2 current_field_name;
JCF_u2 current_field_value;
@ -209,7 +226,7 @@ java_double_finite (d)
return (u.i & D_NAN_MASK) != D_NAN_MASK;
}
void
static void
DEFUN(print_name, (stream, jcf, name_index),
FILE* stream AND JCF* jcf AND int name_index)
{
@ -231,7 +248,7 @@ print_base_classname (stream, jcf, index)
{
int name_index = JPOOL_USHORT1 (jcf, index);
int len;
unsigned char *s, *p, *limit;
const unsigned char *s, *p, *limit;
s = JPOOL_UTF_DATA (jcf, name_index);
len = JPOOL_UTF_LENGTH (jcf, name_index);
@ -258,11 +275,11 @@ print_base_classname (stream, jcf, index)
static int
utf8_cmp (str, length, name)
unsigned char *str;
const unsigned char *str;
int length;
char *name;
const char *name;
{
unsigned char *limit = str + length;
const unsigned char *limit = str + length;
int i;
for (i = 0; name[i]; ++i)
@ -280,9 +297,9 @@ utf8_cmp (str, length, name)
Otherwise, return NULL. FIXME: for now, we only handle those
keywords we know to be a problem for libgcj. */
static char *
static const char *
cxx_keyword_subst (str, length)
unsigned char *str;
const unsigned char *str;
int length;
{
if (! utf8_cmp (str, length, "delete"))
@ -329,7 +346,7 @@ generate_access (stream, flags)
/* See if NAME is already the name of a method. */
static int
name_is_method_p (name, length)
unsigned char *name;
const unsigned char *name;
int length;
{
struct method_name *p;
@ -352,6 +369,8 @@ get_field_name (jcf, name_index, flags)
unsigned char *name = JPOOL_UTF_DATA (jcf, name_index);
int length = JPOOL_UTF_LENGTH (jcf, name_index);
char *override;
const char *tmpconstptr;
if (name_is_method_p (name, length))
{
@ -370,14 +389,14 @@ get_field_name (jcf, name_index, flags)
memcpy (override, name, length);
strcpy (override + length, "__");
}
else if ((override = cxx_keyword_subst (name, length)) != NULL)
else if ((tmpconstptr = cxx_keyword_subst (name, length)) != NULL)
{
/* Must malloc OVERRIDE. */
char *o2 = (char *) malloc (strlen (override) + 1);
strcpy (o2, override);
override = o2;
override = xstrdup (tmpconstptr);
}
else
override = NULL;
return override;
}
@ -431,7 +450,7 @@ DEFUN(print_field_info, (stream, jcf, name_index, sig_index, flags),
jint num;
int most_negative = 0;
fputs (" static const jint ", out);
print_field_name (out, jcf, name_index);
print_field_name (out, jcf, name_index, 0);
fputs (" = ", out);
num = JPOOL_INT (jcf, current_field_value);
/* We single out the most negative number to print
@ -450,7 +469,7 @@ DEFUN(print_field_info, (stream, jcf, name_index, sig_index, flags),
jlong num;
int most_negative = 0;
fputs (" static const jlong ", out);
print_field_name (out, jcf, name_index);
print_field_name (out, jcf, name_index, 0);
fputs (" = ", out);
num = JPOOL_LONG (jcf, current_field_value);
/* We single out the most negative number to print
@ -468,7 +487,7 @@ DEFUN(print_field_info, (stream, jcf, name_index, sig_index, flags),
{
jfloat fnum = JPOOL_FLOAT (jcf, current_field_value);
fputs (" static const jfloat ", out);
print_field_name (out, jcf, name_index);
print_field_name (out, jcf, name_index, 0);
if (! java_float_finite (fnum))
fputs (";\n", out);
else
@ -479,7 +498,7 @@ DEFUN(print_field_info, (stream, jcf, name_index, sig_index, flags),
{
jdouble dnum = JPOOL_DOUBLE (jcf, current_field_value);
fputs (" static const jdouble ", out);
print_field_name (out, jcf, name_index);
print_field_name (out, jcf, name_index, 0);
if (! java_double_finite (dnum))
fputs (";\n", out);
else
@ -515,7 +534,7 @@ DEFUN(print_method_info, (stream, jcf, name_index, sig_index, flags),
FILE *stream AND JCF* jcf
AND int name_index AND int sig_index AND JCF_u2 flags)
{
unsigned char *str;
const unsigned char *str;
int length, is_init = 0;
const char *override = NULL;
@ -613,7 +632,7 @@ decompile_method (out, jcf, code_len)
JCF *jcf;
int code_len;
{
unsigned char *codes = jcf->read_ptr;
const unsigned char *codes = jcf->read_ptr;
int index;
uint16 name_and_type, name;
@ -669,10 +688,10 @@ decompile_method (out, jcf, code_len)
/* Print one piece of a signature. Returns pointer to next parseable
character on success, NULL on error. */
static unsigned char *
static const unsigned char *
decode_signature_piece (stream, signature, limit, need_space)
FILE *stream;
unsigned char *signature, *limit;
const unsigned char *signature, *limit;
int *need_space;
{
const char *ctype;
@ -778,12 +797,12 @@ DEFUN(print_c_decl, (stream, jcf, name_index, signature_index, is_init,
else
{
int length = JPOOL_UTF_LENGTH (jcf, signature_index);
unsigned char *str0 = JPOOL_UTF_DATA (jcf, signature_index);
register unsigned char *str = str0;
unsigned char *limit = str + length;
const unsigned char *str0 = JPOOL_UTF_DATA (jcf, signature_index);
register const unsigned char *str = str0;
const unsigned char *limit = str + length;
int need_space = 0;
int is_method = str[0] == '(';
unsigned char *next;
const unsigned char *next;
/* If printing a method, skip to the return signature and print
that first. However, there is no return value if this is a
@ -827,12 +846,12 @@ DEFUN(print_full_cxx_name, (stream, jcf, name_index, signature_index, is_init, n
AND const char *name_override)
{
int length = JPOOL_UTF_LENGTH (jcf, signature_index);
unsigned char *str0 = JPOOL_UTF_DATA (jcf, signature_index);
register unsigned char *str = str0;
unsigned char *limit = str + length;
const unsigned char *str0 = JPOOL_UTF_DATA (jcf, signature_index);
register const unsigned char *str = str0;
const unsigned char *limit = str + length;
int need_space = 0;
int is_method = str[0] == '(';
unsigned char *next;
const unsigned char *next;
if (name_override)
fputs (name_override, stream);
@ -885,12 +904,12 @@ DEFUN(print_stub, (stream, jcf, name_index, signature_index, is_init,
else
{
int length = JPOOL_UTF_LENGTH (jcf, signature_index);
unsigned char *str0 = JPOOL_UTF_DATA (jcf, signature_index);
register unsigned char *str = str0;
unsigned char *limit = str + length;
const unsigned char *str0 = JPOOL_UTF_DATA (jcf, signature_index);
register const unsigned char *str = str0;
const unsigned char *limit = str + length;
int need_space = 0;
int is_method = str[0] == '(';
unsigned char *next;
const unsigned char *next;
/* If printing a method, skip to the return signature and print
that first. However, there is no return value if this is a
@ -932,7 +951,7 @@ DEFUN(print_stub, (stream, jcf, name_index, signature_index, is_init,
}
}
void
static void
DEFUN(print_mangled_classname, (stream, jcf, prefix, index),
FILE *stream AND JCF *jcf AND const char *prefix AND int index)
{
@ -956,7 +975,7 @@ print_cxx_classname (stream, prefix, jcf, index)
{
int name_index = JPOOL_USHORT1 (jcf, index);
int len, c;
unsigned char *s, *p, *limit;
const unsigned char *s, *p, *limit;
s = JPOOL_UTF_DATA (jcf, name_index);
len = JPOOL_UTF_LENGTH (jcf, name_index);
@ -985,14 +1004,15 @@ int written_class_count = 0;
/* Return name of superclass. If LEN is not NULL, fill it with length
of name. */
static unsigned char *
static const unsigned char *
super_class_name (derived_jcf, len)
JCF *derived_jcf;
int *len;
{
int supername_index = JPOOL_USHORT1 (derived_jcf, derived_jcf->super_class);
int supername_length = JPOOL_UTF_LENGTH (derived_jcf, supername_index);
unsigned char *supername = JPOOL_UTF_DATA (derived_jcf, supername_index);
const unsigned char *supername =
JPOOL_UTF_DATA (derived_jcf, supername_index);
if (len)
*len = supername_length;
@ -1017,7 +1037,7 @@ static struct include *all_includes = NULL;
static void
print_include (out, utf8, len)
FILE *out;
unsigned char *utf8;
const unsigned char *utf8;
int len;
{
struct include *incl;
@ -1063,6 +1083,10 @@ struct namelet
struct namelet *next;
};
static void add_namelet PROTO ((const unsigned char *,
const unsigned char *, struct namelet *));
static void print_namelet PROTO ((FILE *, struct namelet *, int));
/* The special root namelet. */
static struct namelet root =
{
@ -1077,10 +1101,10 @@ static struct namelet root =
recursively. */
static void
add_namelet (name, name_limit, parent)
unsigned char *name, *name_limit;
const unsigned char *name, *name_limit;
struct namelet *parent;
{
unsigned char *p;
const unsigned char *p;
struct namelet *n = NULL, *np;
/* We want to skip the standard namespaces that we assume the
@ -1192,13 +1216,13 @@ add_class_decl (out, jcf, signature)
JCF *jcf;
JCF_u2 signature;
{
unsigned char *s = JPOOL_UTF_DATA (jcf, signature);
const unsigned char *s = JPOOL_UTF_DATA (jcf, signature);
int len = JPOOL_UTF_LENGTH (jcf, signature);
int i;
/* Name of class we are processing. */
int name_index = JPOOL_USHORT1 (jcf, jcf->this_class);
int tlen = JPOOL_UTF_LENGTH (jcf, name_index);
char *tname = JPOOL_UTF_DATA (jcf, name_index);
const char *tname = JPOOL_UTF_DATA (jcf, name_index);
for (i = 0; i < len; ++i)
{
@ -1253,7 +1277,7 @@ print_class_decls (out, jcf, self)
that should be declared. */
int name_index = JPOOL_USHORT1 (jcf, self);
int len;
unsigned char *s;
const unsigned char *s;
s = JPOOL_UTF_DATA (jcf, name_index);
len = JPOOL_UTF_LENGTH (jcf, name_index);
@ -1341,7 +1365,8 @@ DEFUN(process_file, (jcf, out),
if (jcf->super_class)
{
int super_length;
unsigned char *supername = super_class_name (jcf, &super_length);
const unsigned char *supername =
super_class_name (jcf, &super_length);
fputs ("\n", out);
print_include (out, supername, super_length);
@ -1473,7 +1498,7 @@ help ()
static void
java_no_argument (opt)
char *opt;
const char *opt;
{
fprintf (stderr, "gcjh: no argument given for option `%s'\n", opt);
exit (1);

View File

@ -299,7 +299,39 @@ static void init_jcf_state PROTO ((struct jcf_partial *, struct obstack *));
static void init_jcf_method PROTO ((struct jcf_partial *, tree));
static void release_jcf_state PROTO ((struct jcf_partial *));
static struct chunk * generate_classfile PROTO ((tree, struct jcf_partial *));
static struct jcf_handler *alloc_handler PROTO ((struct jcf_block *,
struct jcf_block *,
struct jcf_partial *));
static void push_constant1 PROTO ((int, struct jcf_partial *));
static void push_constant2 PROTO ((int, struct jcf_partial *));
static void push_int_const PROTO ((HOST_WIDE_INT, struct jcf_partial *));
static int find_constant_wide PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
struct jcf_partial *));
static int find_constant_index PROTO ((tree, struct jcf_partial *));
static void push_long_const PROTO ((HOST_WIDE_INT, HOST_WIDE_INT,
struct jcf_partial *));
static void field_op PROTO ((tree, int, struct jcf_partial *));
static void maybe_wide PROTO ((int, int, struct jcf_partial *));
static void emit_dup PROTO ((int, int, struct jcf_partial *));
static void emit_pop PROTO ((int, struct jcf_partial *));
static void emit_iinc PROTO ((tree, int, struct jcf_partial *));
static void emit_load_or_store PROTO ((tree, int, struct jcf_partial *));
static void emit_load PROTO ((tree, struct jcf_partial *));
static void emit_store PROTO ((tree, struct jcf_partial *));
static void emit_unop PROTO ((enum java_opcode, tree, struct jcf_partial *));
static void emit_binop PROTO ((enum java_opcode, tree, struct jcf_partial *));
static void emit_reloc PROTO ((HOST_WIDE_INT, int, struct jcf_block *,
struct jcf_partial *));
static void emit_switch_reloc PROTO ((struct jcf_block *,
struct jcf_partial *));
static void emit_case_reloc PROTO ((struct jcf_relocation *,
struct jcf_partial *));
static void emit_if PROTO ((struct jcf_block *, int, int,
struct jcf_partial *));
static void emit_goto PROTO ((struct jcf_block *, struct jcf_partial *));
static void emit_jsr PROTO ((struct jcf_block *, struct jcf_partial *));
static void call_cleanups PROTO ((struct jcf_block *, struct jcf_partial *));
static char *make_class_file_name PROTO ((tree));
/* Utility macros for appending (big-endian) data to a buffer.
We assume a local variable 'ptr' points into where we want to
@ -1334,7 +1366,7 @@ generate_bytecode_return (exp, state)
if (returns_void)
{
op = OPCODE_return;
call_cleanups (NULL_TREE, state);
call_cleanups (NULL_PTR, state);
}
else
{
@ -1348,7 +1380,7 @@ generate_bytecode_return (exp, state)
localvar_alloc (state->return_value_decl, state);
}
emit_store (state->return_value_decl, state);
call_cleanups (NULL_TREE, state);
call_cleanups (NULL_PTR, state);
emit_load (state->return_value_decl, state);
/* If we call localvar_free (state->return_value_decl, state),
then we risk the save decl erroneously re-used in the
@ -2264,7 +2296,7 @@ generate_bytecode_insns (exp, target, state)
/* Handle exceptions. */
localvar_alloc (return_link, state);
handler = alloc_handler (start_label, NULL_TREE, state);
handler = alloc_handler (start_label, NULL_PTR, state);
handler->end_label = handler->handler_label;
handler->type = NULL_TREE;
localvar_alloc (exception_decl, state);

View File

@ -29,6 +29,7 @@ void warning VPROTO((const char *s, ...)) ATTRIBUTE_PRINTF_1;
void gcc_obstack_init PROTO ((struct obstack *obstack));
#define JC1_LITE
#include "jcf.h"
#include "parse.h"
/* Current input file and output file IO streams. */
@ -47,9 +48,8 @@ int flag_list_filename = 0;
/* jc1-lite main entry point */
int
main (argc, argv)
int argc;
char **argv;
DEFUN (main, (argc, argv),
int argc AND char **argv)
{
int i = 1;
const char *output_file = NULL;

View File

@ -41,7 +41,11 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
/* True if this arg is a .class input file name. */
#define CLASS_FILE_ARG (1<<4)
static char *find_spec_file PROTO ((const char *));
extern int do_spec PROTO((char *));
extern int lang_specific_pre_link PROTO((void));
extern void lang_specific_driver PROTO ((void (*) (const char *, ...),
int *, char ***, int *));
extern char *input_filename;
extern size_t input_filename_length;
@ -68,7 +72,7 @@ char jvgenmain_spec[] =
not. */
static char *
find_spec_file (dir)
char *dir;
const char *dir;
{
char *spec;
int x;
@ -89,7 +93,7 @@ find_spec_file (dir)
void
lang_specific_driver (fn, in_argc, in_argv, in_added_libraries)
void (*fn)();
void (*fn) PROTO ((const char *, ...));
int *in_argc;
char ***in_argv;
int *in_added_libraries;

View File

@ -26,6 +26,14 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
%}
struct java_keyword { const char *name; int token; };
#ifdef __GNUC__
__inline
#endif
static unsigned int hash PARAMS ((const char *, unsigned int));
#ifdef __GNUC__
__inline
#endif
struct java_keyword *java_keyword PARAMS ((const char *, unsigned int));
%%
abstract, ABSTRACT_TK
default, DEFAULT_TK

View File

@ -26,6 +26,14 @@ of Sun Microsystems, Inc. in the United States and other countries.
The Free Software Foundation is independent of Sun Microsystems, Inc. */
struct java_keyword { const char *name; int token; };
#ifdef __GNUC__
__inline
#endif
static unsigned int hash PARAMS ((const char *, unsigned int));
#ifdef __GNUC__
__inline
#endif
struct java_keyword *java_keyword PARAMS ((const char *, unsigned int));
#define TOTAL_KEYWORDS 50
#define MIN_WORD_LENGTH 2

View File

@ -39,6 +39,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
static void put_decl_string PROTO ((const char *, int));
static void put_decl_node PROTO ((tree));
static void java_dummy_print PROTO ((const char *));
static void lang_print_error PROTO ((const char *));
#ifndef OBJECT_SUFFIX
# define OBJECT_SUFFIX ".o"
@ -453,7 +454,7 @@ lang_printable_name (decl, v)
/* Print on stderr the current class and method context. This function
is the value of the hook print_error_function, called from toplev.c. */
void
static void
lang_print_error (file)
const char *file;
{
@ -507,17 +508,17 @@ lang_init ()
/* Append to Gcc tree node definition arrays */
bcopy (java_tree_code_type,
tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE,
(int)LAST_JAVA_TREE_CODE - (int)LAST_AND_UNUSED_TREE_CODE);
bcopy ((char *)java_tree_code_length,
(char *)(tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE),
(LAST_JAVA_TREE_CODE -
(int)LAST_AND_UNUSED_TREE_CODE) * sizeof (int));
bcopy ((char *)java_tree_code_name,
(char *)(tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE),
(LAST_JAVA_TREE_CODE -
(int)LAST_AND_UNUSED_TREE_CODE) * sizeof (char *));
memcpy (tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE,
java_tree_code_type,
(int)LAST_JAVA_TREE_CODE - (int)LAST_AND_UNUSED_TREE_CODE);
memcpy (tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE,
java_tree_code_length,
(LAST_JAVA_TREE_CODE -
(int)LAST_AND_UNUSED_TREE_CODE) * sizeof (int));
memcpy (tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE,
java_tree_code_name,
(LAST_JAVA_TREE_CODE -
(int)LAST_AND_UNUSED_TREE_CODE) * sizeof (char *));
using_eh_for_cleanups ();
}

View File

@ -517,7 +517,9 @@ java_parse_escape_sequence ()
}
}
int
static int yylex PARAMS ((YYSTYPE *));
static int
#ifdef JC1_LITE
yylex (java_lval)
#else

View File

@ -182,6 +182,9 @@ typedef union {
struct method_declarator *declarator;
int value; /* For modifiers */
} YYSTYPE;
#line 106 "./parse-scan.y"
#include "lex.c"
#ifndef YYDEBUG
#define YYDEBUG 1
#endif
@ -401,41 +404,41 @@ static const short yyrhs[] = { 123,
#if YYDEBUG != 0
static const short yyrline[] = { 0,
171, 176, 178, 179, 180, 181, 182, 186, 188, 191,
197, 202, 209, 211, 214, 218, 222, 226, 228, 235,
245, 247, 250, 254, 263, 268, 269, 270, 271, 272,
273, 274, 275, 278, 280, 283, 285, 288, 293, 295,
298, 302, 306, 308, 309, 315, 324, 335, 342, 342,
345, 347, 348, 351, 352, 355, 358, 362, 364, 367,
369, 372, 374, 375, 376, 379, 381, 382, 383, 387,
390, 394, 397, 400, 402, 405, 408, 412, 414, 418,
422, 425, 426, 428, 435, 442, 448, 451, 453, 461,
477, 493, 494, 497, 500, 504, 506, 507, 511, 513,
516, 526, 528, 531, 533, 539, 542, 546, 548, 549,
550, 554, 556, 559, 561, 565, 567, 572, 575, 577,
579, 583, 585, 588, 590, 593, 595, 598, 600, 601,
602, 605, 609, 614, 616, 617, 618, 621, 623, 627,
629, 632, 634, 637, 639, 640, 643, 647, 650, 654,
656, 657, 658, 659, 660, 663, 665, 666, 667, 668,
671, 673, 674, 675, 676, 677, 678, 679, 680, 681,
682, 685, 689, 694, 698, 704, 708, 710, 711, 712,
713, 714, 715, 718, 722, 726, 730, 734, 736, 737,
738, 741, 743, 746, 751, 753, 756, 758, 761, 765,
769, 773, 777, 781, 783, 786, 788, 791, 795, 798,
799, 800, 803, 804, 807, 809, 812, 814, 817, 819,
822, 824, 827, 831, 833, 836, 841, 843, 844, 847,
849, 852, 856, 861, 863, 866, 868, 869, 870, 871,
872, 873, 877, 879, 881, 885, 889, 891, 895, 896,
900, 901, 902, 903, 906, 909, 912, 914, 915, 918,
920, 921, 922, 925, 926, 929, 931, 934, 938, 940,
943, 945, 948, 951, 953, 954, 955, 956, 959, 962,
965, 967, 969, 970, 973, 977, 981, 983, 984, 985,
986, 989, 993, 997, 999, 1000, 1001, 1004, 1006, 1007,
1008, 1011, 1013, 1014, 1015, 1018, 1020, 1021, 1024, 1026,
1027, 1028, 1031, 1033, 1034, 1035, 1036, 1037, 1040, 1042,
1043, 1046, 1048, 1051, 1053, 1056, 1058, 1061, 1063, 1066,
1068, 1071, 1073, 1076, 1078, 1081, 1085, 1088, 1089, 1092,
1094, 1097, 1101
175, 180, 182, 183, 184, 185, 186, 190, 192, 195,
201, 206, 213, 215, 218, 222, 226, 230, 232, 239,
249, 251, 254, 258, 267, 272, 273, 274, 275, 276,
277, 278, 279, 282, 284, 287, 289, 292, 297, 299,
302, 306, 310, 312, 313, 319, 328, 339, 346, 346,
349, 351, 352, 355, 356, 359, 362, 366, 368, 371,
373, 376, 378, 379, 380, 383, 385, 386, 387, 391,
394, 398, 401, 404, 406, 409, 412, 416, 418, 422,
426, 429, 430, 432, 439, 446, 452, 455, 457, 465,
481, 497, 498, 501, 504, 508, 510, 511, 515, 517,
520, 530, 532, 535, 537, 543, 546, 550, 552, 553,
554, 558, 560, 563, 565, 569, 571, 576, 579, 581,
583, 587, 589, 592, 594, 597, 599, 602, 604, 605,
606, 609, 613, 618, 620, 621, 622, 625, 627, 631,
633, 636, 638, 641, 643, 644, 647, 651, 654, 658,
660, 661, 662, 663, 664, 667, 669, 670, 671, 672,
675, 677, 678, 679, 680, 681, 682, 683, 684, 685,
686, 689, 693, 698, 702, 708, 712, 714, 715, 716,
717, 718, 719, 722, 726, 730, 734, 738, 740, 741,
742, 745, 747, 750, 755, 757, 760, 762, 765, 769,
773, 777, 781, 785, 787, 790, 792, 795, 799, 802,
803, 804, 807, 808, 811, 813, 816, 818, 821, 823,
826, 828, 831, 835, 837, 840, 845, 847, 848, 851,
853, 856, 860, 865, 867, 870, 872, 873, 874, 875,
876, 877, 881, 883, 885, 889, 893, 895, 899, 900,
904, 905, 906, 907, 910, 913, 916, 918, 919, 922,
924, 925, 926, 929, 930, 933, 935, 938, 942, 944,
947, 949, 952, 955, 957, 958, 959, 960, 963, 966,
969, 971, 973, 974, 977, 981, 985, 987, 988, 989,
990, 993, 997, 1001, 1003, 1004, 1005, 1008, 1010, 1011,
1012, 1015, 1017, 1018, 1019, 1022, 1024, 1025, 1028, 1030,
1031, 1032, 1035, 1037, 1038, 1039, 1040, 1041, 1044, 1046,
1047, 1050, 1052, 1055, 1057, 1060, 1062, 1065, 1067, 1070,
1072, 1075, 1077, 1080, 1082, 1085, 1089, 1092, 1093, 1096,
1098, 1101, 1105
};
#endif
@ -1873,28 +1876,28 @@ yyreduce:
switch (yyn) {
case 10:
#line 193 "./parse-scan.y"
#line 197 "./parse-scan.y"
{
/* use preset global here. FIXME */
yyval.node = xstrdup ("int");
;
break;}
case 11:
#line 198 "./parse-scan.y"
#line 202 "./parse-scan.y"
{
/* use preset global here. FIXME */
yyval.node = xstrdup ("double");
;
break;}
case 12:
#line 203 "./parse-scan.y"
#line 207 "./parse-scan.y"
{
/* use preset global here. FIXME */
yyval.node = xstrdup ("boolean");
;
break;}
case 19:
#line 229 "./parse-scan.y"
#line 233 "./parse-scan.y"
{
char *n = xmalloc (strlen (yyvsp[-2].node)+2);
n [0] = '[';
@ -1903,7 +1906,7 @@ case 19:
;
break;}
case 20:
#line 236 "./parse-scan.y"
#line 240 "./parse-scan.y"
{
char *n = xmalloc (strlen (yyvsp[-2].node)+2);
n [0] = '[';
@ -1912,7 +1915,7 @@ case 20:
;
break;}
case 24:
#line 256 "./parse-scan.y"
#line 260 "./parse-scan.y"
{
char *n = xmalloc (strlen (yyvsp[-2].node)+strlen (yyvsp[0].node)+2);
sprintf (n, "%s.%s", yyvsp[-2].node, yyvsp[0].node);
@ -1920,11 +1923,11 @@ case 24:
;
break;}
case 38:
#line 290 "./parse-scan.y"
#line 294 "./parse-scan.y"
{ package_name = yyvsp[-1].node; ;
break;}
case 46:
#line 317 "./parse-scan.y"
#line 321 "./parse-scan.y"
{
if (yyvsp[0].value == PUBLIC_TK)
modifier_value++;
@ -1934,7 +1937,7 @@ case 46:
;
break;}
case 47:
#line 325 "./parse-scan.y"
#line 329 "./parse-scan.y"
{
if (yyvsp[0].value == PUBLIC_TK)
modifier_value++;
@ -1944,57 +1947,57 @@ case 47:
;
break;}
case 48:
#line 337 "./parse-scan.y"
#line 341 "./parse-scan.y"
{
report_class_declaration(yyvsp[-2].node);
modifier_value = 0;
;
break;}
case 50:
#line 343 "./parse-scan.y"
#line 347 "./parse-scan.y"
{ report_class_declaration(yyvsp[-2].node); ;
break;}
case 56:
#line 357 "./parse-scan.y"
#line 361 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 57:
#line 359 "./parse-scan.y"
#line 363 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 70:
#line 389 "./parse-scan.y"
#line 393 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 71:
#line 391 "./parse-scan.y"
#line 395 "./parse-scan.y"
{ modifier_value = 0; ;
break;}
case 76:
#line 407 "./parse-scan.y"
#line 411 "./parse-scan.y"
{ bracket_count = 0; USE_ABSORBER; ;
break;}
case 77:
#line 409 "./parse-scan.y"
#line 413 "./parse-scan.y"
{ ++bracket_count; ;
break;}
case 81:
#line 424 "./parse-scan.y"
#line 428 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 83:
#line 427 "./parse-scan.y"
#line 431 "./parse-scan.y"
{ modifier_value = 0; ;
break;}
case 84:
#line 429 "./parse-scan.y"
#line 433 "./parse-scan.y"
{
report_main_declaration (yyvsp[-1].declarator);
modifier_value = 0;
;
break;}
case 85:
#line 437 "./parse-scan.y"
#line 441 "./parse-scan.y"
{
struct method_declarator *d;
NEW_METHOD_DECLARATOR (d, yyvsp[-2].node, NULL);
@ -2002,7 +2005,7 @@ case 85:
;
break;}
case 86:
#line 443 "./parse-scan.y"
#line 447 "./parse-scan.y"
{
struct method_declarator *d;
NEW_METHOD_DECLARATOR (d, yyvsp[-3].node, yyvsp[-1].node);
@ -2010,7 +2013,7 @@ case 86:
;
break;}
case 89:
#line 454 "./parse-scan.y"
#line 458 "./parse-scan.y"
{
char *n = xmalloc (strlen (yyvsp[-2].node)+strlen(yyvsp[0].node)+2);
sprintf (n, "%s,%s", yyvsp[-2].node, yyvsp[0].node);
@ -2018,7 +2021,7 @@ case 89:
;
break;}
case 90:
#line 463 "./parse-scan.y"
#line 467 "./parse-scan.y"
{
USE_ABSORBER;
if (bracket_count)
@ -2035,7 +2038,7 @@ case 90:
;
break;}
case 91:
#line 478 "./parse-scan.y"
#line 482 "./parse-scan.y"
{
if (bracket_count)
{
@ -2051,107 +2054,107 @@ case 91:
;
break;}
case 94:
#line 499 "./parse-scan.y"
#line 503 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 95:
#line 501 "./parse-scan.y"
#line 505 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 101:
#line 518 "./parse-scan.y"
#line 522 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 103:
#line 529 "./parse-scan.y"
#line 533 "./parse-scan.y"
{ modifier_value = 0; ;
break;}
case 105:
#line 534 "./parse-scan.y"
#line 538 "./parse-scan.y"
{ modifier_value = 0; ;
break;}
case 106:
#line 541 "./parse-scan.y"
#line 545 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 107:
#line 543 "./parse-scan.y"
#line 547 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 114:
#line 560 "./parse-scan.y"
#line 564 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 115:
#line 562 "./parse-scan.y"
#line 566 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 118:
#line 574 "./parse-scan.y"
#line 578 "./parse-scan.y"
{ report_class_declaration (yyvsp[-1].node); modifier_value = 0; ;
break;}
case 119:
#line 576 "./parse-scan.y"
#line 580 "./parse-scan.y"
{ report_class_declaration (yyvsp[-1].node); modifier_value = 0; ;
break;}
case 120:
#line 578 "./parse-scan.y"
#line 582 "./parse-scan.y"
{ report_class_declaration (yyvsp[-2].node); modifier_value = 0; ;
break;}
case 121:
#line 580 "./parse-scan.y"
#line 584 "./parse-scan.y"
{ report_class_declaration (yyvsp[-2].node); modifier_value = 0; ;
break;}
case 148:
#line 649 "./parse-scan.y"
#line 653 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 149:
#line 651 "./parse-scan.y"
#line 655 "./parse-scan.y"
{ modifier_value = 0; ;
break;}
case 173:
#line 691 "./parse-scan.y"
#line 695 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 226:
#line 838 "./parse-scan.y"
#line 842 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 243:
#line 878 "./parse-scan.y"
#line 882 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 244:
#line 880 "./parse-scan.y"
#line 884 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 246:
#line 886 "./parse-scan.y"
#line 890 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 255:
#line 908 "./parse-scan.y"
#line 912 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 273:
#line 950 "./parse-scan.y"
#line 954 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 274:
#line 952 "./parse-scan.y"
#line 956 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 279:
#line 961 "./parse-scan.y"
#line 965 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 282:
#line 968 "./parse-scan.y"
#line 972 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
case 337:
#line 1087 "./parse-scan.y"
#line 1091 "./parse-scan.y"
{ USE_ABSORBER; ;
break;}
}
@ -2352,11 +2355,9 @@ yyerrhandle:
yystate = yyn;
goto yynewstate;
}
#line 1105 "./parse-scan.y"
#line 1109 "./parse-scan.y"
#include "lex.c"
/* Create a new parser context */
void

View File

@ -103,6 +103,10 @@ static void report_main_declaration PROTO ((struct method_declarator *));
int value; /* For modifiers */
}
%{
#include "lex.c"
%}
%pure_parser
/* Things defined here have to match the order of what's in the
@ -1104,8 +1108,6 @@ constant_expression:
%%
#include "lex.c"
/* Create a new parser context */
void

File diff suppressed because it is too large Load Diff

View File

@ -673,7 +673,6 @@ extern void java_parser_context_save_global PROTO ((void));
extern void java_parser_context_restore_global PROTO ((void));
int yyparse PROTO ((void));
extern int java_parse PROTO ((void));
int yylex ();
void yyerror PROTO ((const char *));
extern void java_expand_classes PROTO ((void));
#endif

View File

@ -258,6 +258,10 @@ static char * operator_string PROTO ((tree));
static tree do_merge_string_cste PROTO ((tree, const char *, int, int));
static tree merge_string_cste PROTO ((tree, tree, int));
static tree java_refold PROTO ((tree));
static int java_decl_equiv PROTO ((tree, tree));
static int binop_compound_p PROTO ((enum tree_code));
static tree search_loop PROTO ((tree));
static int labeled_block_contains_loop_p PROTO ((tree, tree));
/* Number of error found so far. */
int java_error_count;
@ -6927,7 +6931,8 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found)
/* 6.6 Qualified name and access control. Returns 1 if MEMBER (a decl)
can't be accessed from REFERENCE (a record type). */
int not_accessible_p (reference, member, from_super)
static int
not_accessible_p (reference, member, from_super)
tree reference, member;
int from_super;
{

View File

@ -316,8 +316,8 @@ start_pc_cmp (xp, yp)
const PTR xp;
const PTR yp;
{
struct pc_index *x = (struct pc_index *) xp;
struct pc_index *y = (struct pc_index *) yp;
const struct pc_index *x = (const struct pc_index *) xp;
const struct pc_index *y = (const struct pc_index *) yp;
return x->start_pc - y->start_pc;
}