[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Nice kconfig hack
From: Lauri Kasanen <curaga () operamail ! com>
Date: 2012-04-26 13:03:07
Message-ID: 1335445387.29871.140661067648073.2BE764B4 () webmail ! messagingengine ! com
[Download RAW message or body]
Hi
Linus asked for a better way to handle the kconfig values:
https://plus.google.com/102150693225130002912/posts/9gntjh57dXt
The solution is rather neat, maybe it could save generating a few
thousand included lines in busybox too:
#define is_set(macro) is_set_(macro)
#define macrotest_1 ,
#define is_set_(value) is_set__(macrotest_##value)
#define is_set__(comma) is_set___(comma 1, 0)
#define is_set___(_, v, ...) v
- Lauri
--
http://www.fastmail.fm - The professional email service
["test2.c" (test2.c)]
#define is_set(macro) is_set_(macro)
#define macrotest_1 ,
#define is_set_(value) is_set__(macrotest_##value)
#define is_set__(comma) is_set___(comma 1, 0)
#define is_set___(_, v, ...) v
#include <stdio.h>
#define jaa 1
int main() {
if (is_set(jaa))
puts("jaa set");
if (is_set(ejaa))
puts("ejaa set");
#if is_set(hei)
puts("hei pp set");
#endif
return 0;
}
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic