Commit c63b98cd by Kaveh R. Ghazi Committed by Kaveh Ghazi

class.c (assume_compiled, [...]): Add static prototype.

	* class.c (assume_compiled, assume_compiled_node): Add static
	prototype.
	(add_assume_compiled): Use xmalloc/xstrdup, not malloc/strdup.

	* jcf-dump.c (ARRAY_NEW_NUM): Cast long to int in switch.

	* jvgenmain.c (usage): Add static prototype with ATTRIBUTE_NORETURN.

	* parse.h (OBSOLETE_MODIFIER_WARNING): Rename parameter `modifier'
	to `__modifier' to avoid stringifying it.

	* parse.y (verify_constructor_circularity): Don't call a variadic
	function with a non-literal format string.
	(java_check_abstract_methods): Move unreachable code inside
	`continue' statement.
	(lookup_method_invoke): Call xstrdup, not strdup.

	* expr.c (expand_java_field_op): Avoid the use of ANSI string
	concatenation.

	* jcf-parse.c (yyparse): Likewise.

	* jv-scan.c (main): Likewise.

From-SVN: r31148
parent 6bafd8b6
1999-12-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 1999-12-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* class.c (assume_compiled, assume_compiled_node): Add static
prototype.
(add_assume_compiled): Use xmalloc/xstrdup, not malloc/strdup.
* jcf-dump.c (ARRAY_NEW_NUM): Cast long to int in switch.
* jvgenmain.c (usage): Add static prototype with ATTRIBUTE_NORETURN.
* parse.h (OBSOLETE_MODIFIER_WARNING): Rename parameter `modifier'
to `__modifier' to avoid stringifying it.
* parse.y (verify_constructor_circularity): Don't call a variadic
function with a non-literal format string.
(java_check_abstract_methods): Move unreachable code inside
`continue' statement.
(lookup_method_invoke): Call xstrdup, not strdup.
* expr.c (expand_java_field_op): Avoid the use of ANSI string
concatenation.
* jcf-parse.c (yyparse): Likewise.
* jv-scan.c (main): Likewise.
1999-12-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* parse.h (ABSTRACT_CHECK, JCONSTRUCTOR_CHECK, * parse.h (ABSTRACT_CHECK, JCONSTRUCTOR_CHECK,
ERROR_CANT_CONVERT_TO_BOOLEAN, ERROR_CANT_CONVERT_TO_NUMERIC, ERROR_CANT_CONVERT_TO_BOOLEAN, ERROR_CANT_CONVERT_TO_NUMERIC,
ERROR_CAST_NEEDED_TO_INTEGRAL): Avoid the use of ANSI string ERROR_CAST_NEEDED_TO_INTEGRAL): Avoid the use of ANSI string
......
...@@ -47,6 +47,7 @@ static void append_gpp_mangled_type PROTO ((struct obstack *, tree)); ...@@ -47,6 +47,7 @@ static void append_gpp_mangled_type PROTO ((struct obstack *, tree));
static tree mangle_static_field PROTO ((tree)); static tree mangle_static_field PROTO ((tree));
static void add_interface_do PROTO ((tree, tree, int)); static void add_interface_do PROTO ((tree, tree, int));
static tree maybe_layout_super_class PROTO ((tree, tree)); static tree maybe_layout_super_class PROTO ((tree, tree));
static int assume_compiled PROTO ((const char *));
static rtx registerClass_libfunc; static rtx registerClass_libfunc;
...@@ -75,6 +76,9 @@ typedef struct assume_compiled_node_struct ...@@ -75,6 +76,9 @@ typedef struct assume_compiled_node_struct
struct assume_compiled_node_struct *child; struct assume_compiled_node_struct *child;
} assume_compiled_node; } assume_compiled_node;
static assume_compiled_node *find_assume_compiled_node
PROTO ((assume_compiled_node *, const char *));
/* This is the root of the include/exclude tree. */ /* This is the root of the include/exclude tree. */
static assume_compiled_node *assume_compiled_tree; static assume_compiled_node *assume_compiled_tree;
...@@ -83,7 +87,7 @@ static assume_compiled_node *assume_compiled_tree; ...@@ -83,7 +87,7 @@ static assume_compiled_node *assume_compiled_tree;
is IDENT. Start the search from NODE. Return NULL if an is IDENT. Start the search from NODE. Return NULL if an
appropriate node does not exist. */ appropriate node does not exist. */
assume_compiled_node * static assume_compiled_node *
find_assume_compiled_node (node, ident) find_assume_compiled_node (node, ident)
assume_compiled_node *node; assume_compiled_node *node;
const char *ident; const char *ident;
...@@ -131,9 +135,9 @@ add_assume_compiled (ident, excludep) ...@@ -131,9 +135,9 @@ add_assume_compiled (ident, excludep)
{ {
assume_compiled_node *parent; assume_compiled_node *parent;
assume_compiled_node *node = assume_compiled_node *node =
(assume_compiled_node *) malloc (sizeof (assume_compiled_node)); (assume_compiled_node *) xmalloc (sizeof (assume_compiled_node));
node->ident = strdup (ident); node->ident = xstrdup (ident);
node->excludep = excludep; node->excludep = excludep;
node->child = NULL; node->child = NULL;
...@@ -142,7 +146,7 @@ add_assume_compiled (ident, excludep) ...@@ -142,7 +146,7 @@ add_assume_compiled (ident, excludep)
if (NULL == assume_compiled_tree) if (NULL == assume_compiled_tree)
{ {
assume_compiled_tree = assume_compiled_tree =
(assume_compiled_node *) malloc (sizeof (assume_compiled_node)); (assume_compiled_node *) xmalloc (sizeof (assume_compiled_node));
assume_compiled_tree->ident = ""; assume_compiled_tree->ident = "";
assume_compiled_tree->excludep = 0; assume_compiled_tree->excludep = 0;
assume_compiled_tree->sibling = NULL; assume_compiled_tree->sibling = NULL;
...@@ -176,7 +180,7 @@ add_assume_compiled (ident, excludep) ...@@ -176,7 +180,7 @@ add_assume_compiled (ident, excludep)
/* Returns non-zero if IDENT is the name of a class that the compiler /* Returns non-zero if IDENT is the name of a class that the compiler
should assume has been compiled to FIXME */ should assume has been compiled to FIXME */
int static int
assume_compiled (ident) assume_compiled (ident)
const char *ident; const char *ident;
{ {
......
...@@ -1820,8 +1820,7 @@ expand_java_field_op (is_static, is_putting, field_ref_index) ...@@ -1820,8 +1820,7 @@ expand_java_field_op (is_static, is_putting, field_ref_index)
tree cfndecl_name = DECL_NAME (current_function_decl); tree cfndecl_name = DECL_NAME (current_function_decl);
if (! DECL_CONSTRUCTOR_P (current_function_decl) if (! DECL_CONSTRUCTOR_P (current_function_decl)
&& (cfndecl_name != finit_identifier_node)) && (cfndecl_name != finit_identifier_node))
error_with_decl (field_decl, "assignment to final field `%s' " error_with_decl (field_decl, "assignment to final field `%s' not in constructor");
"not in constructor");
} }
} }
expand_assignment (field_ref, new_value, 0, 0); expand_assignment (field_ref, new_value, 0, 0);
......
...@@ -1018,7 +1018,7 @@ DEFUN(disassemble_method, (jcf, byte_ops, len), ...@@ -1018,7 +1018,7 @@ DEFUN(disassemble_method, (jcf, byte_ops, len),
#define ARRAY_NEW(TYPE) ARRAY_NEW_##TYPE #define ARRAY_NEW(TYPE) ARRAY_NEW_##TYPE
#define ARRAY_NEW_NUM \ #define ARRAY_NEW_NUM \
INT_temp = IMMEDIATE_u1; \ INT_temp = IMMEDIATE_u1; \
{ switch (INT_temp) { \ { switch ((int) INT_temp) { \
case 4: fputs (" boolean", out); break; \ case 4: fputs (" boolean", out); break; \
case 5: fputs (" char", out); break; \ case 5: fputs (" char", out); break; \
case 6: fputs (" float", out); break; \ case 6: fputs (" float", out); break; \
......
...@@ -825,8 +825,7 @@ yyparse () ...@@ -825,8 +825,7 @@ yyparse ()
{ {
char *saved_input_filename = input_filename; char *saved_input_filename = input_filename;
input_filename = value; input_filename = value;
warning ("source file seen twice on command line and will be " warning ("source file seen twice on command line and will be compiled only once.");
"compiled only once.");
input_filename = saved_input_filename; input_filename = saved_input_filename;
} }
else else
......
...@@ -99,8 +99,7 @@ DEFUN (main, (argc, argv), ...@@ -99,8 +99,7 @@ DEFUN (main, (argc, argv),
/* Check on bad usage */ /* Check on bad usage */
if (flag_find_main && flag_dump_class) if (flag_find_main && flag_dump_class)
fatal ("Options `--print-main' and `--list-class' can't be turned on " fatal ("Options `--print-main' and `--list-class' can't be turned on at the same time");
"at the same time");
if (output_file && !(out = fopen (output_file, "w"))) if (output_file && !(out = fopen (output_file, "w")))
fatal ("Can't open output file `%s'", output_file); fatal ("Can't open output file `%s'", output_file);
......
...@@ -79,6 +79,8 @@ gcc_obstack_init (obstack) ...@@ -79,6 +79,8 @@ gcc_obstack_init (obstack)
(void (*) PROTO((void *))) OBSTACK_CHUNK_FREE); (void (*) PROTO((void *))) OBSTACK_CHUNK_FREE);
} }
static void usage (const char *) ATTRIBUTE_NORETURN;
static void static void
usage (const char *name) usage (const char *name)
{ {
......
...@@ -6252,7 +6252,7 @@ verify_constructor_circularity (meth, current) ...@@ -6252,7 +6252,7 @@ verify_constructor_circularity (meth, current)
for (liste = list; liste; liste = TREE_CHAIN (liste)) for (liste = list; liste; liste = TREE_CHAIN (liste))
{ {
parse_error_context parse_error_context
(TREE_PURPOSE (TREE_PURPOSE (liste)), (TREE_PURPOSE (TREE_PURPOSE (liste)), "%s",
constructor_circularity_msg constructor_circularity_msg
(TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste)))); (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste))));
java_error_count--; java_error_count--;
...@@ -7618,9 +7618,8 @@ java_check_abstract_methods (interface_decl) ...@@ -7618,9 +7618,8 @@ java_check_abstract_methods (interface_decl)
IDENTIFIER_POINTER IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
free (t); free (t);
continue;
DECL_NAME (found) = saved_found_wfl; DECL_NAME (found) = saved_found_wfl;
continue;
} }
} }
...@@ -10224,7 +10223,7 @@ lookup_method_invoke (lc, cl, class, name, arg_list) ...@@ -10224,7 +10223,7 @@ lookup_method_invoke (lc, cl, class, name, arg_list)
method = make_node (FUNCTION_TYPE); method = make_node (FUNCTION_TYPE);
TYPE_ARG_TYPES (method) = atl; TYPE_ARG_TYPES (method) = atl;
signature = build_java_argument_signature (method); signature = build_java_argument_signature (method);
dup = strdup (lang_printable_name (class, 0)); dup = xstrdup (lang_printable_name (class, 0));
parse_error_context (cl, "Can't find %s `%s(%s)' in type `%s'%s", parse_error_context (cl, "Can't find %s `%s(%s)' in type `%s'%s",
(lc ? "constructor" : "method"), (lc ? "constructor" : "method"),
(lc ? dup : IDENTIFIER_POINTER (name)), (lc ? dup : IDENTIFIER_POINTER (name)),
......
...@@ -138,12 +138,12 @@ extern tree stabilize_reference PROTO ((tree)); ...@@ -138,12 +138,12 @@ extern tree stabilize_reference PROTO ((tree));
/* Pedantic warning on obsolete modifiers. Note: when cl is NULL, /* Pedantic warning on obsolete modifiers. Note: when cl is NULL,
flags was set artificially, such as for a interface method */ flags was set artificially, such as for a interface method */
#define OBSOLETE_MODIFIER_WARNING(cl, flags, modifier, format, arg) \ #define OBSOLETE_MODIFIER_WARNING(cl, flags, __modifier, format, arg) \
{ \ { \
if (flag_redundant && (cl) && ((flags) & (modifier))) \ if (flag_redundant && (cl) && ((flags) & (__modifier))) \
parse_warning_context (cl, \ parse_warning_context (cl, \
"Discouraged redundant use of `%s' modifier in declaration of " format, \ "Discouraged redundant use of `%s' modifier in declaration of " format, \
java_accstring_lookup (modifier), arg); \ java_accstring_lookup (__modifier), arg); \
} }
/* Quickly build a temporary pointer on hypothetical type NAME. */ /* Quickly build a temporary pointer on hypothetical type NAME. */
......
...@@ -3649,7 +3649,7 @@ verify_constructor_circularity (meth, current) ...@@ -3649,7 +3649,7 @@ verify_constructor_circularity (meth, current)
for (liste = list; liste; liste = TREE_CHAIN (liste)) for (liste = list; liste; liste = TREE_CHAIN (liste))
{ {
parse_error_context parse_error_context
(TREE_PURPOSE (TREE_PURPOSE (liste)), (TREE_PURPOSE (TREE_PURPOSE (liste)), "%s",
constructor_circularity_msg constructor_circularity_msg
(TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste)))); (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste))));
java_error_count--; java_error_count--;
...@@ -5015,9 +5015,8 @@ java_check_abstract_methods (interface_decl) ...@@ -5015,9 +5015,8 @@ java_check_abstract_methods (interface_decl)
IDENTIFIER_POINTER IDENTIFIER_POINTER
(DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
free (t); free (t);
continue;
DECL_NAME (found) = saved_found_wfl; DECL_NAME (found) = saved_found_wfl;
continue;
} }
} }
...@@ -7621,7 +7620,7 @@ lookup_method_invoke (lc, cl, class, name, arg_list) ...@@ -7621,7 +7620,7 @@ lookup_method_invoke (lc, cl, class, name, arg_list)
method = make_node (FUNCTION_TYPE); method = make_node (FUNCTION_TYPE);
TYPE_ARG_TYPES (method) = atl; TYPE_ARG_TYPES (method) = atl;
signature = build_java_argument_signature (method); signature = build_java_argument_signature (method);
dup = strdup (lang_printable_name (class, 0)); dup = xstrdup (lang_printable_name (class, 0));
parse_error_context (cl, "Can't find %s `%s(%s)' in type `%s'%s", parse_error_context (cl, "Can't find %s `%s(%s)' in type `%s'%s",
(lc ? "constructor" : "method"), (lc ? "constructor" : "method"),
(lc ? dup : IDENTIFIER_POINTER (name)), (lc ? dup : IDENTIFIER_POINTER (name)),
......
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