diff mbox series

MSP430: Don't warn if naked function does not return

Message ID a2ec793c-691b-2f95-3184-eb3c8fd4e3b1@mittosystems.com
State New
Headers show
Series MSP430: Don't warn if naked function does not return | expand

Commit Message

Jozef Lawrynowicz May 23, 2018, 10:44 p.m. UTC
Implement TARGET_WARN_FUNC_RETURN for msp430-elf, to eliminate warnings when
functions with the "naked" attribute do not return.
The GCC testsuite completes with no regressions for msp430-elf, and this fixes
pr53633.

If the patch is acceptable, I would appreciate it if someone could commit it
for me, as I don't have write access.

Comments

Jeff Law May 24, 2018, 8:49 p.m. UTC | #1
On 05/23/2018 04:44 PM, Jozef Lawrynowicz wrote:
> 2018-05-23  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
> 
> 	gcc/config/msp430/msp430.c (msp430_warn_func_return): New.
> 
Thanks.  Installed on the trunk.

Jeff
diff mbox series

Patch

From 6b7a22144d70bcccfeebc9fcefd724e8f05a6e09 Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date: Wed, 23 May 2018 21:33:45 +0100
Subject: [PATCH] MSP430: Dont warn if naked function does not return

2018-05-23  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	gcc/config/msp430/msp430.c (msp430_warn_func_return): New.

---
 gcc/config/msp430/msp430.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c
index a8fed12..adde597 100644
--- a/gcc/config/msp430/msp430.c
+++ b/gcc/config/msp430/msp430.c
@@ -1855,6 +1855,17 @@  msp430_allocate_stack_slots_for_args (void)
   return ! is_naked_func ();
 }
 
+#undef TARGET_WARN_FUNC_RETURN
+#define TARGET_WARN_FUNC_RETURN msp430_warn_func_return
+
+static bool
+msp430_warn_func_return (tree decl)
+{
+  /* Naked functions are implemented entirely in assembly, including the
+     return sequence, so suppress warnings about this.  */
+  return !is_naked_func (decl);
+}
+
 /* Verify MSP430 specific attributes.  */
 #define TREE_NAME_EQ(NAME, STR) (strcmp (IDENTIFIER_POINTER (NAME), (STR)) == 0)
 
-- 
2.7.4