aboutsummaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2003-06-28 16:23:29 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2003-06-28 16:23:29 +0000
commit9a472a42247d099c512b6d992890f88643612c8c (patch)
tree38b43c524490adad24cd4d5c9105cbbdd3fca991 /gcc/diagnostic.c
parentdebdeb5d7073803b2acc0f92a0c8b09d1cfde5e5 (diff)
downloadgcc-9a472a42247d099c512b6d992890f88643612c8c.zip
gcc-9a472a42247d099c512b6d992890f88643612c8c.tar.gz
gcc-9a472a42247d099c512b6d992890f88643612c8c.tar.bz2
diagnostic.h (diagnostic_set_info): Replace file and lineno parameters with a location_t.
* 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. * cp/cp-tree.h (cp_line_of, cp_file_of): Remove. * cp/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. * testsuite/g++.old-deja/g++.robertl/eb133.C: Set expected line number. * testsuite/g++.old-deja/g++.robertl/eb133a.C: Likewise. * testsuite/g++.old-deja/g++.robertl/eb133b.C: Likewise. From-SVN: r68643
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c40
1 files changed, 14 insertions, 26 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 8e22a48..1312ca9 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -761,19 +761,16 @@ text_specifies_location (text_info *text, location_t *locus)
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;
}
@@ -1134,8 +1131,7 @@ inform (const char *msgid, ...)
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);
}
@@ -1149,8 +1145,7 @@ warning (const char *msgid, ...)
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);
}
@@ -1170,8 +1165,8 @@ pedwarn (const char *msgid, ...)
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);
}
@@ -1185,8 +1180,7 @@ error (const char *msgid, ...)
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);
}
@@ -1201,8 +1195,7 @@ sorry (const char *msgid, ...)
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);
}
@@ -1217,8 +1210,7 @@ fatal_error (const char *msgid, ...)
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);
@@ -1237,8 +1229,7 @@ internal_error (const char *msgid, ...)
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);
@@ -1263,8 +1254,7 @@ warning_with_decl (tree decl, const char *msgid, ...)
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);
}
@@ -1283,8 +1273,7 @@ pedwarn_with_decl (tree decl, const char *msgid, ...)
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);
@@ -1298,8 +1287,7 @@ error_with_decl (tree decl, const char *msgid, ...)
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);
}