diff options
author | Nick Clifton <nickc@redhat.com> | 2012-10-03 16:12:22 +0000 |
---|---|---|
committer | Nick Clifton <nickc@gcc.gnu.org> | 2012-10-03 16:12:22 +0000 |
commit | 7fb80860d62c9b64c969213a475a556a3c816a25 (patch) | |
tree | 46ee8015faaeb50c30f8914640d00b5c20e6d402 /gcc/config/rx | |
parent | af9e6b7458f099b26a1c28c2f02093d7b30dfa3f (diff) | |
download | gcc-7fb80860d62c9b64c969213a475a556a3c816a25.zip gcc-7fb80860d62c9b64c969213a475a556a3c816a25.tar.gz gcc-7fb80860d62c9b64c969213a475a556a3c816a25.tar.bz2 |
rx.c (struct decl_chain): New local structure.
* config/rx/rx.c (struct decl_chain): New local structure.
(warned_decls): New local variable. Contains a stack of decls for
which warnings have been issued.
(add_warned_decl): Adds a decl to the stack.
(already_warned): Returns true if a given decl is on the stack.
(rx_set_current_function): Issue a warning if multiple fast
interrupt handlers are defined.
* config/rx/rx.opt (mwarn-multiple-fast-interrupts): New option.
* doc/invoke.texi: Document the option.
From-SVN: r192041
Diffstat (limited to 'gcc/config/rx')
-rw-r--r-- | gcc/config/rx/rx.c | 53 | ||||
-rw-r--r-- | gcc/config/rx/rx.opt | 6 |
2 files changed, 59 insertions, 0 deletions
diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c index 43676d1..5d31eac 100644 --- a/gcc/config/rx/rx.c +++ b/gcc/config/rx/rx.c @@ -1256,6 +1256,41 @@ rx_conditional_register_usage (void) } } +struct decl_chain +{ + tree fndecl; + struct decl_chain * next; +}; + +/* Stack of decls for which we have issued warnings. */ +static struct decl_chain * warned_decls = NULL; + +static void +add_warned_decl (tree fndecl) +{ + struct decl_chain * warned = (struct decl_chain *) xmalloc (sizeof * warned); + + warned->fndecl = fndecl; + warned->next = warned_decls; + warned_decls = warned; +} + +/* Returns TRUE if FNDECL is on our list of warned about decls. */ + +static bool +already_warned (tree fndecl) +{ + struct decl_chain * warned; + + for (warned = warned_decls; + warned != NULL; + warned = warned->next) + if (warned->fndecl == fndecl) + return true; + + return false; +} + /* Perform any actions necessary before starting to compile FNDECL. For the RX we use this to make sure that we have the correct set of register masks selected. If FNDECL is NULL then we are @@ -1288,6 +1323,24 @@ rx_set_current_function (tree fndecl) target_reinit (); } + if (current_is_fast_interrupt && rx_warn_multiple_fast_interrupts) + { + /* We do not warn about the first fast interrupt routine that + we see. Instead we just push it onto the stack. */ + if (warned_decls == NULL) + add_warned_decl (fndecl); + + /* Otherwise if this fast interrupt is one for which we have + not already issued a warning, generate one and then push + it onto the stack as well. */ + else if (! already_warned (fndecl)) + { + warning (0, "multiple fast interrupt routines seen: %qE and %qE", + fndecl, warned_decls->fndecl); + add_warned_decl (fndecl); + } + } + rx_previous_fndecl = fndecl; } diff --git a/gcc/config/rx/rx.opt b/gcc/config/rx/rx.opt index 76c2f61..f0a57b1 100644 --- a/gcc/config/rx/rx.opt +++ b/gcc/config/rx/rx.opt @@ -118,3 +118,9 @@ Specifies whether interrupt functions should save and restore the accumulator re mpid Target Mask(PID) Enables Position-Independent-Data (PID) mode. + +;--------------------------------------------------- + +mwarn-multiple-fast-interrupts +Target Report Var(rx_warn_multiple_fast_interrupts) Init(1) Warning +Warn when multiple, different, fast interrupt handlers are in the compilation unit. |