linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/2] build: Fix --disable-optimization configure option
@ 2013-01-08 15:46 Anderson Lizardo
  2013-01-08 15:46 ` [PATCH BlueZ 2/2] attrib: Fix compilation errors when compiled without optimization Anderson Lizardo
  2013-01-11  0:31 ` [PATCH BlueZ 1/2] build: Fix --disable-optimization configure option Marcel Holtmann
  0 siblings, 2 replies; 4+ messages in thread
From: Anderson Lizardo @ 2013-01-08 15:46 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

On commit cc9e4e7cae0379864ea06038d92bf7ecc192bba7, this flag was
mistakenly replaced with the behavior of the old --enable-fortify
option.

This patch restores the "-O0" flag when --disable-optimization is used.

Unfortunately, this is not enough to disable build optimization. By
default, autoconf adds -O2 to CFLAGS if the compiler is GCC. AM_CFLAGS
(where -O0 is added with --disable-optimization) is passed as argument
to GCC before autoconf CFLAGS, so it is not possible to override the
default -O2. One solution is to use:

CFLAGS= ./configure --disable-optimization

i.e. remove -O2 from CFLAGS, and let autoconf add -O0.
---
 acinclude.m4 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 4357c00..286340d 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -32,7 +32,7 @@ AC_DEFUN([MISC_FLAGS], [
 	AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
 			[disable code optimization through compiler]), [
 		if (test "${enableval}" = "no"); then
-			misc_cflags="$misc_cflags -D_FORTIFY_SOURCE=2"
+			misc_cflags="$misc_cflags -O0"
 		fi
 	])
 	AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH BlueZ 2/2] attrib: Fix compilation errors when compiled without optimization
  2013-01-08 15:46 [PATCH BlueZ 1/2] build: Fix --disable-optimization configure option Anderson Lizardo
@ 2013-01-08 15:46 ` Anderson Lizardo
  2013-01-11  0:06   ` Marcel Holtmann
  2013-01-11  0:31 ` [PATCH BlueZ 1/2] build: Fix --disable-optimization configure option Marcel Holtmann
  1 sibling, 1 reply; 4+ messages in thread
From: Anderson Lizardo @ 2013-01-08 15:46 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

Fix these build errors:

attrib/att.c: In function ‘dec_read_by_grp_req’:
attrib/att.c:165:10: error: comparison between signed and unsigned
integer expressions [-Werror=sign-compare]
attrib/att.c:170:10: error: comparison between signed and unsigned
integer expressions [-Werror=sign-compare]
attrib/att.c: In function ‘dec_read_by_type_req’:
attrib/att.c:393:10: error: comparison between signed and unsigned
integer expressions [-Werror=sign-compare]
attrib/att.c:402:10: error: comparison between signed and unsigned
integer expressions [-Werror=sign-compare]
---
 attrib/att.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/attrib/att.c b/attrib/att.c
index de11811..fe66821 100644
--- a/attrib/att.c
+++ b/attrib/att.c
@@ -151,7 +151,7 @@ uint16_t enc_read_by_grp_req(uint16_t start, uint16_t end, bt_uuid_t *uuid,
 uint16_t dec_read_by_grp_req(const uint8_t *pdu, size_t len, uint16_t *start,
 						uint16_t *end, bt_uuid_t *uuid)
 {
-	const uint16_t min_len = sizeof(pdu[0]) + sizeof(*start) + sizeof(*end);
+	const size_t min_len = sizeof(pdu[0]) + sizeof(*start) + sizeof(*end);
 
 	if (pdu == NULL)
 		return 0;
@@ -382,7 +382,7 @@ uint16_t enc_read_by_type_req(uint16_t start, uint16_t end, bt_uuid_t *uuid,
 uint16_t dec_read_by_type_req(const uint8_t *pdu, size_t len, uint16_t *start,
 						uint16_t *end, bt_uuid_t *uuid)
 {
-	const uint16_t min_len = sizeof(pdu[0]) + sizeof(*start) + sizeof(*end);
+	const size_t min_len = sizeof(pdu[0]) + sizeof(*start) + sizeof(*end);
 
 	if (pdu == NULL)
 		return 0;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH BlueZ 2/2] attrib: Fix compilation errors when compiled without optimization
  2013-01-08 15:46 ` [PATCH BlueZ 2/2] attrib: Fix compilation errors when compiled without optimization Anderson Lizardo
@ 2013-01-11  0:06   ` Marcel Holtmann
  0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2013-01-11  0:06 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth

Hi Anderzon,

> Fix these build errors:
> 
> attrib/att.c: In function ‘dec_read_by_grp_req’:
> attrib/att.c:165:10: error: comparison between signed and unsigned
> integer expressions [-Werror=sign-compare]
> attrib/att.c:170:10: error: comparison between signed and unsigned
> integer expressions [-Werror=sign-compare]
> attrib/att.c: In function ‘dec_read_by_type_req’:
> attrib/att.c:393:10: error: comparison between signed and unsigned
> integer expressions [-Werror=sign-compare]
> attrib/att.c:402:10: error: comparison between signed and unsigned
> integer expressions [-Werror=sign-compare]
> ---
>  attrib/att.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

patch has been applied.

Regards

Marcel



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH BlueZ 1/2] build: Fix --disable-optimization configure option
  2013-01-08 15:46 [PATCH BlueZ 1/2] build: Fix --disable-optimization configure option Anderson Lizardo
  2013-01-08 15:46 ` [PATCH BlueZ 2/2] attrib: Fix compilation errors when compiled without optimization Anderson Lizardo
@ 2013-01-11  0:31 ` Marcel Holtmann
  1 sibling, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2013-01-11  0:31 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth

Hi Anderson,

> On commit cc9e4e7cae0379864ea06038d92bf7ecc192bba7, this flag was
> mistakenly replaced with the behavior of the old --enable-fortify
> option.
> 
> This patch restores the "-O0" flag when --disable-optimization is used.
> 
> Unfortunately, this is not enough to disable build optimization. By
> default, autoconf adds -O2 to CFLAGS if the compiler is GCC. AM_CFLAGS
> (where -O0 is added with --disable-optimization) is passed as argument
> to GCC before autoconf CFLAGS, so it is not possible to override the
> default -O2. One solution is to use:
> 
> CFLAGS= ./configure --disable-optimization
> 
> i.e. remove -O2 from CFLAGS, and let autoconf add -O0.
> ---
>  acinclude.m4 |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

patch has been applied.

Regards

Marcel



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-01-11  0:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-08 15:46 [PATCH BlueZ 1/2] build: Fix --disable-optimization configure option Anderson Lizardo
2013-01-08 15:46 ` [PATCH BlueZ 2/2] attrib: Fix compilation errors when compiled without optimization Anderson Lizardo
2013-01-11  0:06   ` Marcel Holtmann
2013-01-11  0:31 ` [PATCH BlueZ 1/2] build: Fix --disable-optimization configure option Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).