From: asterix Date: Tue, 20 Jul 2010 13:52:21 +0000 (+0000) Subject: Add the macro to count the argument number of functions. X-Git-Tag: 2.6.0~288^2~54 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=a7c6624728792be4c7e5314a0bc3ea3315e2328f;p=bertos.git 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 --- 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