+2003-06-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ * diagnostic.h (diagnostic_set_info): Replace file and lineno
+ parameters with a location_t.
+ * diagnostic.c (diagnostic_set_info): Replace file and lineno
+ parameters with a location_t.
+ (inform, warning, pedwarn, error, sorry, fatal_error,
+ internal_error, warning_with_decl, pedwarn_with_decl,
+ error_with_decl): Adjust.
+ * c-error.c (pedwarn_c99): Adjust.
+ * c-format.c (status_warning): Adjust.
+ * rtl-error.c (file_and_line_for_asm): Rename to ...
+ (location_for_asm): Return a location_t.
+ (diagnostic_for_asm): Adjust.
+
2003-06-28 Neil Booth <neil@daikokuya.co.uk>
* cpptrad.c (skip_macro_block_comment): New.
va_list ap;
va_start (ap, msgid);
- diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
+ diagnostic_set_info (&diagnostic, msgid, &ap, input_location,
flag_isoc99 ? pedantic_error_kind () : DK_WARNING);
report_diagnostic (&diagnostic);
va_end (ap);
{
/* This duplicates the warning function behavior. */
diagnostic_set_info (&diagnostic, _(msgid), &ap,
- input_filename, input_line, DK_WARNING);
+ input_location, DK_WARNING);
report_diagnostic (&diagnostic);
}
+2003-06-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ * cp-tree.h (cp_line_of, cp_file_of): Remove.
+ * error.c (cp_line_of, cp_file_of): Merge into ...
+ (location_of): ... here. Make static, return a location_t.
+ (cp_error_at, cp_warning_at, cp_pedwarn_at): Adjust.
+
2003-06-28 Nathan Sidwell <nathan@codesourcery.com>
PR c++/10784
extern const char *expr_as_string (tree, int);
extern const char *context_as_string (tree, int);
extern const char *lang_decl_name (tree, int);
-extern const char *cp_file_of (tree);
-extern int cp_line_of (tree);
extern const char *language_to_string (enum languages, int);
extern void print_instantiation_context (void);
static void print_non_consecutive_character (output_buffer *, int);
static void print_integer (output_buffer *, HOST_WIDE_INT);
static tree locate_error (const char *, va_list);
+static location_t location_of (tree);
void
init_error (void)
return output_finalize_message (scratch_buffer);
}
-const char *
-cp_file_of (tree t)
+static location_t
+location_of (tree t)
{
if (TREE_CODE (t) == PARM_DECL && DECL_CONTEXT (t))
- return DECL_SOURCE_FILE (DECL_CONTEXT (t));
+ t = DECL_CONTEXT (t);
else if (TYPE_P (t))
- return DECL_SOURCE_FILE (TYPE_MAIN_DECL (t));
- else if (TREE_CODE (t) == OVERLOAD)
- return DECL_SOURCE_FILE (OVL_FUNCTION (t));
- else
- return DECL_SOURCE_FILE (t);
-}
-
-int
-cp_line_of (tree t)
-{
- int line = 0;
- if (TREE_CODE (t) == PARM_DECL && DECL_CONTEXT (t))
- line = DECL_SOURCE_LINE (DECL_CONTEXT (t));
- if (TREE_CODE (t) == TYPE_DECL && DECL_ARTIFICIAL (t)
- && TYPE_MAIN_DECL (TREE_TYPE (t)))
- t = TREE_TYPE (t);
-
- if (TYPE_P (t))
- line = DECL_SOURCE_LINE (TYPE_MAIN_DECL (t));
+ t = TYPE_MAIN_DECL (t);
else if (TREE_CODE (t) == OVERLOAD)
- line = DECL_SOURCE_LINE (OVL_FUNCTION (t));
- else
- line = DECL_SOURCE_LINE (t);
-
- if (line == 0)
- return input_line;
-
- return line;
+ t = OVL_FUNCTION (t);
+
+ return DECL_SOURCE_LOCATION (t);
}
/* Now the interfaces from error et al to dump_type et al. Each takes an
va_start (ap, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap,
- cp_file_of (here), cp_line_of (here), DK_ERROR);
+ location_of (here), DK_ERROR);
report_diagnostic (&diagnostic);
va_end (ap);
}
va_start (ap, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap,
- cp_file_of (here), cp_line_of (here), DK_WARNING);
+ location_of (here), DK_WARNING);
report_diagnostic (&diagnostic);
va_end (ap);
}
va_start (ap, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap,
- cp_file_of (here), cp_line_of (here),
- pedantic_error_kind());
+ location_of (here), pedantic_error_kind());
report_diagnostic (&diagnostic);
va_end (ap);
}
void
diagnostic_set_info (diagnostic_info *diagnostic, const char *msgid,
- va_list *args, const char *file, int line,
+ va_list *args, location_t location,
diagnostic_t kind)
{
diagnostic->message.err_no = errno;
diagnostic->message.args_ptr = args;
diagnostic->message.format_spec = _(msgid);
/* If the diagnostic message doesn't specify a location,
- use FILE and LINE. */
+ use LOCATION. */
if (!text_specifies_location (&diagnostic->message, &diagnostic->location))
- {
- diagnostic->location.file = file;
- diagnostic->location.line = line;
- }
+ diagnostic->location = location;
diagnostic->kind = kind;
}
va_list ap;
va_start (ap, msgid);
- diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
- DK_NOTE);
+ diagnostic_set_info (&diagnostic, msgid, &ap, input_location, DK_NOTE);
report_diagnostic (&diagnostic);
va_end (ap);
}
va_list ap;
va_start (ap, msgid);
- diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
- DK_WARNING);
+ diagnostic_set_info (&diagnostic, msgid, &ap, input_location, DK_WARNING);
report_diagnostic (&diagnostic);
va_end (ap);
}
va_list ap;
va_start (ap, msgid);
- diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
- pedantic_error_kind ());
+ diagnostic_set_info (&diagnostic, msgid, &ap, input_location,
+ pedantic_error_kind ());
report_diagnostic (&diagnostic);
va_end (ap);
}
va_list ap;
va_start (ap, msgid);
- diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
- DK_ERROR);
+ diagnostic_set_info (&diagnostic, msgid, &ap, input_location, DK_ERROR);
report_diagnostic (&diagnostic);
va_end (ap);
}
va_list ap;
va_start (ap, msgid);
- diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
- DK_SORRY);
+ diagnostic_set_info (&diagnostic, msgid, &ap, input_location, DK_SORRY);
report_diagnostic (&diagnostic);
va_end (ap);
}
va_list ap;
va_start (ap, msgid);
- diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
- DK_FATAL);
+ diagnostic_set_info (&diagnostic, msgid, &ap, input_location, DK_FATAL);
report_diagnostic (&diagnostic);
va_end (ap);
va_list ap;
va_start (ap, msgid);
- diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
- DK_ICE);
+ diagnostic_set_info (&diagnostic, msgid, &ap, input_location, DK_ICE);
report_diagnostic (&diagnostic);
va_end (ap);
return;
diagnostic_set_info (&diagnostic, msgid, &ap,
- DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl),
- DK_WARNING);
+ DECL_SOURCE_LOCATION (decl), DK_WARNING);
diagnostic_for_decl (global_dc, &diagnostic, decl);
va_end (ap);
}
return;
diagnostic_set_info (&diagnostic, msgid, &ap,
- DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl),
- pedantic_error_kind ());
+ DECL_SOURCE_LOCATION (decl), pedantic_error_kind ());
diagnostic_for_decl (global_dc, &diagnostic, decl);
va_end (ap);
va_start (ap, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap,
- DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl),
- DK_ERROR);
+ DECL_SOURCE_LOCATION (decl), DK_ERROR);
diagnostic_for_decl (global_dc, &diagnostic, decl);
va_end (ap);
}
extern void diagnostic_report_diagnostic (diagnostic_context *,
diagnostic_info *);
extern void diagnostic_set_info (diagnostic_info *, const char *, va_list *,
- const char *, int, diagnostic_t);
+ location_t, diagnostic_t);
extern char *diagnostic_build_prefix (diagnostic_info *);
/* Pure text formatting support functions. */
#include "intl.h"
#include "diagnostic.h"
-static void file_and_line_for_asm PARAMS ((rtx, const char **, int *));
+static location_t location_for_asm PARAMS ((rtx));
static void diagnostic_for_asm PARAMS ((rtx, const char *, va_list *,
diagnostic_t));
-/* Figure file and line of the given INSN. */
-static void
-file_and_line_for_asm (insn, pfile, pline)
+/* Figure the location of the given INSN. */
+static location_t
+location_for_asm (insn)
rtx insn;
- const char **pfile;
- int *pline;
{
rtx body = PATTERN (insn);
rtx asmop;
-
+ location_t loc;
+
/* Find the (or one of the) ASM_OPERANDS in the insn. */
if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
asmop = SET_SRC (body);
if (asmop)
{
- *pfile = ASM_OPERANDS_SOURCE_FILE (asmop);
- *pline = ASM_OPERANDS_SOURCE_LINE (asmop);
+ loc.file = ASM_OPERANDS_SOURCE_FILE (asmop);
+ loc.line = ASM_OPERANDS_SOURCE_LINE (asmop);
}
else
- {
- *pfile = input_filename;
- *pline = input_line;
- }
+ loc = input_location;
+ return loc;
}
/* Report a diagnostic MESSAGE (an errror or a WARNING) at the line number
diagnostic_t kind;
{
diagnostic_info diagnostic;
-
- diagnostic_set_info (&diagnostic, msg, args_ptr, NULL, 0, kind);
- file_and_line_for_asm (insn, &diagnostic.location.file,
- &diagnostic.location.line);
+
+ diagnostic_set_info (&diagnostic, msg, args_ptr,
+ location_for_asm (insn), kind);
report_diagnostic (&diagnostic);
}
+2003-06-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ * g++.old-deja/g++.robertl/eb133.C: Set expected line number.
+ * g++.old-deja/g++.robertl/eb133a.C: Likewise.
+ * g++.old-deja/g++.robertl/eb133b.C: Likewise.
+
2003-06-28 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/execute/builtins/string-8.c: New test.
// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
// Reported against EGCS snaps 98/06/28.
+// { dg-error "forward declaration" "" { target *-*-* } 0 }
+
using namespace std;
int main()
{
try {
}
- catch (bad_alloc) { // { dg-error "" } parse error
+ catch (bad_alloc) { // { dg-error "invalid use" }
return 1;
}
return 0;
}
-
// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
// Reported against EGCS snaps 98/06/28.
+// { dg-error "forward declaration" "" { target *-*-* } 0 }
+
int main()
{
try {
// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
// Reported against EGCS snaps 98/06/28.
+// { dg-error "forward declaration" "" { target *-*-* } 0 }
+
using namespace std;
int main()
{
try {
}
- catch (bad_alloc) { // { dg-error "" } parse error
+ catch (bad_alloc) { // { dg-error "invalid use" }
return 1;
}
return 0;