* cgraphunit.c (cgraph_optimize_function): Always do
optimize_inline_calls when there is always_inline callee.
(cgraph_decide_inlining): Fix formating.
* tree-inline.c (inlinable_function_p): Do sorry for alwaysinline
functions.
(expand_call_inline): Likewise.
* toplev.h (sorry): Fix prototype.
* gcc.dg/always_inline.c: New test.
* gcc.dg/debug/
20031231-1.c: Fix.
From-SVN: r75781
+2004-01-13 Jan Hubicka <jh@suse.cz>
+
+ * cgraphunit.c (cgraph_optimize_function): Always do
+ optimize_inline_calls when there is always_inline callee.
+ (cgraph_decide_inlining): Fix formating.
+ * tree-inline.c (inlinable_function_p): Do sorry for alwaysinline
+ functions.
+ (expand_call_inline): Likewise.
+ * toplev.h (sorry): Fix prototype.
+
2004-01-12 Roger Sayle <roger@eyesopen.com>
* builtins.c (expand_builtin_expect_jump): Simplify logic. Handle
struct cgraph_edge *e;
for (e = node->callees; e; e = e->next_callee)
- if (!e->inline_failed || warn_inline)
+ if (!e->inline_failed || warn_inline
+ || (DECL_DECLARED_INLINE_P (e->callee->decl)
+ && lookup_attribute ("always_inline",
+ DECL_ATTRIBUTES (e->callee->decl))))
break;
if (e)
optimize_inline_calls (decl);
cgraph_node_name (node->callees->caller),
node->callees->caller->global.insns);
}
- if (cgraph_dump_file && node->global.cloned_times > 0)
- fprintf (cgraph_dump_file,
- " Inlined %i times for a net change of %+i insns.\n",
- node->global.cloned_times, overall_insns - old_insns);
+ if (cgraph_dump_file && node->global.cloned_times > 0)
+ fprintf (cgraph_dump_file,
+ " Inlined %i times for a net change of %+i insns.\n",
+ node->global.cloned_times, overall_insns - old_insns);
for (y = 0; y < ninlined; y++)
inlined[y]->output = 0, node->aux = 0;
}
+2004-01-13 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/always_inline.c: New test.
+ * gcc.dg/debug/20031231-1.c: Fix.
+
2004-01-13 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/13474
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Winline -O2" } */
+#include <stdarg.h>
+inline __attribute__ ((always_inline)) void t(void); /* { dg-error "body not available" "" } */
+void
+q(void)
+{
+ t(); /* { dg-error "called from here" "" } */
+}
+inline __attribute__ ((always_inline)) void
+q2(void)
+{ /* { dg-error "recursive" "" } */
+ q2(); /* { dg-error "called from here" "" } */
+ q2(); /* { dg-error "called from here" "" } */
+}
+inline __attribute__ ((always_inline)) void
+e(int t, ...)
+{ /* { dg-error "variable argument" "" } */
+ va_list q;
+ va_start (q, t);
+}
static __inline__ __attribute__((always_inline)) void
pp_c_shift_expression (c_pretty_printer *pp, tree e)
{
- pp_c_shift_expression (pp,e);
}
static void
extern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
ATTRIBUTE_NORETURN;
extern void pedwarn (const char *, ...);
-extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
+extern void sorry (const char *, ...);
extern void inform (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
extern void rest_of_decl_compilation (tree, const char *, int, int);
&& DECL_DECLARED_INLINE_P (fn)
&& !DECL_IN_SYSTEM_HEADER (fn));
- if (do_warning)
+ if (lookup_attribute ("always_inline",
+ DECL_ATTRIBUTES (fn)))
+ sorry (inline_forbidden_reason, fn, fn);
+ else if (do_warning)
warning (inline_forbidden_reason, fn, fn);
inlinable = false;
inlining. */
if (!cgraph_inline_p (id->current_decl, fn, &reason))
{
- if (warn_inline && DECL_DECLARED_INLINE_P (fn)
- && !DECL_IN_SYSTEM_HEADER (fn)
- && strlen (reason))
+ if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)))
+ {
+ sorry ("%Jinlining failed in call to '%F': %s", fn, fn, reason);
+ sorry ("called from here");
+ }
+ else if (warn_inline && DECL_DECLARED_INLINE_P (fn)
+ && !DECL_IN_SYSTEM_HEADER (fn)
+ && strlen (reason))
{
warning ("%Jinlining failed in call to '%F': %s", fn, fn, reason);
warning ("called from here");