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]

[PING][C] Fix PR32511, GCC inlines weak function


Ping!

Thanks,
Richard.

2008-02-18  Richard Guenther  <rguenther@suse.de>

	PR c/32511
	* c-common.c (handle_weak_attribute): Reject combination of
	weak and inline.

	* gcc.dg/attr-weak-1.c: New testcase.

Index: c-common.c
===================================================================
*** c-common.c	(revision 132388)
--- c-common.c	(working copy)
*************** handle_weak_attribute (tree *node, tree 
*** 5492,5502 ****
  		       bool * ARG_UNUSED (no_add_attrs))
  {
    if (TREE_CODE (*node) == FUNCTION_DECL
!       || TREE_CODE (*node) == VAR_DECL)
      declare_weak (*node);
    else
      warning (OPT_Wattributes, "%qE attribute ignored", name);
-     	
  
    return NULL_TREE;
  }
--- 5492,5507 ----
  		       bool * ARG_UNUSED (no_add_attrs))
  {
    if (TREE_CODE (*node) == FUNCTION_DECL
!       && DECL_DECLARED_INLINE_P (*node))
!     {
!       error ("inline function %q+D cannot be declared weak", *node);
!       *no_add_attrs = true;
!     }
!   else if (TREE_CODE (*node) == FUNCTION_DECL
! 	   || TREE_CODE (*node) == VAR_DECL)
      declare_weak (*node);
    else
      warning (OPT_Wattributes, "%qE attribute ignored", name);
  
    return NULL_TREE;
  }
Index: testsuite/gcc.dg/attr-weak-1.c
===================================================================
*** testsuite/gcc.dg/attr-weak-1.c	(revision 0)
--- testsuite/gcc.dg/attr-weak-1.c	(revision 0)
***************
*** 0 ****
--- 1,4 ----
+ /* { dg-do compile } */
+ 
+ __inline void foo(void) __attribute__((weak));  /* { dg-error "inline.*weak" } */
+ 


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