Patchwork Add missing test for DECL_NO_INLINE_WARNING_P

login
register
mail settings
Submitter Eric Botcazou
Date April 19, 2011, 11:06 a.m.
Message ID <201104191306.29559.ebotcazou@adacore.com>
Download mbox | patch
Permalink /patch/91953/
State New
Headers show

Comments

Eric Botcazou - April 19, 2011, 11:06 a.m.
Hi,

tree_inlinable_function_p issues the -Winline warning only if

  /* We only warn for functions declared `inline' by the user.  */
  do_warning = (warn_inline
		&& DECL_DECLARED_INLINE_P (fn)
		&& !DECL_NO_INLINE_WARNING_P (fn)
		&& !DECL_IN_SYSTEM_HEADER (fn));

is true, so in particular only if DECL_NO_INLINE_WARNING_P is not set.  Now 
expand_call_inline also issues the -Winline warning

      else if (warn_inline && DECL_DECLARED_INLINE_P (fn)
	       && !DECL_IN_SYSTEM_HEADER (fn)
	       && reason != CIF_UNSPECIFIED
	       && !lookup_attribute ("noinline", DECL_ATTRIBUTES (fn))
	       /* Do not warn about not inlined recursive calls.  */
	       && !cgraph_edge_recursive_p (cg_edge)
	       /* Avoid warnings during early inline pass. */
	       && cgraph_global_info_ready)

but disregards the DECL_NO_INLINE_WARNING_P flag.

Tested on i586-suse-linux, OK for the mainline?


2011-04-19  Eric Botcazou  <ebotcazou@adacore.com>

	* tree-inline.c (expand_call_inline): Do not issue a -Winline warning
	if DECL_NO_INLINE_WARNING_P is set on the function.
Richard Guenther - April 19, 2011, 11:18 a.m.
On Tue, Apr 19, 2011 at 1:06 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> tree_inlinable_function_p issues the -Winline warning only if
>
>  /* We only warn for functions declared `inline' by the user.  */
>  do_warning = (warn_inline
>                && DECL_DECLARED_INLINE_P (fn)
>                && !DECL_NO_INLINE_WARNING_P (fn)
>                && !DECL_IN_SYSTEM_HEADER (fn));
>
> is true, so in particular only if DECL_NO_INLINE_WARNING_P is not set.  Now
> expand_call_inline also issues the -Winline warning
>
>      else if (warn_inline && DECL_DECLARED_INLINE_P (fn)
>               && !DECL_IN_SYSTEM_HEADER (fn)
>               && reason != CIF_UNSPECIFIED
>               && !lookup_attribute ("noinline", DECL_ATTRIBUTES (fn))
>               /* Do not warn about not inlined recursive calls.  */
>               && !cgraph_edge_recursive_p (cg_edge)
>               /* Avoid warnings during early inline pass. */
>               && cgraph_global_info_ready)
>
> but disregards the DECL_NO_INLINE_WARNING_P flag.
>
> Tested on i586-suse-linux, OK for the mainline?

Ok.

Thanks,
Richard.

>
> 2011-04-19  Eric Botcazou  <ebotcazou@adacore.com>
>
>        * tree-inline.c (expand_call_inline): Do not issue a -Winline warning
>        if DECL_NO_INLINE_WARNING_P is set on the function.
>
>
> --
> Eric Botcazou
>

Patch

Index: tree-inline.c
===================================================================
--- tree-inline.c	(revision 172693)
+++ tree-inline.c	(working copy)
@@ -3744,7 +3744,9 @@  expand_call_inline (basic_block bb, gimp
 		 _(cgraph_inline_failed_string (reason)));
 	  sorry ("called from here");
 	}
-      else if (warn_inline && DECL_DECLARED_INLINE_P (fn)
+      else if (warn_inline
+	       && DECL_DECLARED_INLINE_P (fn)
+	       && !DECL_NO_INLINE_WARNING_P (fn)
 	       && !DECL_IN_SYSTEM_HEADER (fn)
 	       && reason != CIF_UNSPECIFIED
 	       && !lookup_attribute ("noinline", DECL_ATTRIBUTES (fn))