2013-10-29 15:23:37

by Szymon Janc

[permalink] [raw]
Subject: [PATCH 1/2] android: Add common place for adding compiler flags in Android.mk

This will contain CFLAGS common for all BlueZ code.
---
android/Android.mk | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/android/Android.mk b/android/Android.mk
index d8f9d0d..c88b27e 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -6,6 +6,9 @@ BLUEZ_VERSION := $(shell grep ^AC_INIT $(LOCAL_PATH)/../configure.ac | cpp -P -D
# Specify pathmap for glib
pathmap_INCL += glib:external/bluetooth/glib

+# Specify common compiler flags
+BLUEZ_COMMON_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\"
+
#
# Android BlueZ daemon (bluetoothd)
#
@@ -39,7 +42,7 @@ LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/../src \
$(LOCAL_PATH)/../lib \

-LOCAL_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\" \
+LOCAL_CFLAGS := $(BLUEZ_COMMON_CFLAGS) \
-DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)

LOCAL_SHARED_LIBRARIES := \
@@ -84,6 +87,8 @@ LOCAL_C_INCLUDES += \
LOCAL_SHARED_LIBRARIES := \
libcutils \

+LOCAL_CFLAGS := $(BLUEZ_COMMON_CFLAGS) \
+
LOCAL_MODULE := bluetooth.default
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_MODULE_TAGS := optional
@@ -112,7 +117,7 @@ LOCAL_SRC_FILES := \
client/if-pan.c \
client/if-sock.c \

-LOCAL_CFLAGS := -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
+LOCAL_CFLAGS := $(BLUEZ_COMMON_CFLAGS)

LOCAL_SHARED_LIBRARIES := libhardware

--
1.8.4.1



2013-10-30 10:10:07

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH 1/2] android: Add common place for adding compiler flags in Android.mk

Hi Szymon,

On Tue, Oct 29, 2013, Szymon Janc wrote:
> This will contain CFLAGS common for all BlueZ code.
> ---
> android/Android.mk | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)

Both patches have been applied. Thanks.

Johan

2013-10-30 09:07:12

by Szymon Janc

[permalink] [raw]
Subject: Re: [PATCH 2/2] android: Suppress compiler warnings not used in autotools build

On Wednesday 30 of October 2013 09:25:03 Szymon Janc wrote:
> Hi Andrei,
>
> On Wednesday 30 of October 2013 10:19:15 Andrei Emeltchenko wrote:
> > Hi Szymon,
> >
> > On Tue, Oct 29, 2013 at 04:23:38PM +0100, Szymon Janc wrote:
> > > Android build system is enabling some additional warnings that are not
> > > enabled when building with autotools. This avoids spurious warnings
> > > while building on Android.
> > > ---
> > > android/Android.mk | 3 +++
> > > 1 file changed, 3 insertions(+)
> > >
> > > diff --git a/android/Android.mk b/android/Android.mk
> > > index c88b27e..fc1b276 100644
> > > --- a/android/Android.mk
> > > +++ b/android/Android.mk
> > > @@ -9,6 +9,9 @@ pathmap_INCL += glib:external/bluetooth/glib
> > > # Specify common compiler flags
> > > BLUEZ_COMMON_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\"
> > >
> > > +# Disable warnings enabled by Android but not enabled in autotools build
> > > +BLUEZ_COMMON_CFLAGS += -Wno-pointer-arith
> >
> > I wouldn't put this to BLUEZ_COMMON_CFLAGS, maybe only bluetoothd target
> > CFLAGS, the issue withing HAL might be easily fixed. We use void pointer
> > in math operations.
>
> This is done on purpose as using void* to operation is simply convenient as
> there is no need for char* casting (and sizeof(void *) == 1 is documented GCC

sizeof(void) == 1 that is.

> feature). Further more I think it will be easier for developers if we can have
> same code guidelines and warnings while building on host and android for all
> components.
>
>



2013-10-30 08:37:51

by Andrei Emeltchenko

[permalink] [raw]
Subject: Re: [PATCH 2/2] android: Suppress compiler warnings not used in autotools build

Hi Szymon,

