diff options
author | Randall Spangler <rspangler@chromium.org> | 2013-07-24 11:19:10 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-07-24 14:05:17 -0700 |
commit | fe660aa3729aa6f468a62f4e6c37f3dd5c85503d (patch) | |
tree | 3d784cdf240e80fd31c2fdc291c24ddaca6b7d08 /include/task.h | |
parent | 596480de062da815326071630ebf2348ce1c02ac (diff) | |
download | chrome-ec-fe660aa3729aa6f468a62f4e6c37f3dd5c85503d.tar.gz |
Standardize concatenation macros
To create a token by concatenating already-defined macros and new
text, it's necessary to use multiple levels of macro. We'd already
done that in several places in the code such as STM32_CAT; this now
standardizes it into a single place.
BUG=chrome-os-partner:18343
BRANCH=none
TEST=Build all platforms; examine ec.RO.map to see that irq_*_handler and prio_* symbols
evaluated the same as before. (Other macro evaluations would simply fail to compile
if they were incorrect, since the concatenated tokens wouldn't fully expand.)
Change-Id: Ic9bf11d27881a84507fe7b6096dab6217c6c6dc7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63231
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include/task.h')
-rw-r--r-- | include/task.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/include/task.h b/include/task.h index ff3fe30f60..edf278c066 100644 --- a/include/task.h +++ b/include/task.h @@ -196,10 +196,9 @@ struct irq_priority { uint8_t priority; }; -/* Helper macros to build the IRQ handler name */ -#define IRQ_BUILD_NAME(prefix, irqnum, postfix) prefix ## irqnum ## postfix -#define IRQ_HANDLER(irqname) IRQ_BUILD_NAME(irq_,irqname,_handler) - +/* Helper macros to build the IRQ handler and priority struct names */ +#define IRQ_HANDLER(irqname) CONCAT3(irq_, irqname, _handler) +#define IRQ_PRIORITY(irqname) CONCAT2(prio_, irqname) /* * Macro to connect the interrupt handler "routine" to the irq number "irq" and * ensure it is enabled in the interrupt controller with the right priority. @@ -212,7 +211,7 @@ struct irq_priority { routine(); \ task_resched_if_needed(ret); \ } \ - const struct irq_priority IRQ_BUILD_NAME(prio_, irq, ) \ + const struct irq_priority IRQ_PRIORITY(irq) \ __attribute__((section(".rodata.irqprio"))) \ = {irq, priority} |