+2004-10-05 Ranjit Mathew <rmathew@hotmail.com>
+
+ Prepare for %q, %< and %> in diagnostic message strings.
+ * java-tree.h (parse_error_context): remove ATTRIBUTE_PRINTF_2.
+ Name second parameter 'msgid'.
+ * parse.y: Additionally include pretty-print.h and diagnostic.h.
+ (issue_warning_error_from_context): Use pretty-printer functions
+ instead of vsprintf for constructing formatted messages. Rename
+ parameter 'msg' to 'msgid'.
+ (parse_error_context): Rename parameter 'msg' to 'msgid'.
+ (parse_warning_context): Likewise.
+
2004-10-05 Andrew Haley <aph@redhat.com>
PR java/17779
extern void lang_init_source (int);
extern void write_classfile (tree);
extern char *print_int_node (tree);
-extern void parse_error_context (tree cl, const char *, ...)
- ATTRIBUTE_PRINTF_2;
+extern void parse_error_context (tree cl, const char *msgid, ...);
extern void finish_class (void);
extern void java_layout_seen_class_methods (void);
extern void check_for_initialization (tree, tree);
#include "real.h"
#include "obstack.h"
#include "toplev.h"
+#include "pretty-print.h"
+#include "diagnostic.h"
#include "flags.h"
#include "java-tree.h"
#include "jcf.h"
#else
tree cl,
#endif
- const char *msg, va_list ap)
+ const char *msgid, va_list ap)
{
#ifdef USE_MAPPED_LOCATION
source_location saved_location = input_location;
const char *saved = ctxp->filename, *saved_input_filename;
#endif
char buffer [4096];
- vsprintf (buffer, msg, ap);
+ text_info text;
+
+ text.err_no = errno;
+ text.args_ptr = ≈
+ text.format_spec = msgid;
+ pp_format_text (global_dc->printer, &text);
+ strncpy (buffer, pp_formatted_text (global_dc->printer), sizeof (buffer) - 1);
+ buffer[sizeof (buffer) - 1] = '\0';
+ pp_clear_output_area (global_dc->printer);
+
force_error = 1;
#ifdef USE_MAPPED_LOCATION
FUTURE/FIXME: change cl to be a source_location. */
void
-parse_error_context (tree cl, const char *msg, ...)
+parse_error_context (tree cl, const char *msgid, ...)
{
va_list ap;
- va_start (ap, msg);
+ va_start (ap, msgid);
#ifdef USE_MAPPED_LOCATION
- issue_warning_error_from_context (EXPR_LOCATION (cl), msg, ap);
+ issue_warning_error_from_context (EXPR_LOCATION (cl), msgid, ap);
#else
- issue_warning_error_from_context (cl, msg, ap);
+ issue_warning_error_from_context (cl, msgid, ap);
#endif
va_end (ap);
}
FUTURE/FIXME: change cl to be a source_location. */
static void
-parse_warning_context (tree cl, const char *msg, ...)
+parse_warning_context (tree cl, const char *msgid, ...)
{
va_list ap;
- va_start (ap, msg);
+ va_start (ap, msgid);
do_warning = 1;
#ifdef USE_MAPPED_LOCATION
- issue_warning_error_from_context (EXPR_LOCATION (cl), msg, ap);
+ issue_warning_error_from_context (EXPR_LOCATION (cl), msgid, ap);
#else
- issue_warning_error_from_context (cl, msg, ap);
+ issue_warning_error_from_context (cl, msgid, ap);
#endif
do_warning = 0;
va_end (ap);