Hi Fadden,

On Jul 28, 9:35 am, Elvis Dowson <[email protected]> wrote:
> The error that I get is related to the v2.6.31 bionic/libc/
> kernel/common/linux/tcp.h file, line 60
>
> enum {
>  TCP_FLAG_CWR = __cpu_to_be32(0x00800000),
>  TCP_FLAG_ECE = __cpu_to_be32(0x00400000),
>  TCP_FLAG_URG = __cpu_to_be32(0x00200000),
>  TCP_FLAG_ACK = __cpu_to_be32(0x00100000),
>  TCP_FLAG_PSH = __cpu_to_be32(0x00080000),
>  TCP_FLAG_RST = __cpu_to_be32(0x00040000),
>  TCP_FLAG_SYN = __cpu_to_be32(0x00020000),
>  TCP_FLAG_FIN = __cpu_to_be32(0x00010000),
>  TCP_RESERVED_BITS = __cpu_to_be32(0x0F000000),
>  TCP_DATA_OFFSET = __cpu_to_be32(0xF0000000)
>
> };
>
> the error is :
>
> In file included from bionic/libc/include/netinet/tcp.h:32,
>                  from frameworks/base/core/jni/
> android_net_LocalSocketImpl.cpp:37:
> bionic/libc/kernel/common/linux/tcp.h:62: error: a function call
> cannot appear in a constant-expression

If I replace all calls to __cpu_to_be32(0x00800000) with
__constant_cpu_to_be32, as follows, compilation proceeds.

enum {
 TCP_FLAG_CWR = __constant_cpu_to_be32(0x00800000),
 TCP_FLAG_ECE = __constant_cpu_to_be32(0x00400000),
 TCP_FLAG_URG = __constant_cpu_to_be32(0x00200000),
 TCP_FLAG_ACK = __constant_cpu_to_be32(0x00100000),
 TCP_FLAG_PSH = __constant_cpu_to_be32(0x00080000),
 TCP_FLAG_RST = __constant_cpu_to_be32(0x00040000),
 TCP_FLAG_SYN = __constant_cpu_to_be32(0x00020000),
 TCP_FLAG_FIN = __constant_cpu_to_be32(0x00010000),
 TCP_RESERVED_BITS = __constant_cpu_to_be32(0x0F000000),
 TCP_DATA_OFFSET = __constant_cpu_to_be32(0xF0000000)
};

What do you think? Is this change ok, since it is an enum definition,
assigning a constant value should be ok, right?

Best regards,

Elvis
--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---

Reply via email to