On Sat, 5 Jun 2021, I wrote:
Anyway, I see that we can already write this: #define IS_MULTI(a,b) __or(IS_ENABLED(a), IS_ENABLED(b))
Oops. The 2-way case would be, #define IS_MULTI(a,b) __and(IS_ENABLED(a), IS_ENABLED(b))
So maybe we just need an exclusive-OR macro to go with the other operators defined in include/linux/kconfig.h? Then we could write this: #define IS_SINGLE(a,b) __xor(IS_ENABLED(a), IS_ENABLED(b)) But these only work for a 2-way group. Extending them to N-way groups is beyond my CPP abilities. It probably requires N-way __or() and __xor()...
For the 3 way case, #define IS_SINGLE(a,b,c) (__xor(IS_ENABLED(a), IS_ENABLED(b), IS_ENABLED(c)) && !__and(IS_ENABLED(a), IS_ENABLED(b), IS_ENABLED(c))) #define IS_MULTI(a,b,c) (!IS_SINGLE(a,b,c) && __or(IS_ENABLED(a), IS_ENABLED(b), IS_ENABLED(c)))