From 4e46d7280db1a0ef856edbb4a9e9a2d310d8d2de Mon Sep 17 00:00:00 2001 From: ghazi Date: Fri, 31 Dec 1999 03:30:22 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31148 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/java/ChangeLog | 26 ++++++++++++++++++++++++++ gcc/java/class.c | 14 +++++++++----- gcc/java/expr.c | 3 +-- gcc/java/jcf-dump.c | 2 +- gcc/java/jcf-parse.c | 3 +-- gcc/java/jv-scan.c | 3 +-- gcc/java/jvgenmain.c | 2 ++ gcc/java/parse.c | 7 +++---- gcc/java/parse.h | 6 +++--- gcc/java/parse.y | 7 +++---- 10 files changed, 50 insertions(+), 23 deletions(-) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index b90c76b..9b68f75 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,5 +1,31 @@ 1999-12-30 Kaveh R. Ghazi + * 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 + * parse.h (ABSTRACT_CHECK, JCONSTRUCTOR_CHECK, ERROR_CANT_CONVERT_TO_BOOLEAN, ERROR_CANT_CONVERT_TO_NUMERIC, ERROR_CAST_NEEDED_TO_INTEGRAL): Avoid the use of ANSI string diff --git a/gcc/java/class.c b/gcc/java/class.c index e042c13..3e3cfe6 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -47,6 +47,7 @@ static void append_gpp_mangled_type PROTO ((struct obstack *, tree)); static tree mangle_static_field PROTO ((tree)); static void add_interface_do PROTO ((tree, tree, int)); static tree maybe_layout_super_class PROTO ((tree, tree)); +static int assume_compiled PROTO ((const char *)); static rtx registerClass_libfunc; @@ -75,6 +76,9 @@ typedef struct assume_compiled_node_struct struct assume_compiled_node_struct *child; } 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. */ 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 appropriate node does not exist. */ -assume_compiled_node * +static assume_compiled_node * find_assume_compiled_node (node, ident) assume_compiled_node *node; const char *ident; @@ -131,9 +135,9 @@ add_assume_compiled (ident, excludep) { assume_compiled_node *parent; 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->child = NULL; @@ -142,7 +146,7 @@ add_assume_compiled (ident, excludep) if (NULL == 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->excludep = 0; assume_compiled_tree->sibling = NULL; @@ -176,7 +180,7 @@ add_assume_compiled (ident, excludep) /* Returns non-zero if IDENT is the name of a class that the compiler should assume has been compiled to FIXME */ -int +static int assume_compiled (ident) const char *ident; { diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 1b8d1a1..ffeddd6 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -1820,8 +1820,7 @@ expand_java_field_op (is_static, is_putting, field_ref_index) tree cfndecl_name = DECL_NAME (current_function_decl); if (! DECL_CONSTRUCTOR_P (current_function_decl) && (cfndecl_name != finit_identifier_node)) - error_with_decl (field_decl, "assignment to final field `%s' " - "not in constructor"); + error_with_decl (field_decl, "assignment to final field `%s' not in constructor"); } } expand_assignment (field_ref, new_value, 0, 0); diff --git a/gcc/java/jcf-dump.c b/gcc/java/jcf-dump.c index becf747..8a66def 100644 --- a/gcc/java/jcf-dump.c +++ b/gcc/java/jcf-dump.c @@ -1018,7 +1018,7 @@ DEFUN(disassemble_method, (jcf, byte_ops, len), #define ARRAY_NEW(TYPE) ARRAY_NEW_##TYPE #define ARRAY_NEW_NUM \ INT_temp = IMMEDIATE_u1; \ - { switch (INT_temp) { \ + { switch ((int) INT_temp) { \ case 4: fputs (" boolean", out); break; \ case 5: fputs (" char", out); break; \ case 6: fputs (" float", out); break; \ diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index c182789..b1c818a 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -825,8 +825,7 @@ yyparse () { char *saved_input_filename = input_filename; input_filename = value; - warning ("source file seen twice on command line and will be " - "compiled only once."); + warning ("source file seen twice on command line and will be compiled only once."); input_filename = saved_input_filename; } else diff --git a/gcc/java/jv-scan.c b/gcc/java/jv-scan.c index 21970d7..0e07f42 100644 --- a/gcc/java/jv-scan.c +++ b/gcc/java/jv-scan.c @@ -99,8 +99,7 @@ DEFUN (main, (argc, argv), /* Check on bad usage */ if (flag_find_main && flag_dump_class) - fatal ("Options `--print-main' and `--list-class' can't be turned on " - "at the same time"); + fatal ("Options `--print-main' and `--list-class' can't be turned on at the same time"); if (output_file && !(out = fopen (output_file, "w"))) fatal ("Can't open output file `%s'", output_file); diff --git a/gcc/java/jvgenmain.c b/gcc/java/jvgenmain.c index fc0aa94..9c17455 100644 --- a/gcc/java/jvgenmain.c +++ b/gcc/java/jvgenmain.c @@ -79,6 +79,8 @@ gcc_obstack_init (obstack) (void (*) PROTO((void *))) OBSTACK_CHUNK_FREE); } +static void usage (const char *) ATTRIBUTE_NORETURN; + static void usage (const char *name) { diff --git a/gcc/java/parse.c b/gcc/java/parse.c index b2b8235..13d63ed 100644 --- a/gcc/java/parse.c +++ b/gcc/java/parse.c @@ -6252,7 +6252,7 @@ verify_constructor_circularity (meth, current) for (liste = list; liste; liste = TREE_CHAIN (liste)) { parse_error_context - (TREE_PURPOSE (TREE_PURPOSE (liste)), + (TREE_PURPOSE (TREE_PURPOSE (liste)), "%s", constructor_circularity_msg (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste)))); java_error_count--; @@ -7618,9 +7618,8 @@ java_check_abstract_methods (interface_decl) IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); free (t); - continue; - DECL_NAME (found) = saved_found_wfl; + continue; } } @@ -10224,7 +10223,7 @@ lookup_method_invoke (lc, cl, class, name, arg_list) method = make_node (FUNCTION_TYPE); TYPE_ARG_TYPES (method) = atl; 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", (lc ? "constructor" : "method"), (lc ? dup : IDENTIFIER_POINTER (name)), diff --git a/gcc/java/parse.h b/gcc/java/parse.h index 0221598..c875592 100644 --- a/gcc/java/parse.h +++ b/gcc/java/parse.h @@ -138,12 +138,12 @@ extern tree stabilize_reference PROTO ((tree)); /* Pedantic warning on obsolete modifiers. Note: when cl is NULL, 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, \ "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. */ diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 9e4b4c0..49118ce 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -3649,7 +3649,7 @@ verify_constructor_circularity (meth, current) for (liste = list; liste; liste = TREE_CHAIN (liste)) { parse_error_context - (TREE_PURPOSE (TREE_PURPOSE (liste)), + (TREE_PURPOSE (TREE_PURPOSE (liste)), "%s", constructor_circularity_msg (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste)))); java_error_count--; @@ -5015,9 +5015,8 @@ java_check_abstract_methods (interface_decl) IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found))))); free (t); - continue; - DECL_NAME (found) = saved_found_wfl; + continue; } } @@ -7621,7 +7620,7 @@ lookup_method_invoke (lc, cl, class, name, arg_list) method = make_node (FUNCTION_TYPE); TYPE_ARG_TYPES (method) = atl; 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", (lc ? "constructor" : "method"), (lc ? dup : IDENTIFIER_POINTER (name)), -- 2.7.4