Commit a1402da3 by Ranjit Mathew Committed by Ranjit Mathew

parse.y (parse_warning_context): Remove ATTRIBUTE_PRINTF_2 and rename parameter…

parse.y (parse_warning_context): Remove ATTRIBUTE_PRINTF_2 and rename parameter 'msg' to 'msgid' in function...

	* parse.y (parse_warning_context): Remove ATTRIBUTE_PRINTF_2 and
	rename parameter 'msg' to 'msgid' in function declaration.
	(issue_warning_error_from_context): Likewise.
	(yyerror): Rename parameter 'msg' to 'msgid'.
	(all over): Use new quoting style for diagnostics.

	* check-init.c: Use %<, %> and %q for quoting in diagnostics,
	if possible, else convert `foo' to 'foo'.
	* class.c: Likewise.
	* decl.c: Likewise.
	* expr.c: Likewise.
	* jcf-io.c: Likewise.
	* jcf-parse.c: Likewise.
	* lang.c: Likewise.
	* lex.c: Likewise.
	* parse.h: Likewise.

From-SVN: r89110
parent e68a07e8
2004-10-16 Ranjit Mathew <rmathew@hotmail.com>
* check-init.c: Use %<, %> and %q for quoting in diagnostics,
if possible, else convert `foo' to 'foo'.
* class.c: Likewise.
* decl.c: Likewise.
* expr.c: Likewise.
* jcf-io.c: Likewise.
* jcf-parse.c: Likewise.
* lang.c: Likewise.
* lex.c: Likewise.
* parse.h: Likewise.
2004-10-16 Ranjit Mathew <rmathew@hotmail.com>
* parse.y (parse_warning_context): Remove ATTRIBUTE_PRINTF_2 and
rename parameter 'msg' to 'msgid' in function declaration.
(issue_warning_error_from_context): Likewise.
(yyerror): Rename parameter 'msg' to 'msgid'.
(all over): Use new quoting style for diagnostics.
2004-10-15 Kazu Hirata <kazu@cs.umass.edu> 2004-10-15 Kazu Hirata <kazu@cs.umass.edu>
* boehm.c, builtins.c, java-except.h, jcf-io.c, jcf-path.c, * boehm.c, builtins.c, java-except.h, jcf-io.c, jcf-path.c,
......
...@@ -197,9 +197,9 @@ get_variable_decl (tree exp) ...@@ -197,9 +197,9 @@ get_variable_decl (tree exp)
static void static void
final_assign_error (tree name) final_assign_error (tree name)
{ {
static const char format[] parse_error_context (wfl,
= "Can't reassign a value to the final variable `%s'"; "Can't reassign a value to the final variable %qs",
parse_error_context (wfl, format, IDENTIFIER_POINTER (name)); IDENTIFIER_POINTER (name));
} }
static void static void
...@@ -466,7 +466,7 @@ check_init (tree exp, words before) ...@@ -466,7 +466,7 @@ check_init (tree exp, words before)
&& index >= 0 && ! ASSIGNED_P (before, index)) && index >= 0 && ! ASSIGNED_P (before, index))
{ {
parse_error_context parse_error_context
(wfl, "Variable `%s' may not have been initialized", (wfl, "Variable %qs may not have been initialized",
IDENTIFIER_POINTER (DECL_NAME (exp))); IDENTIFIER_POINTER (DECL_NAME (exp)));
/* Suppress further errors. */ /* Suppress further errors. */
DECL_BIT_INDEX (exp) = -2; DECL_BIT_INDEX (exp) = -2;
...@@ -482,7 +482,7 @@ check_init (tree exp, words before) ...@@ -482,7 +482,7 @@ check_init (tree exp, words before)
if (index >= 0 && ! ASSIGNED_P (before, index)) if (index >= 0 && ! ASSIGNED_P (before, index))
{ {
parse_error_context parse_error_context
(wfl, "variable `%s' may not have been initialized", (wfl, "variable %qs may not have been initialized",
IDENTIFIER_POINTER (DECL_NAME (tmp))); IDENTIFIER_POINTER (DECL_NAME (tmp)));
/* Suppress further errors. */ /* Suppress further errors. */
DECL_BIT_INDEX (tmp) = -2; DECL_BIT_INDEX (tmp) = -2;
...@@ -965,7 +965,7 @@ check_for_initialization (tree body, tree mdecl) ...@@ -965,7 +965,7 @@ check_for_initialization (tree body, tree mdecl)
if (index >= 0 && ! ASSIGNED_P (before, index)) if (index >= 0 && ! ASSIGNED_P (before, index))
{ {
if (! is_finit_method) if (! is_finit_method)
error ("%Jfinal field `%D' may not have been initialized", error ("%Jfinal field %qD may not have been initialized",
decl, decl); decl, decl);
} }
else if (is_finit_method) else if (is_finit_method)
......
...@@ -2034,7 +2034,7 @@ layout_class (tree this_class) ...@@ -2034,7 +2034,7 @@ layout_class (tree this_class)
char *report; char *report;
tree current; tree current;
sprintf (buffer, " with `%s'", sprintf (buffer, " with '%s'",
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (this_class)))); IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (this_class))));
obstack_grow (&temporary_obstack, buffer, strlen (buffer)); obstack_grow (&temporary_obstack, buffer, strlen (buffer));
...@@ -2042,7 +2042,7 @@ layout_class (tree this_class) ...@@ -2042,7 +2042,7 @@ layout_class (tree this_class)
current = TREE_CHAIN (current)) current = TREE_CHAIN (current))
{ {
tree decl = TYPE_NAME (TREE_PURPOSE (current)); tree decl = TYPE_NAME (TREE_PURPOSE (current));
sprintf (buffer, "\n which inherits from `%s' (%s:%d)", sprintf (buffer, "\n which inherits from '%s' (%s:%d)",
IDENTIFIER_POINTER (DECL_NAME (decl)), IDENTIFIER_POINTER (DECL_NAME (decl)),
DECL_SOURCE_FILE (decl), DECL_SOURCE_FILE (decl),
DECL_SOURCE_LINE (decl)); DECL_SOURCE_LINE (decl));
......
...@@ -1196,10 +1196,10 @@ pushdecl (tree x) ...@@ -1196,10 +1196,10 @@ pushdecl (tree x)
&& chain_member (oldlocal, current_binding_level->level_chain->names)) && chain_member (oldlocal, current_binding_level->level_chain->names))
{ {
if (TREE_CODE (oldlocal) == PARM_DECL) if (TREE_CODE (oldlocal) == PARM_DECL)
pedwarn ("declaration of `%s' shadows a parameter", pedwarn ("declaration of %qs shadows a parameter",
IDENTIFIER_POINTER (name)); IDENTIFIER_POINTER (name));
else else
pedwarn ("declaration of `%s' shadows a symbol from the parameter list", pedwarn ("declaration of %qs shadows a symbol from the parameter list",
IDENTIFIER_POINTER (name)); IDENTIFIER_POINTER (name));
} }
...@@ -1221,12 +1221,12 @@ pushdecl (tree x) ...@@ -1221,12 +1221,12 @@ pushdecl (tree x)
but there is no way to tell it's not a definition. */ but there is no way to tell it's not a definition. */
; ;
else if (oldlocal != 0 && TREE_CODE (oldlocal) == PARM_DECL) else if (oldlocal != 0 && TREE_CODE (oldlocal) == PARM_DECL)
warnstring = "declaration of `%s' shadows a parameter"; warnstring = "declaration of %qs shadows a parameter";
else if (oldlocal != 0) else if (oldlocal != 0)
warnstring = "declaration of `%s' shadows previous local"; warnstring = "declaration of %qs shadows previous local";
else if (IDENTIFIER_GLOBAL_VALUE (name) != 0 else if (IDENTIFIER_GLOBAL_VALUE (name) != 0
&& IDENTIFIER_GLOBAL_VALUE (name) != error_mark_node) && IDENTIFIER_GLOBAL_VALUE (name) != error_mark_node)
warnstring = "declaration of `%s' shadows global declaration"; warnstring = "declaration of %qs shadows global declaration";
if (warnstring) if (warnstring)
warning (warnstring, IDENTIFIER_POINTER (name)); warning (warnstring, IDENTIFIER_POINTER (name));
......
...@@ -1486,7 +1486,7 @@ lookup_field (tree *typep, tree name) ...@@ -1486,7 +1486,7 @@ lookup_field (tree *typep, tree name)
{ {
tree i1 = DECL_CONTEXT (save_field); tree i1 = DECL_CONTEXT (save_field);
tree i2 = DECL_CONTEXT (field); tree i2 = DECL_CONTEXT (field);
error ("reference `%s' is ambiguous: appears in interface `%s' and interface `%s'", error ("reference %qs is ambiguous: appears in interface %qs and interface %qs",
IDENTIFIER_POINTER (name), IDENTIFIER_POINTER (name),
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (i1))), IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (i1))),
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (i2)))); IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (i2))));
...@@ -1514,7 +1514,7 @@ build_field_ref (tree self_value, tree self_class, tree name) ...@@ -1514,7 +1514,7 @@ build_field_ref (tree self_value, tree self_class, tree name)
tree field_decl = lookup_field (&base_class, name); tree field_decl = lookup_field (&base_class, name);
if (field_decl == NULL_TREE) if (field_decl == NULL_TREE)
{ {
error ("field `%s' not found", IDENTIFIER_POINTER (name)); error ("field %qs not found", IDENTIFIER_POINTER (name));
return error_mark_node; return error_mark_node;
} }
if (self_value == NULL_TREE) if (self_value == NULL_TREE)
...@@ -2428,7 +2428,7 @@ expand_java_field_op (int is_static, int is_putting, int field_ref_index) ...@@ -2428,7 +2428,7 @@ expand_java_field_op (int is_static, int is_putting, int field_ref_index)
else if (FIELD_STATIC (field_decl)) else if (FIELD_STATIC (field_decl))
{ {
if (!DECL_CLINIT_P (current_function_decl)) if (!DECL_CLINIT_P (current_function_decl))
warning ("%Jassignment to final static field `%D' not in " warning ("%Jassignment to final static field %qD not in "
"class initializer", "class initializer",
field_decl, field_decl); field_decl, field_decl);
} }
......
...@@ -532,7 +532,7 @@ find_class (const char *classname, int classname_length, JCF *jcf, ...@@ -532,7 +532,7 @@ find_class (const char *classname, int classname_length, JCF *jcf,
if (! java && ! class && java_buf.st_mtime > class_buf.st_mtime) if (! java && ! class && java_buf.st_mtime > class_buf.st_mtime)
{ {
if (flag_newer) if (flag_newer)
warning ("source file for class `%s' is newer than its matching class file. Source file `%s' used instead", classname, java_buffer); warning ("source file for class %qs is newer than its matching class file. Source file %qs used instead", classname, java_buffer);
class = -1; class = -1;
} }
......
...@@ -726,7 +726,7 @@ jcf_parse (JCF* jcf) ...@@ -726,7 +726,7 @@ jcf_parse (JCF* jcf)
-fforce-classes-archive-check was specified. */ -fforce-classes-archive-check was specified. */
if (!jcf->right_zip if (!jcf->right_zip
&& (!flag_emit_class_files || flag_force_classes_archive_check)) && (!flag_emit_class_files || flag_force_classes_archive_check))
fatal_error ("the `java.lang.Object' that was found in `%s' didn't have the special zero-length `gnu.gcj.gcj-compiled' attribute. This generally means that your classpath is incorrectly set. Use `info gcj \"Input Options\"' to see the info page describing how to set the classpath", jcf->filename); fatal_error ("the %<java.lang.Object%> that was found in %qs didn't have the special zero-length %<gnu.gcj.gcj-compiled%> attribute. This generally means that your classpath is incorrectly set. Use %<info gcj \"Input Options\"%> to see the info page describing how to set the classpath", jcf->filename);
} }
else else
all_class_list = tree_cons (NULL_TREE, all_class_list = tree_cons (NULL_TREE,
......
...@@ -526,7 +526,7 @@ java_print_error_function (diagnostic_context *context ATTRIBUTE_UNUSED, ...@@ -526,7 +526,7 @@ java_print_error_function (diagnostic_context *context ATTRIBUTE_UNUSED,
fprintf (stderr, "%s: ", file); fprintf (stderr, "%s: ", file);
last_error_function_context = DECL_CONTEXT (current_function_decl); last_error_function_context = DECL_CONTEXT (current_function_decl);
fprintf (stderr, "In class `%s':\n", fprintf (stderr, "In class '%s':\n",
lang_printable_name (last_error_function_context, 0)); lang_printable_name (last_error_function_context, 0));
} }
if (last_error_function != current_function_decl) if (last_error_function != current_function_decl)
...@@ -539,7 +539,7 @@ java_print_error_function (diagnostic_context *context ATTRIBUTE_UNUSED, ...@@ -539,7 +539,7 @@ java_print_error_function (diagnostic_context *context ATTRIBUTE_UNUSED,
else else
{ {
const char *name = lang_printable_name (current_function_decl, 2); const char *name = lang_printable_name (current_function_decl, 2);
fprintf (stderr, "In %s `%s':\n", fprintf (stderr, "In %s '%s':\n",
(DECL_CONSTRUCTOR_P (current_function_decl) ? "constructor" (DECL_CONSTRUCTOR_P (current_function_decl) ? "constructor"
: "method"), : "method"),
name); name);
......
...@@ -253,7 +253,7 @@ java_new_lexer (FILE *finput, const char *encoding) ...@@ -253,7 +253,7 @@ java_new_lexer (FILE *finput, const char *encoding)
} }
if (enc_error) if (enc_error)
fatal_error ("unknown encoding: `%s'\nThis might mean that your locale's encoding is not supported\nby your system's iconv(3) implementation. If you aren't trying\nto use a particular encoding for your input file, try the\n`--encoding=UTF-8' option", encoding); fatal_error ("unknown encoding: %qs\nThis might mean that your locale's encoding is not supported\nby your system's iconv(3) implementation. If you aren't trying\nto use a particular encoding for your input file, try the\n%<--encoding=UTF-8%> option", encoding);
return lex; return lex;
} }
......
...@@ -158,14 +158,14 @@ extern tree stabilize_reference (tree); ...@@ -158,14 +158,14 @@ extern tree stabilize_reference (tree);
{ \ { \
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 %s", \ "Discouraged redundant use of %qs modifier in declaration of %s", \
java_accstring_lookup (__modifier), arg); \ java_accstring_lookup (__modifier), arg); \
} }
#define OBSOLETE_MODIFIER_WARNING2(cl, flags, __modifier, arg1, arg2) \ #define OBSOLETE_MODIFIER_WARNING2(cl, flags, __modifier, arg1, arg2) \
{ \ { \
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 %s `%s'", \ "Discouraged redundant use of %qs modifier in declaration of %s %qs", \
java_accstring_lookup (__modifier), arg1, arg2);\ java_accstring_lookup (__modifier), arg1, arg2);\
} }
...@@ -349,12 +349,12 @@ enum { ...@@ -349,12 +349,12 @@ enum {
/* Standard error messages */ /* Standard error messages */
#define ERROR_CANT_CONVERT_TO_BOOLEAN(OPERATOR, NODE, TYPE) \ #define ERROR_CANT_CONVERT_TO_BOOLEAN(OPERATOR, NODE, TYPE) \
parse_error_context ((OPERATOR), \ parse_error_context ((OPERATOR), \
"Incompatible type for `%s'. Can't convert `%s' to boolean", \ "Incompatible type for %qs. Can't convert %qs to boolean", \
operator_string ((NODE)), lang_printable_name ((TYPE),0)) operator_string ((NODE)), lang_printable_name ((TYPE),0))
#define ERROR_CANT_CONVERT_TO_NUMERIC(OPERATOR, NODE, TYPE) \ #define ERROR_CANT_CONVERT_TO_NUMERIC(OPERATOR, NODE, TYPE) \
parse_error_context ((OPERATOR), \ parse_error_context ((OPERATOR), \
"Incompatible type for `%s'. Can't convert `%s' to numeric type", \ "Incompatible type for %qs. Can't convert %qs to numeric type", \
operator_string ((NODE)), lang_printable_name ((TYPE), 0)) operator_string ((NODE)), lang_printable_name ((TYPE), 0))
#define ERROR_CAST_NEEDED_TO_INTEGRAL(OPERATOR, NODE, TYPE) \ #define ERROR_CAST_NEEDED_TO_INTEGRAL(OPERATOR, NODE, TYPE) \
...@@ -362,19 +362,19 @@ do { \ ...@@ -362,19 +362,19 @@ do { \
tree _operator = (OPERATOR), _node = (NODE), _type = (TYPE); \ tree _operator = (OPERATOR), _node = (NODE), _type = (TYPE); \
if (JPRIMITIVE_TYPE_P (_type)) \ if (JPRIMITIVE_TYPE_P (_type)) \
parse_error_context (_operator, \ parse_error_context (_operator, \
"Incompatible type for `%s'. Explicit cast needed to convert `%s' to integral",\ "Incompatible type for %qs. Explicit cast needed to convert %qs to integral",\
operator_string(_node), \ operator_string(_node), \
lang_printable_name (_type, 0)); \ lang_printable_name (_type, 0)); \
else \ else \
parse_error_context (_operator, \ parse_error_context (_operator, \
"Incompatible type for `%s'. Can't convert `%s' to integral", \ "Incompatible type for %qs. Can't convert %qs to integral", \
operator_string(_node), \ operator_string(_node), \
lang_printable_name (_type, 0)); \ lang_printable_name (_type, 0)); \
} while (0) } while (0)
#define ERROR_VARIABLE_NOT_INITIALIZED(WFL, V) \ #define ERROR_VARIABLE_NOT_INITIALIZED(WFL, V) \
parse_error_context \ parse_error_context \
((WFL), "Variable `%s' may not have been initialized", \ ((WFL), "Variable %qs may not have been initialized", \
IDENTIFIER_POINTER (V)) IDENTIFIER_POINTER (V))
/* Definition for loop handling. This is Java's own definition of a /* Definition for loop handling. This is Java's own definition of a
......
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