aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/arm
diff options
context:
space:
mode:
authorSandra Loosemore <sandra@codesourcery.com>2012-07-25 14:08:06 -0400
committerSandra Loosemore <sandra@gcc.gnu.org>2012-07-25 14:08:06 -0400
commitd45eae79db3e8c41ac1f307b267179498a636e0b (patch)
treef42803034e2d99c0fb7f313962516557837e0a57 /gcc/config/arm
parent62732c3044c767f4efcff0cd398c9e65ba437bda (diff)
downloadgcc-d45eae79db3e8c41ac1f307b267179498a636e0b.zip
gcc-d45eae79db3e8c41ac1f307b267179498a636e0b.tar.gz
gcc-d45eae79db3e8c41ac1f307b267179498a636e0b.tar.bz2
re PR target/53633 (__attribute__((naked)) should disable -Wreturn-type)
2012-07-25 Sandra Loosemore <sandra@codesourcery.com> Paul Brook <paul@codesourcery.com> PR target/53633 gcc/ * target.def (warn_func_return): New hook. * doc/tm.texi.in (TARGET_WARN_FUNC_RETURN): New hook. * doc/tm.texi: Regenerate. * doc/sourcebuild.texi (Effective-Target Keywords): Document naked_functions. * ipa-pure-const.c (warn_function_noreturn): Check targetm.warn_func_return. * tree-cfg.c (execute_warn_function_return): Likewise. * config/spu/spu.c (spu_warn_func_return): New. (TARGET_WARN_FUNC_RETURN): Define. * config/rx/rx.c (rx_warn_func_return): New. (TARGET_WARN_FUNC_RETURN): Define. * config/avr/avr.c (avr_warn_func_return): New. (TARGET_WARN_FUNC_RETURN): Define. * config/arm/arm.c (arm_warn_func_return): New. (TARGET_WARN_FUNC_RETURN): Define. * config/mcore/mcore.c (mcore_warn_func_return): New. (TARGET_WARN_FUNC_RETURN): Define. (saved_warn_return_type, saved_warn_return_type_count): Remove. (mcore_reorg, mcore_handle_naked_attribute): Remove warn_return hack. gcc/cp/ * decl.c (finish_function): Check targetm.warn_func_return. gcc/testsuite/ * lib/target-suports.exp (check_effective_target_naked_functions): New. * c-c++-common/pr53633.c: New test. Co-Authored-By: Paul Brook <paul@codesourcery.com> From-SVN: r189860
Diffstat (limited to 'gcc/config/arm')
-rw-r--r--gcc/config/arm/arm.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 267868b..1f3f9b3 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -236,6 +236,7 @@ static int arm_issue_rate (void);
static void arm_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
static bool arm_output_addr_const_extra (FILE *, rtx);
static bool arm_allocate_stack_slots_for_args (void);
+static bool arm_warn_func_return (tree);
static const char *arm_invalid_parameter_type (const_tree t);
static const char *arm_invalid_return_type (const_tree t);
static tree arm_promoted_type (const_tree t);
@@ -458,6 +459,9 @@ static const struct attribute_spec arm_attribute_table[] =
#undef TARGET_TRAMPOLINE_ADJUST_ADDRESS
#define TARGET_TRAMPOLINE_ADJUST_ADDRESS arm_trampoline_adjust_address
+#undef TARGET_WARN_FUNC_RETURN
+#define TARGET_WARN_FUNC_RETURN arm_warn_func_return
+
#undef TARGET_DEFAULT_SHORT_ENUMS
#define TARGET_DEFAULT_SHORT_ENUMS arm_default_short_enums
@@ -2168,6 +2172,14 @@ arm_allocate_stack_slots_for_args (void)
return !IS_NAKED (arm_current_func_type ());
}
+static bool
+arm_warn_func_return (tree decl)
+{
+ /* Naked functions are implemented entirely in assembly, including the
+ return sequence, so suppress warnings about this. */
+ return lookup_attribute ("naked", DECL_ATTRIBUTES (decl)) == NULL_TREE;
+}
+
/* Output assembler code for a block containing the constant parts
of a trampoline, leaving space for the variable parts.