Hi David,
Maybe should be simpler to declare an haproxy "popcount" function with
a generic name:
static inline unsigned int haproxy_popcount(unsigned long a)
And modify the content of the function with the macro:
static inline unsigned int haproxy_popcount(unsigned long a)
{
#if(defined __NetBSD__ && __NetBSD_Version__ >= 600000000)
return popcountl(a);
#else
... <original implementation> ...
#endif
}
This type of modification prevent the multiplication of '#ifdef' in the
Haproxy code.
Thierry.
On Sun, 28 Jun 2015 11:17:25 +0100
David CARLIER <devnexen@gmail.com> wrote:
> Hello all,
>
> Short story :
>
> Haproxy does not compile on NetBSD because conflicting popcount.
>
> Long story :
>
> I was trying to compile Haproxy as unikernel image via rump kernel tools on
> Linux for Xen. The patch series add NetBSD TARGET and checks if we re
> dealing with NetBSD which carry popcount* functions.
> It might have an historical and / or technical reason why NetBSD is not
> included in the supported platform which I ignore. Also, for the sake of
> "simplicity", I may have just used popcount but I find popcountl more
> appropriate for NetBSD's case. I the third patch looks too "invasive" it
> can be safely ignored.
>
> Hope it has any use.
>
> Thanks.
>
> Kind regards.
Maybe should be simpler to declare an haproxy "popcount" function with
a generic name:
static inline unsigned int haproxy_popcount(unsigned long a)
And modify the content of the function with the macro:
static inline unsigned int haproxy_popcount(unsigned long a)
{
#if(defined __NetBSD__ && __NetBSD_Version__ >= 600000000)
return popcountl(a);
#else
... <original implementation> ...
#endif
}
This type of modification prevent the multiplication of '#ifdef' in the
Haproxy code.
Thierry.
On Sun, 28 Jun 2015 11:17:25 +0100
David CARLIER <devnexen@gmail.com> wrote:
> Hello all,
>
> Short story :
>
> Haproxy does not compile on NetBSD because conflicting popcount.
>
> Long story :
>
> I was trying to compile Haproxy as unikernel image via rump kernel tools on
> Linux for Xen. The patch series add NetBSD TARGET and checks if we re
> dealing with NetBSD which carry popcount* functions.
> It might have an historical and / or technical reason why NetBSD is not
> included in the supported platform which I ignore. Also, for the sake of
> "simplicity", I may have just used popcount but I find popcountl more
> appropriate for NetBSD's case. I the third patch looks too "invasive" it
> can be safely ignored.
>
> Hope it has any use.
>
> Thanks.
>
> Kind regards.