diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2003-06-28 16:23:29 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2003-06-28 16:23:29 +0000 |
commit | 9a472a42247d099c512b6d992890f88643612c8c (patch) | |
tree | 38b43c524490adad24cd4d5c9105cbbdd3fca991 /gcc/cp | |
parent | debdeb5d7073803b2acc0f92a0c8b09d1cfde5e5 (diff) | |
download | gcc-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/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 2 | ||||
-rw-r--r-- | gcc/cp/error.c | 45 |
3 files changed, 18 insertions, 36 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 41ed269..16a909e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,12 @@ 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 * call.c (joust): Move warn_conversion check outwards. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 0e3a971..51243f9 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3820,8 +3820,6 @@ extern const char *decl_as_string (tree, int); 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); diff --git a/gcc/cp/error.c b/gcc/cp/error.c index cb7c44f..a5420a7 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -113,6 +113,7 @@ static bool cp_printer (output_buffer *, text_info *); 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) @@ -2121,40 +2122,17 @@ lang_decl_name (tree decl, int v) 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 @@ -2612,7 +2590,7 @@ cp_error_at (const char *msgid, ...) 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); } @@ -2630,7 +2608,7 @@ cp_warning_at (const char *msgid, ...) 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); } @@ -2648,8 +2626,7 @@ cp_pedwarn_at (const char *msgid, ...) 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); } |