From a7c6624728792be4c7e5314a0bc3ea3315e2328f Mon Sep 17 00:00:00 2001 From: asterix Date: Tue, 20 Jul 2010 13:52:21 +0000 Subject: [PATCH] Add the macro to count the argument number of functions. git-svn-id: https://src.develer.com/svnoss/bertos/branches/i2c@4039 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cfg/compiler.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/bertos/cfg/compiler.h b/bertos/cfg/compiler.h index 234db1e2..07f4f141 100644 --- a/bertos/cfg/compiler.h +++ b/bertos/cfg/compiler.h @@ -73,6 +73,23 @@ #define PP_STRINGIZE__(x) #x +/** + */ +#if COMPILER_C99 + #define COUNT_PARMS2(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _, ...) _ + #define COUNT_PARMS(...) \ + COUNT_PARMS2(11 , ## __VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) + + #define FN_ARGS ... + +#else + #define COUNT_PARMS2(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _, ...) _ + #define COUNT_PARMS(args...) \ + COUNT_PARMS2(11 , ## args, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) + + #define FN_ARGS args... +#endif + #if defined(__IAR_SYSTEMS_ICC) || defined(__IAR_SYSTEMS_ICC__) #pragma language=extended -- 2.25.1