===================================================================
@@ -2414,7 +2414,14 @@
bit. */
else if (decl_replaceable_p (node->decl) && !DECL_EXTERNAL (node->decl))
+ {
+ if (cgraph_global_info_ready)
+ if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (node->decl)))
+ if (!DECL_DECLARED_INLINE_P (node->decl))
+ warning (0, "always_inline function might not be inlinable");
+
avail = AVAIL_OVERWRITABLE;
+ }
else avail = AVAIL_AVAILABLE;
return avail;
===================================================================
@@ -302,9 +302,20 @@
for (e = node->callees; e; e = e->next_callee)
{
- cgraph_redirect_edge_call_stmt_to_callee (e);
+ gimple call = cgraph_redirect_edge_call_stmt_to_callee (e);
+
+ if (!inline_p)
+ {
if (!e->inline_failed || warn_inline)
inline_p = true;
+ else
+ {
+ tree fn = gimple_call_fndecl (call);
+
+ if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)))
+ inline_p = true;
+ }
+ }
}
if (inline_p)
===================================================================
@@ -1,8 +1,8 @@
/* { dg-do compile } */
-/* { dg-options "-Winline -O2" } */
+/* { dg-options "-O2" } */
#include <stdarg.h>
inline __attribute__ ((always_inline)) void
-e(int t, ...) /* { dg-message "sorry\[^\n\]*variable argument" "" } */
+e(int t, ...) /* { dg-error "variable argument" } */
{
va_list q;
va_start (q, t);
===================================================================
@@ -1,8 +1,8 @@
/* { dg-do compile } */
-/* { dg-options "-Winline -O2" } */
-inline __attribute__ ((always_inline)) void t(void); /* { dg-message "sorry\[^\n\]*body not available" "" } */
+/* { dg-options "-O2" } */
+inline __attribute__ ((always_inline)) void t(void); /* { dg-error "body not available" } */
void
q(void)
{
- t(); /* { dg-message "sorry\[^\n\]*called from here" "" } */
+ t(); /* { dg-error "called from here" } */
}
===================================================================
@@ -1,11 +1,11 @@
/* { dg-do compile } */
-/* { dg-options "-Winline -O2" } */
+/* { dg-options "-O2" } */
int do_something_evil (void);
inline __attribute__ ((always_inline)) void
-q2(void) /* { dg-message "sorry\[^\n\]*recursive" "" } */
+q2(void) /* { dg-error "recursive inlining" } */
{
if (do_something_evil ())
return;
- q2(); /* { dg-message "sorry\[^\n\]*called from here" "" } */
+ q2(); /* { dg-error "called from here" } */
q2(); /* With -O2 we don't warn here, it is eliminated by tail recursion. */
}
===================================================================
@@ -3192,7 +3192,7 @@
As a bonus we can now give more details about the reason why a
function is not inlinable. */
if (always_inline)
- sorry (inline_forbidden_reason, fn);
+ error (inline_forbidden_reason, fn);
else if (do_warning)
warning (OPT_Winline, inline_forbidden_reason, fn);
@@ -3744,9 +3744,9 @@
/* Avoid warnings during early inline pass. */
&& cgraph_global_info_ready)
{
- sorry ("inlining failed in call to %q+F: %s", fn,
- _(cgraph_inline_failed_string (reason)));
- sorry ("called from here");
+ error ("inlining failed in call to always_inline %q+F: %s", fn,
+ cgraph_inline_failed_string (reason));
+ error ("called from here");
}
else if (warn_inline
&& DECL_DECLARED_INLINE_P (fn)