[Maria-developers] Removing a bunch of windows compilation warnings
Hi everyone, I have been working on getting rid of the compiler warnings on Windows. I'm not sure if I have the proper fix for this one, so I separated it from the others. TAILQ_EMPTY(head) is defined in extra\libevent\event-internal.h as this: #define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) It's also defined in extra\libevent\compat\sys\queue.h as: #define TAILQ_FIRST(head) ((head)->tqh_first) #define TAILQ_END(head) NULL #define TAILQ_EMPTY(head) \ (TAILQ_FIRST(head) == TAILQ_END(head)) As you can see, these two are actually identical, but the Visual C++ compiler still complains about them, because it doesn't understand that they are identical. There are several ways to fix it. The proper way would be to avoid having the same define in two different places, but I don't know why it's there in the first place. The second is to guard both defines with an #ifndef TAILQ_EMPTY, which works fine, of course. The one I've chosen is to change the definition in queue.h to be identical (character wise) to the other, and this shuts up the compiler. This is the patch: === modified file 'extra/libevent/compat/sys/queue.h' --- extra/libevent/compat/sys/queue.h 2009-03-12 22:27:35 +0000 +++ extra/libevent/compat/sys/queue.h 2010-04-09 09:34:31 +0000 @@ -298,9 +298,7 @@ /* XXX */ #define TAILQ_PREV(elm, headname, field) \ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) -#define TAILQ_EMPTY(head) \ - (TAILQ_FIRST(head) == TAILQ_END(head)) - +#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) #define TAILQ_FOREACH(var, head, field) \ for((var) = TAILQ_FIRST(head); \ (var) != TAILQ_END(head); \ Ok to push to lp:maria? Bo.
Hi, Bo! On Apr 09, Bo Thorsen wrote:
Hi everyone,
I have been working on getting rid of the compiler warnings on Windows. I'm not sure if I have the proper fix for this one, so I separated it from the others.
TAILQ_EMPTY(head) is defined in extra\libevent\event-internal.h as this:
#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
It's also defined in extra\libevent\compat\sys\queue.h as:
#define TAILQ_FIRST(head) ((head)->tqh_first) #define TAILQ_END(head) NULL #define TAILQ_EMPTY(head) \ (TAILQ_FIRST(head) == TAILQ_END(head))
As you can see, these two are actually identical, but the Visual C++ compiler still complains about them, because it doesn't understand that they are identical.
what if you just delete this whole block from event-internal.h ? In the vanilla libevent sources it's only in compat/sys/queue.h Regards, Sergei
Den 09-04-2010 12:24, Sergei Golubchik skrev:
Hi, Bo!
On Apr 09, Bo Thorsen wrote:
Hi everyone,
I have been working on getting rid of the compiler warnings on Windows. I'm not sure if I have the proper fix for this one, so I separated it from the others.
TAILQ_EMPTY(head) is defined in extra\libevent\event-internal.h as this:
#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
It's also defined in extra\libevent\compat\sys\queue.h as:
#define TAILQ_FIRST(head) ((head)->tqh_first) #define TAILQ_END(head) NULL #define TAILQ_EMPTY(head) \ (TAILQ_FIRST(head) == TAILQ_END(head))
As you can see, these two are actually identical, but the Visual C++ compiler still complains about them, because it doesn't understand that they are identical.
what if you just delete this whole block from event-internal.h ? In the vanilla libevent sources it's only in compat/sys/queue.h
That works fine, I'll push that instead. Much better. Thanks, Bo.
participants (2)
-
Bo Thorsen
-
Sergei Golubchik