[Olsr-dev] [PATCH v1 1/1] android: remove regex code and update API level

Hans-Christoph Steiner (spam-protected)
Fri Oct 19 16:42:43 CEST 2012


On 10/19/2012 10:35 AM, Ferry Huberts wrote:
> 
> 
> On 19-10-12 16:30, Hans-Christoph Steiner wrote:
>>
>> DEBUG=0 made it show up.  This is coming from the -O2, it includes
>> -fstrict-aliasing.  For a while now gcc does not allow type-punning when
>> optimizing because it prevents gcc from being able to do lots of
>> optimizations.  I believe type-punning is no longer allowed at all in C99.
>>
>> But! Looking at the code, it doesn't seem like there is type-punning, so
>> that's a mystery.
>>
> 
> Yeah, one that has baffled me for a long time now.
> I've looked at it a few times but Android was never a prime target so I just
> gave up.
> 
> Try building with OS="linux" and you will not see the warning.
> So maybe we should compare the effective code here between linux and android.
> I suspect there is some problem in the NDK headers.
> 
> The linux build is completely clean of warnings for me.

Yeah the macro is different on android:

/opt/android-ndk/platforms/android-4/arch-arm/usr/include/netinet/in6.h
#define IN6_IS_ADDR_V4MAPPED(a)		      \
	((*(const uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) &&	\
	 (*(const uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) &&	\
	 (*(const uint32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)))


/usr/include/netinet/in.h
# define IN6_IS_ADDR_V4MAPPED(a) \
  (__extension__							      \
   ({ __const struct in6_addr *__a = (__const struct in6_addr *) (a);	      \
      __a->s6_addr32[0] == 0						      \
      && __a->s6_addr32[1] == 0						      \
      && __a->s6_addr32[2] == htonl (0xffff); }))

.hc



> 
>> .hc
>>
>> On 10/19/2012 10:18 AM, Ferry Huberts wrote:
>>> See my build log (I am also using 8b)
>>> Maybe you are not building without debug Hans?
>>>
>>> On 19-10-12 16:11, Hans-Christoph Steiner wrote:
>>>>
>>>>
>>>> On 10/17/2012 03:39 AM, Henning Rogge wrote:
>>>>> On 10/16/2012 09:45 PM, Hans-Christoph Steiner wrote:
>>>>>>
>>>>>> Its easy to get the NDK going on Debian or Ubuntu, install a couple
>>>>>> packages and untar the NDK..  I recommend untarring it in /opt and
>>>>>> making a symlink to the current version called /opt/android-ndk
>>>>>
>>>>> Here is a new patch, which replace the old one. It compiled (on my machine)
>>>>> with the latest Android NDK.
>>>>>
>>>>> But I noticed two "not nice" things:
>>>>>
>>>>>> In file included from ../../src/lq_packet.h:48,
>>>>>>                    from ../../src/lq_plugin.h:48,
>>>>>>                    from ../../src/two_hop_neighbor_table.h:47,
>>>>>>                    from src/olsrd_plugin.h:61,
>>>>>>                    from src/olsrd_httpinfo.h:49,
>>>>>>                    from src/admin_interface.c:47:
>>>>>> ../../src/ipcalc.h: In function 'is_prefix_niit_ipv6':
>>>>>> ../../src/ipcalc.h:166: warning: dereferencing type-punned pointer
>>>>>> will break strict-aliasing rules
>>>>>
>>>>> Seems to be a problem with IN6_IS_ADDR_V4MAPPED(&p->prefix.v6), no clue
>>>>> how to
>>>>> fix this warning.
>>>>
>>>> I'm not seeing this warning on my machine.  I'm using NDK r8b.
>>>>
>>>>
>>>>> 2nd one:
>>>>>
>>>>> /opt/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld:
>>>>>
>>>>>
>>>>> Warning: /opt/android-ndk/platforms/android-4/arch-arm/usr/lib/crtend_so.o:
>>>>> Unknown EABI object attribute 44
>>>>>
>>>>> Seems to be a problem with the NDK itself, I found some people complaining
>>>>> about it on the internet.
>>>>
>>>> I think you can ignore this one, based on my vague recollection of when I
>>>> looked into it.
>>>>
>>>> The patch works for me, I'm fine with it being committed to master.
>>>>
>>>>
>>>> .hc
>>>>
>>>
> 




More information about the Olsr-dev mailing list