[rfc] macros and macro usage

walter harms wharms at bfs.de
Sun Jun 15 13:08:46 UTC 2008



Cristian Ionescu-Idbohrn wrote:
> On Sun, 15 Jun 2008, Denys Vlasenko wrote:
> 
>> On Saturday 14 June 2008 21:20, Cristian Ionescu-Idbohrn wrote:
>>> $ egrep _ARPING include/autoconf.h
>>> #define CONFIG_ARPING 1
>>> #define ENABLE_ARPING 1
>>> #define USE_ARPING(...) __VA_ARGS__
>>> #define SKIP_ARPING(...)
>>> #define CONFIG_FEATURE_UDHCPC_ARPING 1
>>> #define ENABLE_FEATURE_UDHCPC_ARPING 1
>>> #define USE_FEATURE_UDHCPC_ARPING(...) __VA_ARGS__
>>> #define SKIP_FEATURE_UDHCPC_ARPING(...)
>>>
>>> $ egrep _MMU applets/usage.c
>>> ./applets/usage.c:#define BB_MMU 0
>>> ./applets/usage.c:#define USE_FOR_MMU(...)
>>> ./applets/usage.c:#define BB_MMU 1
>>> ./applets/usage.c:#define USE_FOR_MMU(...) __VA_ARGS__
>>>
>>> For consistancy, I would have expected something similar to this instead:
>>> #define USE_BB_MMU(...) __VA_ARGS__
>>> #define SKIP_BB_MMU(...)
>> The point is, SKIP_xxx(foo) is misnamed. It doesn't skip anything.
>> It includes foo if xxx is not selected.
>> BTW, USE_ARPING(foo) is misnamed *too*. It's not "using arping",
>> it's "using foo if arping [is selected]". USE_IF_ARPING would be
>> more readable.
> 
> Yes, you have a point.
> USE_IF_FEATURE_X and SKIP_IF_FEATURE_X would be better.

assume that:
 skip = ! use

that means you can write:
	USE_IF_FEATURE(!x)

that would reduce the number of macros by one (type).

ntl: your point is correct, we have way to many macros
someone should write down how the names (USE,ENABLE,DISABLE) are used. Anything else will lead
to a temporay cleanup only.

re,
 wh


> 
>> For MMU, I decided to try to make up better names and see how they will
>> stick.
>



More information about the busybox mailing list