From 14ad1c62dffcce8c6a17f8def1d642e6655b2859 Mon Sep 17 00:00:00 2001 From: mmitchel Date: Fri, 1 Oct 1999 04:34:24 +0000 Subject: [PATCH] * method.c (emit_thunk): Don't crash when -fsyntax-only. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29748 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 2 ++ gcc/cp/method.c | 41 ++++++++++++++------------ gcc/testsuite/g++.old-deja/g++.other/syntax2.C | 28 ++++++++++++++++++ 3 files changed, 52 insertions(+), 19 deletions(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.other/syntax2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 85a03fea03e..4b40f8427bd 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,7 @@ 1999-09-30 Mark Mitchell + * method.c (emit_thunk): Don't crash when -fsyntax-only. + * cp-tree.h (lang_decl_flags): Add global_ctor_p and global_dtor_p. Add init_priority. (DECL_ACCESS): Adjust accordingly. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index f4eb396b94a..b2daeb2f4f6 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -2086,26 +2086,29 @@ emit_thunk (thunk_fndecl) TREE_SET_CODE (thunk_fndecl, FUNCTION_DECL); - { #ifdef ASM_OUTPUT_MI_THUNK - char *fnname; - current_function_decl = thunk_fndecl; - /* Make sure we build up its RTL before we go onto the - temporary obstack. */ - make_function_rtl (thunk_fndecl); - temporary_allocation (); - DECL_RESULT (thunk_fndecl) - = build_decl (RESULT_DECL, 0, integer_type_node); - fnname = XSTR (XEXP (DECL_RTL (thunk_fndecl), 0), 0); - init_function_start (thunk_fndecl, input_filename, lineno); - current_function_is_thunk = 1; - assemble_start_function (thunk_fndecl, fnname); - ASM_OUTPUT_MI_THUNK (asm_out_file, thunk_fndecl, delta, function); - assemble_end_function (thunk_fndecl, fnname); - permanent_allocation (1); - current_function_decl = 0; - current_function = 0; + if (!flag_syntax_only) + { + char *fnname; + current_function_decl = thunk_fndecl; + /* Make sure we build up its RTL before we go onto the + temporary obstack. */ + make_function_rtl (thunk_fndecl); + temporary_allocation (); + DECL_RESULT (thunk_fndecl) + = build_decl (RESULT_DECL, 0, integer_type_node); + fnname = XSTR (XEXP (DECL_RTL (thunk_fndecl), 0), 0); + init_function_start (thunk_fndecl, input_filename, lineno); + current_function_is_thunk = 1; + assemble_start_function (thunk_fndecl, fnname); + ASM_OUTPUT_MI_THUNK (asm_out_file, thunk_fndecl, delta, function); + assemble_end_function (thunk_fndecl, fnname); + permanent_allocation (1); + current_function_decl = 0; + current_function = 0; + } #else /* ASM_OUTPUT_MI_THUNK */ + { /* If we don't have the necessary macro for efficient thunks, generate a thunk function that just makes a call to the real function. Unfortunately, this doesn't work for varargs. */ @@ -2157,8 +2160,8 @@ emit_thunk (thunk_fndecl) output_inline_function (thunk_fndecl); permanent_allocation (1); } -#endif /* ASM_OUTPUT_MI_THUNK */ } +#endif /* ASM_OUTPUT_MI_THUNK */ TREE_SET_CODE (thunk_fndecl, THUNK_DECL); } diff --git a/gcc/testsuite/g++.old-deja/g++.other/syntax2.C b/gcc/testsuite/g++.old-deja/g++.other/syntax2.C new file mode 100644 index 00000000000..5775af0d261 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/syntax2.C @@ -0,0 +1,28 @@ +// Build don't link: +// Special g++ Options: -fsyntax-only +// Origin: Mark Mitchell + +struct B +{ + double d; + + virtual void f (); +}; + +struct C: virtual public B +{ + char c; +}; + +struct D: virtual public B +{ + int i; + virtual void f (); +}; + +struct E : public C, public D +{ +}; + +E e; + -- 2.11.4.GIT