Skip to content

Commit

Permalink
RFC 1201 ammendment: naked functions are never inlined
Browse files Browse the repository at this point in the history
clang will automatically set the NoInline attribute for naked functions
and the NoInline attribute wins over AlwaysInline attribute. Let's
follow their lead and specify the same requiremet.

As the compiller can't safely change/remove the prologue and epilogue
for naked functions when it inlines them inlining the naked functions
could result in strange bugs.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
  • Loading branch information
alistair23 committed Sep 30, 2019
1 parent 7afbf18 commit eb232a0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion text/1201-naked-fns.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ be aware of.
# Detailed design

Add a new function attribute to the language, `#[naked]`, indicating the
function should have prologue/epilogue emission disabled.
function should have prologue/epilogue emission disabled. Naked functions
will never be inlined.

Because the calling convention of a naked function is not guaranteed to match
any calling convention the compiler is compatible with, calls to naked functions
Expand Down

0 comments on commit eb232a0

Please sign in to comment.