Commit be245ac0 by Kaveh R. Ghazi Committed by Kaveh Ghazi

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
parent ffee6d93
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.
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
......@@ -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
......
......@@ -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 ();
}
......
......@@ -517,7 +517,9 @@ java_parse_escape_sequence ()
}
}
int
static int yylex PARAMS ((YYSTYPE *));
static int
#ifdef JC1_LITE
yylex (java_lval)
#else
......
......@@ -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
......
......@@ -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
......@@ -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;
{
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment