aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2004-11-10 17:34:47 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2004-11-10 17:34:47 +0000
commitea1763b1e4fefce5f111b1f914a83e5e3577f444 (patch)
tree8829016c2ed4010c8ebc2fc7d926015013f72d69 /gcc/tree.c
parent22d8d62798a3ce51a7e328805593bf675eddf60f (diff)
downloadgcc-ea1763b1e4fefce5f111b1f914a83e5e3577f444.zip
gcc-ea1763b1e4fefce5f111b1f914a83e5e3577f444.tar.gz
gcc-ea1763b1e4fefce5f111b1f914a83e5e3577f444.tar.bz2
re PR c++/18143 (Duplicated thunk with a huge member in the hierarchy)
.: * tree.c (tree_check_failed): Emit general error if the list of node types is empty. cp: PR c++/18143 * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK): New. (struct lang_decl_flags): Add thunk_p flag. (struct lang_decl): Remove separate fixed_offset. Place cloned_function and fixed_offset into union. (DECL_CLONED_FUNCTION_P, DECL_CLONED_FUNCTION): Adjust. (DECL_THUNK_P, SET_DECL_THUNK_P): Adjust. (THUNK_FIXED_OFFSET): Adjust. * method.c (make_thunk): Adjust. From-SVN: r90399
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 3e40c2e..97adffa 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5402,8 +5402,9 @@ get_set_constructor_bytes (tree init, unsigned char *buffer, int wd_size)
#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
/* Complain that the tree code of NODE does not match the expected 0
- terminated list of trailing codes. FILE, LINE, and FUNCTION are of
- the caller. */
+ terminated list of trailing codes. The trailing code list can be
+ empty, for a more vague error message. FILE, LINE, and FUNCTION
+ are of the caller. */
void
tree_check_failed (const tree node, const char *file,
@@ -5418,22 +5419,27 @@ tree_check_failed (const tree node, const char *file,
while ((code = va_arg (args, int)))
length += 4 + strlen (tree_code_name[code]);
va_end (args);
- va_start (args, function);
- buffer = alloca (length);
- length = 0;
- while ((code = va_arg (args, int)))
+ if (length)
{
- if (length)
+ va_start (args, function);
+ length += strlen ("expected ");
+ buffer = alloca (length);
+ length = 0;
+ while ((code = va_arg (args, int)))
{
- strcpy (buffer + length, " or ");
- length += 4;
+ const char *prefix = length ? " or " : "expected ";
+
+ strcpy (buffer + length, prefix);
+ length += strlen (prefix);
+ strcpy (buffer + length, tree_code_name[code]);
+ length += strlen (tree_code_name[code]);
}
- strcpy (buffer + length, tree_code_name[code]);
- length += strlen (tree_code_name[code]);
+ va_end (args);
}
- va_end (args);
+ else
+ buffer = (char *)"unexpected node";
- internal_error ("tree check: expected %s, have %s in %s, at %s:%d",
+ internal_error ("tree check: %s, have %s in %s, at %s:%d",
buffer, tree_code_name[TREE_CODE (node)],
function, trim_filename (file), line);
}