[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-devel] opt.h - LWIP_EVENT_API
From: |
Bill Auerbach |
Subject: |
RE: [lwip-devel] opt.h - LWIP_EVENT_API |
Date: |
Mon, 6 Dec 2010 10:28:17 -0500 |
If we did change opts.h, this is backward compatible:
** Current implementation **
#ifndef LWIP_EVENT_API
#define LWIP_EVENT_API 0
#define LWIP_CALLBACK_API 1
#else
#define LWIP_EVENT_API 1
#define LWIP_CALLBACK_API 0
#endif
** Compatible change **
#ifndef LWIP_EVENT_API
#define LWIP_EVENT_API 0
#endif
#define LWIP_CALLBACK_API (! LWIP_EVENT_API)
Now doing #define LWIP_EVENT_API 0 is OK and works as expected. This is also
better because it guarantees the options are opposite.
If someone does:
#define LWIP_CALLBACK_API 1
without defining LWIP_EVENT_API it will potentially redefine LWIP_CALLBACK_API
generating a compiler warning or error. This is the case with the current code
as well. To be thorough we can #undef LWIP_CALLBACK_API before the #define of
it.
I can provide this patch or a patch to do a compile time check, yes. I would
like to ask why do you prefer to not fix opts.h and compile-time check it
instead?
Bill
>-----Original Message-----
>From: address@hidden
>[mailto:address@hidden On
>Behalf Of Kieran Mansley
>Sent: Monday, December 06, 2010 10:00 AM
>To: lwip-devel
>Subject: Re: [lwip-devel] opt.h - LWIP_EVENT_API
>
>On Mon, 2010-12-06 at 09:45 -0500, Bill Auerbach wrote:
>
>> * LWIP_EVENT_API and LWIP_CALLBACK_API: Only one of these should be
>> set to 1.
>>
>> Which implies not explicitly setting it to 0, but I don’t think I see
>> any options that don’t allow a 0 for off and a 1 for on. This one is
>> “No define for off” and “Define 1 for on”. Seems inconsistent to me.
>
>It does look wrong. I'd favour not trying to fix it up in opt.h and
>instead asserting in our compile time checks that:
>1) One of them is set (I think this is required? Am I wrong?)
>2) Both of them aren't set
>
>opt.h could then I suppose have a section to fix it up where neither
>have been set so that we get a sensible default.
>
>Could you raise a bug on savannah, and if you're feeling enthusiastic
>suggest a patch?
>
>Kieran
>
>
>_______________________________________________
>lwip-devel mailing list
>address@hidden
>http://lists.nongnu.org/mailman/listinfo/lwip-devel