This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ Patch] Avoid spurious libsupc++ warnings


Hi all, hi Mark,

this is what I successfully tested on x86_64-linux, following up to your help on gcc. Does it look OK?

Thanks,
Paolo.

/////////////////
2008-07-24  Paolo Carlini  <paolo.carlini@oracle.com>

	* except.c (do_get_exception_ptr, do_begin_catch,
	do_allocate_exception, do_free_exception): Adjust declarations
	(ie, add empty exception-specification), consistently with the
	actual implementation in libsupc++.
Index: except.c
===================================================================
*** except.c	(revision 138121)
--- except.c	(working copy)
***************
*** 1,6 ****
  /* Handle exceptional things in C++.
     Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
!    2000, 2001, 2002, 2003, 2004, 2005, 2007  Free Software Foundation, Inc.
     Contributed by Michael Tiemann <tiemann@cygnus.com>
     Rewritten by Mike Stump <mrs@cygnus.com>, based upon an
     initial re-implementation courtesy Tad Hunt.
--- 1,7 ----
  /* Handle exceptional things in C++.
     Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
!    2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
!    Free Software Foundation, Inc.
     Contributed by Michael Tiemann <tiemann@cygnus.com>
     Rewritten by Mike Stump <mrs@cygnus.com>, based upon an
     initial re-implementation courtesy Tad Hunt.
*************** do_get_exception_ptr (void)
*** 171,179 ****
    fn = get_identifier ("__cxa_get_exception_ptr");
    if (!get_global_value_if_present (fn, &fn))
      {
!       /* Declare void* __cxa_get_exception_ptr (void *).  */
!       tree tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
!       fn = push_library_fn (fn, build_function_type (ptr_type_node, tmp));
      }
  
    return cp_build_function_call (fn, tree_cons (NULL_TREE, build_exc_ptr (),
--- 172,186 ----
    fn = get_identifier ("__cxa_get_exception_ptr");
    if (!get_global_value_if_present (fn, &fn))
      {
!       /* Declare void* __cxa_get_exception_ptr (void *) throw().
! 
! 	 Note that the C++ ABI document does not have a throw-specifier
! 	 on this routine.  The declaration is consistent with the actual
! 	 implementation in libsupc++.  */
!       tree args = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
!       tree tmp = build_function_type (ptr_type_node, args);
!       fn = push_library_fn (fn, build_exception_variant (tmp,
! 							 empty_except_spec));
      }
  
    return cp_build_function_call (fn, tree_cons (NULL_TREE, build_exc_ptr (),
*************** do_begin_catch (void)
*** 192,200 ****
    fn = get_identifier ("__cxa_begin_catch");
    if (!get_global_value_if_present (fn, &fn))
      {
!       /* Declare void* __cxa_begin_catch (void *).  */
!       tree tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
!       fn = push_library_fn (fn, build_function_type (ptr_type_node, tmp));
      }
  
    return cp_build_function_call (fn, tree_cons (NULL_TREE, build_exc_ptr (),
--- 199,213 ----
    fn = get_identifier ("__cxa_begin_catch");
    if (!get_global_value_if_present (fn, &fn))
      {
!       /* Declare void* __cxa_begin_catch (void *) throw().
! 
! 	 Note that the C++ ABI document does not have a throw-specifier
! 	 on this routine.  The declaration is consistent with the actual
! 	 implementation in libsupc++.  */
!       tree args = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
!       tree tmp = build_function_type (ptr_type_node, args);
!       fn = push_library_fn (fn, build_exception_variant (tmp,
! 							 empty_except_spec));
      }
  
    return cp_build_function_call (fn, tree_cons (NULL_TREE, build_exc_ptr (),
*************** do_allocate_exception (tree type)
*** 543,551 ****
    fn = get_identifier ("__cxa_allocate_exception");
    if (!get_global_value_if_present (fn, &fn))
      {
!       /* Declare void *__cxa_allocate_exception(size_t).  */
!       tree tmp = tree_cons (NULL_TREE, size_type_node, void_list_node);
!       fn = push_library_fn (fn, build_function_type (ptr_type_node, tmp));
      }
  
    return cp_build_function_call (fn, 
--- 556,570 ----
    fn = get_identifier ("__cxa_allocate_exception");
    if (!get_global_value_if_present (fn, &fn))
      {
!       /* Declare void *__cxa_allocate_exception(size_t) throw().
! 
! 	 Note that the C++ ABI document does not have a throw-specifier
! 	 on this routine.  The declaration is consistent with the actual
! 	 implementation in libsupc++.  */
!       tree args = tree_cons (NULL_TREE, size_type_node, void_list_node);
!       tree tmp = build_function_type (ptr_type_node, args);
!       fn = push_library_fn (fn, build_exception_variant (tmp,
! 							 empty_except_spec));
      }
  
    return cp_build_function_call (fn, 
*************** do_free_exception (tree ptr)
*** 565,573 ****
    fn = get_identifier ("__cxa_free_exception");
    if (!get_global_value_if_present (fn, &fn))
      {
!       /* Declare void __cxa_free_exception (void *).  */
!       fn = push_void_library_fn (fn, tree_cons (NULL_TREE, ptr_type_node,
! 						void_list_node));
      }
  
    return cp_build_function_call (fn, tree_cons (NULL_TREE, ptr, NULL_TREE),
--- 584,598 ----
    fn = get_identifier ("__cxa_free_exception");
    if (!get_global_value_if_present (fn, &fn))
      {
!       /* Declare void __cxa_free_exception (void *) throw().
! 
! 	 Note that the C++ ABI document does not have a throw-specifier
! 	 on this routine.  The declaration is consistent with the actual
! 	 implementation in libsupc++.  */
!       tree args = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
!       tree tmp = build_function_type (void_type_node, args);
!       fn = push_library_fn (fn, build_exception_variant (tmp,
! 							 empty_except_spec));
      }
  
    return cp_build_function_call (fn, tree_cons (NULL_TREE, ptr, NULL_TREE),

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]