1 /* Handle exceptional things in C++.
2 Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 2000, 2001 Free Software Foundation, Inc.
4 Contributed by Michael Tiemann <tiemann@cygnus.com>
5 Rewritten by Mike Stump <mrs@cygnus.com>, based upon an
6 initial re-implementation courtesy Tad Hunt.
8 This file is part of GNU CC.
10 GNU CC is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
15 GNU CC is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with GNU CC; see the file COPYING. If not, write to
22 the Free Software Foundation, 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
38 static void push_eh_cleanup
PARAMS ((tree
));
39 static tree prepare_eh_type
PARAMS ((tree
));
40 static tree build_eh_type_type
PARAMS ((tree
));
41 static tree do_begin_catch
PARAMS ((void));
42 static int dtor_nothrow
PARAMS ((tree
));
43 static tree do_end_catch
PARAMS ((tree
));
44 static void push_eh_cleanup
PARAMS ((tree
));
45 static bool decl_is_java_type
PARAMS ((tree decl
, int err
));
46 static void initialize_handler_parm
PARAMS ((tree
, tree
));
47 static tree do_allocate_exception
PARAMS ((tree
));
48 static int complete_ptr_ref_or_void_ptr_p
PARAMS ((tree
, tree
));
49 static bool is_admissible_throw_operand
PARAMS ((tree
));
50 static int can_convert_eh
PARAMS ((tree
, tree
));
51 static void check_handlers_1
PARAMS ((tree
, tree
));
52 static tree cp_protect_cleanup_actions
PARAMS ((void));
57 /* Sets up all the global eh stuff that needs to be initialized at the
58 start of compilation. */
61 init_exception_processing ()
65 /* void std::terminate (); */
66 push_namespace (std_identifier
);
67 tmp
= build_function_type (void_type_node
, void_list_node
);
68 terminate_node
= build_cp_library_fn_ptr ("terminate", tmp
);
69 TREE_THIS_VOLATILE (terminate_node
) = 1;
70 TREE_NOTHROW (terminate_node
) = 1;
73 /* void __cxa_call_unexpected(void *); */
74 tmp
= tree_cons (NULL_TREE
, ptr_type_node
, void_list_node
);
75 tmp
= build_function_type (void_type_node
, tmp
);
77 = push_throw_library_fn (get_identifier ("__cxa_call_unexpected"), tmp
);
79 eh_personality_libfunc
= init_one_libfunc (USING_SJLJ_EXCEPTIONS
80 ? "__gxx_personality_sj0"
81 : "__gxx_personality_v0");
83 lang_eh_runtime_type
= build_eh_type_type
;
84 lang_protect_cleanup_actions
= &cp_protect_cleanup_actions
;
87 /* Returns an expression to be executed if an unhandled exception is
88 propogated out of a cleanup region. */
91 cp_protect_cleanup_actions ()
95 When the destruction of an object during stack unwinding exits
96 using an exception ... void terminate(); is called. */
97 return build_call (terminate_node
, NULL_TREE
);
101 prepare_eh_type (type
)
104 if (type
== NULL_TREE
)
106 if (type
== error_mark_node
)
107 return error_mark_node
;
109 /* peel back references, so they match. */
110 if (TREE_CODE (type
) == REFERENCE_TYPE
)
111 type
= TREE_TYPE (type
);
113 /* Peel off cv qualifiers. */
114 type
= TYPE_MAIN_VARIANT (type
);
119 /* Build the address of a typeinfo decl for use in the runtime
120 matching field of the exception model. */
123 build_eh_type_type (type
)
128 if (type
== NULL_TREE
|| type
== error_mark_node
)
131 if (decl_is_java_type (type
, 0))
132 exp
= build_java_class_ref (TREE_TYPE (type
));
134 exp
= get_tinfo_decl (type
);
137 exp
= build1 (ADDR_EXPR
, ptr_type_node
, exp
);
145 return build (EXC_PTR_EXPR
, ptr_type_node
);
148 /* Build up a call to __cxa_begin_catch, to tell the runtime that the
149 exception has been handled. */
156 fn
= get_identifier ("__cxa_begin_catch");
157 if (IDENTIFIER_GLOBAL_VALUE (fn
))
158 fn
= IDENTIFIER_GLOBAL_VALUE (fn
);
161 /* Declare void* __cxa_begin_catch (void *). */
162 tree tmp
= tree_cons (NULL_TREE
, ptr_type_node
, void_list_node
);
163 fn
= push_library_fn (fn
, build_function_type (ptr_type_node
, tmp
));
166 return build_function_call (fn
, tree_cons (NULL_TREE
, build_exc_ptr (),
170 /* Returns nonzero if cleaning up an exception of type TYPE (which can be
171 NULL_TREE for a ... handler) will not throw an exception. */
179 if (type
== NULL_TREE
)
182 if (! TYPE_HAS_DESTRUCTOR (type
))
185 fn
= lookup_member (type
, dtor_identifier
, 0, 0);
186 fn
= TREE_VALUE (fn
);
187 return TREE_NOTHROW (fn
);
190 /* Build up a call to __cxa_end_catch, to destroy the exception object
191 for the current catch block if no others are currently using it. */
199 fn
= get_identifier ("__cxa_end_catch");
200 if (IDENTIFIER_GLOBAL_VALUE (fn
))
201 fn
= IDENTIFIER_GLOBAL_VALUE (fn
);
204 /* Declare void __cxa_end_catch (). */
205 fn
= push_void_library_fn (fn
, void_list_node
);
206 /* This can throw if the destructor for the exception throws. */
207 TREE_NOTHROW (fn
) = 0;
210 cleanup
= build_function_call (fn
, NULL_TREE
);
211 TREE_NOTHROW (cleanup
) = dtor_nothrow (type
);
216 /* This routine creates the cleanup for the current exception. */
219 push_eh_cleanup (type
)
222 finish_decl_cleanup (NULL_TREE
, do_end_catch (type
));
225 /* Return nonzero value if DECL is a Java type suitable for catch or
229 decl_is_java_type (decl
, err
)
233 bool r
= (TREE_CODE (decl
) == POINTER_TYPE
234 && TREE_CODE (TREE_TYPE (decl
)) == RECORD_TYPE
235 && TYPE_FOR_JAVA (TREE_TYPE (decl
)));
239 if (TREE_CODE (decl
) == REFERENCE_TYPE
240 && TREE_CODE (TREE_TYPE (decl
)) == RECORD_TYPE
241 && TYPE_FOR_JAVA (TREE_TYPE (decl
)))
243 /* Can't throw a reference. */
244 cp_error ("type `%T' is disallowed in Java `throw' or `catch'",
251 = IDENTIFIER_GLOBAL_VALUE (get_identifier ("jthrowable"));
253 if (jthrow_node
== NULL_TREE
)
255 ("call to Java `catch' or `throw' with `jthrowable' undefined");
257 jthrow_node
= TREE_TYPE (TREE_TYPE (jthrow_node
));
259 if (! DERIVED_FROM_P (jthrow_node
, TREE_TYPE (decl
)))
261 /* Thrown object must be a Throwable. */
262 cp_error ("type `%T' is not derived from `java::lang::Throwable'",
271 /* Select the personality routine to be used for exception handling,
272 or issue an error if we need two different ones in the same
274 ??? At present eh_personality_libfunc is set to
275 __gxx_personality_(sj|v)0 in init_exception_processing - should it
276 be done here instead? */
278 choose_personality_routine (lang
)
294 if (lang
!= lang_cplusplus
)
299 if (lang
!= lang_java
)
304 ; /* proceed to language selection */
315 eh_personality_libfunc
= init_one_libfunc (USING_SJLJ_EXCEPTIONS
316 ? "__gcj_personality_sj0"
317 : "__gcj_personality_v0");
326 error ("mixing C++ and Java catches in a single translation unit");
330 /* Initialize the catch parameter DECL. */
333 initialize_handler_parm (decl
, exp
)
340 /* Make sure we mark the catch param as used, otherwise we'll get a
341 warning about an unused ((anonymous)). */
342 TREE_USED (decl
) = 1;
344 /* Figure out the type that the initializer is. Pointers are returned
345 adjusted by value from __cxa_begin_catch. Others are returned by
347 init_type
= TREE_TYPE (decl
);
348 if (! TYPE_PTR_P (init_type
)
349 && TREE_CODE (init_type
) != REFERENCE_TYPE
)
350 init_type
= build_reference_type (init_type
);
352 choose_personality_routine (decl_is_java_type (init_type
, 0)
353 ? lang_java
: lang_cplusplus
);
355 /* Since pointers are passed by value, initialize a reference to
356 pointer catch parm with the address of the temporary. */
357 if (TREE_CODE (init_type
) == REFERENCE_TYPE
358 && TYPE_PTR_P (TREE_TYPE (init_type
)))
359 exp
= build_unary_op (ADDR_EXPR
, exp
, 1);
361 exp
= ocp_convert (init_type
, exp
, CONV_IMPLICIT
|CONV_FORCE_TEMP
, 0);
363 init
= convert_from_reference (exp
);
365 /* If the constructor for the catch parm exits via an exception, we
366 must call terminate. See eh23.C. */
367 if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl
)))
369 /* Generate the copy constructor call directly so we can wrap it.
370 See also expand_default_init. */
371 init
= ocp_convert (TREE_TYPE (decl
), init
,
372 CONV_IMPLICIT
|CONV_FORCE_TEMP
, 0);
373 init
= build1 (MUST_NOT_THROW_EXPR
, TREE_TYPE (init
), init
);
376 /* Let `cp_finish_decl' know that this initializer is ok. */
377 DECL_INITIAL (decl
) = error_mark_node
;
378 decl
= pushdecl (decl
);
381 cp_finish_decl (decl
, init
, NULL_TREE
,
382 LOOKUP_ONLYCONVERTING
|DIRECT_BIND
);
385 /* Call this to start a catch block. DECL is the catch parameter. */
388 expand_start_catch_block (decl
)
391 tree exp
= NULL_TREE
;
398 /* Make sure this declaration is reasonable. */
399 if (decl
&& !complete_ptr_ref_or_void_ptr_p (TREE_TYPE (decl
), NULL_TREE
))
403 type
= prepare_eh_type (TREE_TYPE (decl
));
412 if (decl_is_java_type (type
, 1))
414 /* Java only passes object via pointer and doesn't require
415 adjusting. The java object is immediately before the
416 generic exception header. */
417 init
= build_exc_ptr ();
418 init
= build1 (NOP_EXPR
, build_pointer_type (type
), init
);
419 init
= build (MINUS_EXPR
, TREE_TYPE (init
), init
,
420 TYPE_SIZE_UNIT (TREE_TYPE (init
)));
421 init
= build_indirect_ref (init
, NULL
);
426 /* C++ requires that we call __cxa_begin_catch to get the
427 pointer to the actual object. */
428 init
= do_begin_catch ();
431 exp
= create_temporary_var (ptr_type_node
);
432 DECL_REGISTER (exp
) = 1;
433 cp_finish_decl (exp
, init
, NULL_TREE
, LOOKUP_ONLYCONVERTING
);
434 finish_expr_stmt (build_modify_expr (exp
, INIT_EXPR
, init
));
437 finish_expr_stmt (do_begin_catch ());
439 /* C++ requires that we call __cxa_end_catch at the end of
440 processing the exception. */
442 push_eh_cleanup (type
);
445 initialize_handler_parm (decl
, exp
);
451 /* Call this to end a catch block. Its responsible for emitting the
452 code to handle jumping back to the correct place, and for emitting
453 the label to jump to if this catch block didn't match. */
456 expand_end_catch_block ()
461 /* The exception being handled is rethrown if control reaches the end of
462 a handler of the function-try-block of a constructor or destructor. */
463 if (in_function_try_handler
464 && (DECL_CONSTRUCTOR_P (current_function_decl
)
465 || DECL_DESTRUCTOR_P (current_function_decl
)))
466 finish_expr_stmt (build_throw (NULL_TREE
));
470 begin_eh_spec_block ()
472 tree r
= build_stmt (EH_SPEC_BLOCK
, NULL_TREE
, NULL_TREE
);
478 finish_eh_spec_block (raw_raises
, eh_spec_block
)
484 RECHAIN_STMTS (eh_spec_block
, EH_SPEC_STMTS (eh_spec_block
));
486 /* Strip cv quals, etc, from the specification types. */
487 for (raises
= NULL_TREE
;
488 raw_raises
&& TREE_VALUE (raw_raises
);
489 raw_raises
= TREE_CHAIN (raw_raises
))
490 raises
= tree_cons (NULL_TREE
, prepare_eh_type (TREE_VALUE (raw_raises
)),
493 EH_SPEC_RAISES (eh_spec_block
) = raises
;
496 /* Return a pointer to a buffer for an exception object of type TYPE. */
499 do_allocate_exception (type
)
504 fn
= get_identifier ("__cxa_allocate_exception");
505 if (IDENTIFIER_GLOBAL_VALUE (fn
))
506 fn
= IDENTIFIER_GLOBAL_VALUE (fn
);
509 /* Declare void *__cxa_allocate_exception(size_t). */
510 tree tmp
= tree_cons (NULL_TREE
, c_size_type_node
, void_list_node
);
511 fn
= push_library_fn (fn
, build_function_type (ptr_type_node
, tmp
));
514 return build_function_call (fn
, tree_cons (NULL_TREE
, size_in_bytes (type
),
519 /* Call __cxa_free_exception from a cleanup. This is never invoked
523 do_free_exception (ptr
)
528 fn
= get_identifier ("__cxa_free_exception");
529 if (IDENTIFIER_GLOBAL_VALUE (fn
))
530 fn
= IDENTIFIER_GLOBAL_VALUE (fn
);
533 /* Declare void __cxa_free_exception (void *). */
534 fn
= push_void_library_fn (fn
, tree_cons (NULL_TREE
, ptr_type_node
,
538 return build_function_call (fn
, tree_cons (NULL_TREE
, ptr
, NULL_TREE
));
542 /* Build a throw expression. */
550 if (exp
== error_mark_node
)
553 if (processing_template_decl
)
554 return build_min (THROW_EXPR
, void_type_node
, exp
);
556 if (exp
== null_node
)
557 cp_warning ("throwing NULL, which has integral, not pointer type");
559 if (exp
!= NULL_TREE
)
561 if (!is_admissible_throw_operand (exp
))
562 return error_mark_node
;
566 return error_mark_node
;
568 if (exp
&& decl_is_java_type (TREE_TYPE (exp
), 1))
570 tree fn
= get_identifier ("_Jv_Throw");
571 if (IDENTIFIER_GLOBAL_VALUE (fn
))
572 fn
= IDENTIFIER_GLOBAL_VALUE (fn
);
575 /* Declare void _Jv_Throw (void *). */
576 tree tmp
= tree_cons (NULL_TREE
, ptr_type_node
, void_list_node
);
577 tmp
= build_function_type (ptr_type_node
, tmp
);
578 fn
= push_throw_library_fn (fn
, tmp
);
581 exp
= build_function_call (fn
, tree_cons (NULL_TREE
, exp
, NULL_TREE
));
592 fn
= get_identifier ("__cxa_throw");
593 if (IDENTIFIER_GLOBAL_VALUE (fn
))
594 fn
= IDENTIFIER_GLOBAL_VALUE (fn
);
597 /* The CLEANUP_TYPE is the internal type of a destructor. */
598 if (cleanup_type
== NULL_TREE
)
600 tmp
= void_list_node
;
601 tmp
= tree_cons (NULL_TREE
, ptr_type_node
, tmp
);
602 tmp
= build_function_type (void_type_node
, tmp
);
603 cleanup_type
= build_pointer_type (tmp
);
606 /* Declare void __cxa_throw (void*, void*, void (*)(void*)). */
607 /* ??? Second argument is supposed to be "std::type_info*". */
608 tmp
= void_list_node
;
609 tmp
= tree_cons (NULL_TREE
, cleanup_type
, tmp
);
610 tmp
= tree_cons (NULL_TREE
, ptr_type_node
, tmp
);
611 tmp
= tree_cons (NULL_TREE
, ptr_type_node
, tmp
);
612 tmp
= build_function_type (void_type_node
, tmp
);
613 fn
= push_throw_library_fn (fn
, tmp
);
616 begin_init_stmts (&stmt_expr
, &compound_stmt
);
618 /* throw expression */
619 /* First, decay it. */
620 exp
= decay_conversion (exp
);
622 /* OK, this is kind of wacky. The standard says that we call
623 terminate when the exception handling mechanism, after
624 completing evaluation of the expression to be thrown but
625 before the exception is caught (_except.throw_), calls a
626 user function that exits via an uncaught exception.
628 So we have to protect the actual initialization of the
629 exception object with terminate(), but evaluate the
630 expression first. Since there could be temps in the
631 expression, we need to handle that, too. We also expand
632 the call to __cxa_allocate_exception first (which doesn't
633 matter, since it can't throw). */
635 my_friendly_assert (stmts_are_full_exprs_p () == 1, 19990926);
637 /* Store the throw expression into a temp. This can be less
638 efficient than storing it into the allocated space directly, but
639 if we allocated the space first we would have to deal with
640 cleaning it up if evaluating this expression throws. */
641 if (TREE_SIDE_EFFECTS (exp
))
643 tmp
= create_temporary_var (TREE_TYPE (exp
));
644 DECL_INITIAL (tmp
) = exp
;
645 cp_finish_decl (tmp
, exp
, NULL_TREE
, LOOKUP_ONLYCONVERTING
);
649 /* Allocate the space for the exception. */
650 ptr
= create_temporary_var (ptr_type_node
);
651 DECL_REGISTER (ptr
) = 1;
652 cp_finish_decl (ptr
, NULL_TREE
, NULL_TREE
, LOOKUP_ONLYCONVERTING
);
653 tmp
= do_allocate_exception (TREE_TYPE (exp
));
654 tmp
= build_modify_expr (ptr
, INIT_EXPR
, tmp
);
655 finish_expr_stmt (tmp
);
657 object
= build1 (NOP_EXPR
, build_pointer_type (TREE_TYPE (exp
)), ptr
);
658 object
= build_indirect_ref (object
, NULL
);
660 exp
= build_modify_expr (object
, INIT_EXPR
, exp
);
661 if (exp
== error_mark_node
)
662 error (" in thrown expression");
664 exp
= build1 (MUST_NOT_THROW_EXPR
, TREE_TYPE (exp
), exp
);
665 finish_expr_stmt (exp
);
667 throw_type
= build_eh_type_type (prepare_eh_type (TREE_TYPE (object
)));
669 if (TYPE_HAS_DESTRUCTOR (TREE_TYPE (object
)))
671 cleanup
= lookup_fnfields (TYPE_BINFO (TREE_TYPE (object
)),
672 complete_dtor_identifier
, 0);
673 cleanup
= TREE_VALUE (cleanup
);
675 mark_addressable (cleanup
);
676 /* Pretend it's a normal function. */
677 cleanup
= build1 (ADDR_EXPR
, cleanup_type
, cleanup
);
681 cleanup
= build_int_2 (0, 0);
682 TREE_TYPE (cleanup
) = cleanup_type
;
685 tmp
= tree_cons (NULL_TREE
, cleanup
, NULL_TREE
);
686 tmp
= tree_cons (NULL_TREE
, throw_type
, tmp
);
687 tmp
= tree_cons (NULL_TREE
, ptr
, tmp
);
688 tmp
= build_function_call (fn
, tmp
);
690 /* ??? Indicate that this function call throws throw_type. */
692 finish_expr_stmt (tmp
);
694 exp
= finish_init_stmts (stmt_expr
, compound_stmt
);
698 /* Rethrow current exception. */
700 tree fn
= get_identifier ("__cxa_rethrow");
701 if (IDENTIFIER_GLOBAL_VALUE (fn
))
702 fn
= IDENTIFIER_GLOBAL_VALUE (fn
);
705 /* Declare void __cxa_rethrow (void). */
706 fn
= push_throw_library_fn
707 (fn
, build_function_type (void_type_node
, void_list_node
));
710 exp
= build_function_call (fn
, NULL_TREE
);
713 exp
= build1 (THROW_EXPR
, void_type_node
, exp
);
718 /* Make sure TYPE is complete, pointer to complete, reference to
719 complete, or pointer to cv void. Issue diagnostic on failure.
720 Return the zero on failure and non-zero on success. FROM can be
721 the expr or decl from whence TYPE came, if available. */
724 complete_ptr_ref_or_void_ptr_p (type
, from
)
730 /* Check complete. */
731 type
= complete_type_or_else (type
, from
);
735 /* Or a pointer or ref to one, or cv void *. */
736 is_ptr
= TREE_CODE (type
) == POINTER_TYPE
;
737 if (is_ptr
|| TREE_CODE (type
) == REFERENCE_TYPE
)
739 tree core
= TREE_TYPE (type
);
741 if (is_ptr
&& VOID_TYPE_P (core
))
743 else if (!complete_type_or_else (core
, from
))
749 /* Return truth-value if EXPRESSION is admissible in throw-expression,
750 i.e. if it is not of incomplete type or a pointer/reference to such
751 a type or of an abstract class type. */
754 is_admissible_throw_operand (expr
)
757 tree type
= TREE_TYPE (expr
);
759 /* 15.1/4 [...] The type of the throw-expression shall not be an
760 incomplete type, or a pointer or a reference to an incomplete
761 type, other than void*, const void*, volatile void*, or
762 const volatile void*. Except for these restriction and the
763 restrictions on type matching mentioned in 15.3, the operand
764 of throw is treated exactly as a function argument in a call
765 (5.2.2) or the operand of a return statement. */
766 if (!complete_ptr_ref_or_void_ptr_p (type
, expr
))
769 /* 10.4/3 An abstract class shall not be used as a parameter type,
770 as a function return type or as type of an explicit
772 else if (CLASS_TYPE_P (type
) && CLASSTYPE_PURE_VIRTUALS (type
))
774 cp_error ("Expression '%E' of abstract class type '%T' cannot be used in throw-expression", expr
, type
);
781 /* Returns nonzero if FN is a declaration of a standard C library
782 function which is known not to throw.
784 [lib.res.on.exception.handling]: None of the functions from the
785 Standard C library shall report an error by throwing an
786 exception, unless it calls a program-supplied function that
787 throws an exception. */
798 && DECL_EXTERNAL (fn
)
799 && DECL_NAMESPACE_SCOPE_P (fn
)
800 && DECL_EXTERN_C_P (fn
))
803 /* Can't be a C library function. */
806 id
= DECL_ASSEMBLER_NAME (fn
);
807 return !!libc_name_p (IDENTIFIER_POINTER (id
), IDENTIFIER_LENGTH (id
));
810 /* Returns nonzero if an exception of type FROM will be caught by a
811 handler for type TO, as per [except.handle]. */
814 can_convert_eh (to
, from
)
817 if (TREE_CODE (to
) == REFERENCE_TYPE
)
819 if (TREE_CODE (from
) == REFERENCE_TYPE
)
820 from
= TREE_TYPE (from
);
822 if (TREE_CODE (to
) == POINTER_TYPE
&& TREE_CODE (from
) == POINTER_TYPE
)
825 from
= TREE_TYPE (from
);
827 if (! at_least_as_qualified_p (to
, from
))
830 if (TREE_CODE (to
) == VOID_TYPE
)
833 /* else fall through */
836 if (CLASS_TYPE_P (to
) && CLASS_TYPE_P (from
)
837 && PUBLICLY_UNIQUELY_DERIVED_P (to
, from
))
843 /* Check whether any of HANDLERS are shadowed by another handler accepting
844 TYPE. Note that the shadowing may not be complete; even if an exception
845 of type B would be caught by a handler for A, there could be a derived
846 class C for which A is an ambiguous base but B is not, so the handler
847 for B would catch an exception of type C. */
850 check_handlers_1 (master
, handlers
)
854 tree type
= TREE_TYPE (master
);
857 for (handler
= handlers
; handler
; handler
= TREE_CHAIN (handler
))
858 if (TREE_TYPE (handler
)
859 && can_convert_eh (type
, TREE_TYPE (handler
)))
861 lineno
= STMT_LINENO (handler
);
862 cp_warning ("exception of type `%T' will be caught",
863 TREE_TYPE (handler
));
864 lineno
= STMT_LINENO (master
);
865 cp_warning (" by earlier handler for `%T'", type
);
870 /* Given a chain of HANDLERs, make sure that they're OK. */
873 check_handlers (handlers
)
877 int save_line
= lineno
;
878 for (handler
= handlers
; handler
; handler
= TREE_CHAIN (handler
))
880 if (TREE_CHAIN (handler
) == NULL_TREE
)
881 /* No more handlers; nothing to shadow. */;
882 else if (TREE_TYPE (handler
) == NULL_TREE
)
884 lineno
= STMT_LINENO (handler
);
886 ("`...' handler must be the last handler for its try block");
889 check_handlers_1 (handler
, TREE_CHAIN (handler
));