]> git.baikalelectronics.ru Git - uboot.git/commit
include: Add a variadic macro to call a callback for all arguments
authorMarek BehĂșn <marek.behun@nic.cz>
Sun, 3 Sep 2017 15:00:25 +0000 (17:00 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 3 Oct 2017 01:52:16 +0000 (21:52 -0400)
commitdb71b6b32975b63f1089daa765f8ccebfdb8b23f
tree903d018e94ba446ab36dbdf93db2836f6dfa29f7
parent226b7ec71c36db24a0525a79c7c71ea952a29208
include: Add a variadic macro to call a callback for all arguments

Add a header variadic-macro.h which defines the CALL_MACRO_FOR_EACH marco.

This macro can be used as follows:
  #define TEST(x)
  CALL_MACRO_FOR_EACH(TEST, a, b, c, d)

This will expand to
  TEST(a) TEST(b) TEST(c) TEST(d)

The nice thing is that CALL_MACRO_FOR_EACH is a variadic macro, thus the
number of arguments can vary (although it has an upper limit - in this
implementation 32 arguments).

Signed-off-by: Marek Behun <marek.behun@nic.cz>
 create mode 100644 include/u-boot/variadic-macro.h
include/u-boot/variadic-macro.h [new file with mode: 0644]