On Wed, Oct 30, 2013 at 09:25:03AM +0100, Szymon Janc wrote:
> Hi Andrei,
>
> On Wednesday 30 of October 2013 10:19:15 Andrei Emeltchenko wrote:
> > Hi Szymon,
> >
> > On Tue, Oct 29, 2013 at 04:23:38PM +0100, Szymon Janc wrote:
> > > Android build system is enabling some additional warnings that are not
> > > enabled when building with autotools. This avoids spurious warnings
> > > while building on Android.
> > > ---
> > > android/Android.mk | 3 +++
> > > 1 file changed, 3 insertions(+)
> > >
> > > diff --git a/android/Android.mk b/android/Android.mk
> > > index c88b27e..fc1b276 100644
> > > --- a/android/Android.mk
> > > +++ b/android/Android.mk
> > > @@ -9,6 +9,9 @@ pathmap_INCL += glib:external/bluetooth/glib
> > > # Specify common compiler flags
> > > BLUEZ_COMMON_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\"
> > >
> > > +# Disable warnings enabled by Android but not enabled in autotools build
> > > +BLUEZ_COMMON_CFLAGS += -Wno-pointer-arith
> >
> > I wouldn't put this to BLUEZ_COMMON_CFLAGS, maybe only bluetoothd target
> > CFLAGS, the issue withing HAL might be easily fixed. We use void pointer
> > in math operations.
>
> This is done on purpose as using void* to operation is simply convenient as
> there is no need for char* casting (and sizeof(void *) == 1 is documented GCC
> feature). Further more I think it will be easier for developers if we can have
> same code guidelines and warnings while building on host and android for all
> components.

I just sent patch with some fix proposal. I know there are discussions
about this issue, let's maintainers decide on this.

PS: I personally think that casting when assigning 2 pointers is good in a
way it shows you that you cast to a different structure.

Best regards
Andrei Emeltchenko

2013-10-30 08:25:03

by Szymon Janc

[permalink] [raw]
Subject: Re: [PATCH 2/2] android: Suppress compiler warnings not used in autotools build

Hi Andrei,

On Wednesday 30 of October 2013 10:19:15 Andrei Emeltchenko wrote:
> Hi Szymon,
>
> On Tue, Oct 29, 2013 at 04:23:38PM +0100, Szymon Janc wrote:
> > Android build system is enabling some additional warnings that are not
> > enabled when building with autotools. This avoids spurious warnings
> > while building on Android.
> > ---
> > android/Android.mk | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/android/Android.mk b/android/Android.mk
> > index c88b27e..fc1b276 100644
> > --- a/android/Android.mk
> > +++ b/android/Android.mk
> > @@ -9,6 +9,9 @@ pathmap_INCL += glib:external/bluetooth/glib
> > # Specify common compiler flags
> > BLUEZ_COMMON_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\"
> >
> > +# Disable warnings enabled by Android but not enabled in autotools build
> > +BLUEZ_COMMON_CFLAGS += -Wno-pointer-arith
>
> I wouldn't put this to BLUEZ_COMMON_CFLAGS, maybe only bluetoothd target
> CFLAGS, the issue withing HAL might be easily fixed. We use void pointer
> in math operations.

This is done on purpose as using void* to operation is simply convenient as
there is no need for char* casting (and sizeof(void *) == 1 is documented GCC
feature). Further more I think it will be easier for developers if we can have
same code guidelines and warnings while building on host and android for all
components.

--
BR
Szymon Janc


2013-10-30 08:19:15

by Andrei Emeltchenko

[permalink] [raw]
Subject: Re: [PATCH 2/2] android: Suppress compiler warnings not used in autotools build

Hi Szymon,

On Tue, Oct 29, 2013 at 04:23:38PM +0100, Szymon Janc wrote:
> Android build system is enabling some additional warnings that are not
> enabled when building with autotools. This avoids spurious warnings
> while building on Android.
> ---
> android/Android.mk | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/android/Android.mk b/android/Android.mk
> index c88b27e..fc1b276 100644
> --- a/android/Android.mk
> +++ b/android/Android.mk
> @@ -9,6 +9,9 @@ pathmap_INCL += glib:external/bluetooth/glib
> # Specify common compiler flags
> BLUEZ_COMMON_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\"
>
> +# Disable warnings enabled by Android but not enabled in autotools build
> +BLUEZ_COMMON_CFLAGS += -Wno-pointer-arith

I wouldn't put this to BLUEZ_COMMON_CFLAGS, maybe only bluetoothd target
CFLAGS, the issue withing HAL might be easily fixed. We use void pointer
in math operations.

Best regards
Andrei Emeltchenko

2013-10-29 15:23:38

by Szymon Janc

[permalink] [raw]
Subject: [PATCH 2/2] android: Suppress compiler warnings not used in autotools build

Android build system is enabling some additional warnings that are not
enabled when building with autotools. This avoids spurious warnings
while building on Android.
---
android/Android.mk | 3 +++
1 file changed, 3 insertions(+)

diff --git a/android/Android.mk b/android/Android.mk
index c88b27e..fc1b276 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -9,6 +9,9 @@ pathmap_INCL += glib:external/bluetooth/glib
# Specify common compiler flags
BLUEZ_COMMON_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\"

+# Disable warnings enabled by Android but not enabled in autotools build
+BLUEZ_COMMON_CFLAGS += -Wno-pointer-arith
+
#
# Android BlueZ daemon (bluetoothd)
#
--
1.8.4.1