diff options
author | Joseph Myers <joseph@codesourcery.com> | 2005-11-03 23:08:18 +0000 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2005-11-03 23:08:18 +0000 |
commit | 178b58b59e18dcb713ef8ed45f79ffa072c617a5 (patch) | |
tree | 4d26b7322a593e1c409570f2ca4e99dccb8dc759 /libcpp/include/cpplib.h | |
parent | b0ae01d7f9e4c7e93097856926facb7ce9505f1d (diff) | |
download | gcc-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 'libcpp/include/cpplib.h')
-rw-r--r-- | libcpp/include/cpplib.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h index 3c4d0d6..c5d8e85 100644 --- a/libcpp/include/cpplib.h +++ b/libcpp/include/cpplib.h @@ -435,6 +435,9 @@ struct cpp_options /* True means return pragmas as tokens rather than processing them directly. */ bool defer_pragmas; + + /* True means error callback should be used for diagnostics. */ + bool client_diagnostic; }; /* Callback for header lookup for HEADER, which is the name of a @@ -467,6 +470,11 @@ struct cpp_callbacks int (*valid_pch) (cpp_reader *, const char *, int); void (*read_pch) (cpp_reader *, const char *, int, const char *); missing_header_cb missing_header; + + /* Called to emit a diagnostic if client_diagnostic option is true. + This callback receives the translated message. */ + void (*error) (cpp_reader *, int, const char *, va_list) + ATTRIBUTE_PRINTF(3,0); }; /* Chain of directories to look for include files in. */ |