aboutsummaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2005-11-03 23:08:18 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2005-11-03 23:08:18 +0000
commit178b58b59e18dcb713ef8ed45f79ffa072c617a5 (patch)
tree4d26b7322a593e1c409570f2ca4e99dccb8dc759 /gcc/diagnostic.c
parentb0ae01d7f9e4c7e93097856926facb7ce9505f1d (diff)
downloadgcc-178b58b59e18dcb713ef8ed45f79ffa072c617a5.zip
gcc-178b58b59e18dcb713ef8ed45f79ffa072c617a5.tar.gz
gcc-178b58b59e18dcb713ef8ed45f79ffa072c617a5.tar.bz2
re PR c++/17964 (cpp error messages contain wrong line in C++)
gcc: PR c++/17964 * diagnostic.c (diagnostic_set_info_translated): New function. (diagnostic_set_info): Use it. Add comment. * diagnostic.h (diagnostic_set_info_translated): Declare. gcc/cp: * error.c (cp_cpp_error): New function. * cp-tree.h (cp_cpp_error): Declare. * parser.c (cp_lexer_new_main): Set CPP option client_diagnostic and error callback after lexing. gcc/testsuite: * g++.dg/cpp/string-1.C: New test. libcpp: * include/cpplib.h (struct cpp_options): Add client_diagnostic. (struct cpp_callbacks): Add error. * errors.c (cpp_error): If client_diagnostic, use error callback. * charset.c (convert_escape): Don't use %03o in diagnostic. From-SVN: r106454
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index c416010..7f4d814 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -112,19 +112,31 @@ diagnostic_initialize (diagnostic_context *context)
context->lock = 0;
}
+/* Initialize DIAGNOSTIC, where the message MSG has already been
+ translated. */
void
-diagnostic_set_info (diagnostic_info *diagnostic, const char *gmsgid,
- va_list *args, location_t location,
- diagnostic_t kind)
+diagnostic_set_info_translated (diagnostic_info *diagnostic, const char *msg,
+ va_list *args, location_t location,
+ diagnostic_t kind)
{
diagnostic->message.err_no = errno;
diagnostic->message.args_ptr = args;
- diagnostic->message.format_spec = _(gmsgid);
+ diagnostic->message.format_spec = msg;
diagnostic->location = location;
diagnostic->kind = kind;
diagnostic->option_index = 0;
}
+/* Initialize DIAGNOSTIC, where the message GMSGID has not yet been
+ translated. */
+void
+diagnostic_set_info (diagnostic_info *diagnostic, const char *gmsgid,
+ va_list *args, location_t location,
+ diagnostic_t kind)
+{
+ diagnostic_set_info_translated (diagnostic, _(gmsgid), args, location, kind);
+}
+
/* Return a malloc'd string describing a location. The caller is
responsible for freeing the memory. */
char *