2012-07-29 06:30:34

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 1/2] tools: Fix workaround to build with recent flex

Flex 2.5.36 no longer defines isatty(), resulting in the following build
error:

tools/lexer.c:1402:9: error: implicit declaration of function
‘isatty’ [-Werror=implicit-function-declaration]

Include the header unistd.h so we get the definition of that function
and at the same time keep the fix for older versions of flex, since this
header defines _UNISTD_H.
---
tools/lexer.l | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/lexer.l b/tools/lexer.l
index ff9ce81..0d449ac 100644
--- a/tools/lexer.l
+++ b/tools/lexer.l
@@ -26,9 +26,7 @@
#include <config.h>
#endif

-/* Nasty workaround, but flex defines isatty() twice */
-#define _UNISTD_H
-
+#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <sys/socket.h>
--
1.7.11.3



2012-07-29 16:31:54

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/2] tools: Fix workaround to build with recent flex

Hi Lucas,

> Flex 2.5.36 no longer defines isatty(), resulting in the following build
> error:
>
> tools/lexer.c:1402:9: error: implicit declaration of function
> ‘isatty’ [-Werror=implicit-function-declaration]
>
> Include the header unistd.h so we get the definition of that function
> and at the same time keep the fix for older versions of flex, since this
> header defines _UNISTD_H.

lets remove the rfcomm.conf support from rfcomm utility and then move it
under tools/. So no more need for flex or bison.

Regards

Marcel



2012-07-29 06:30:35

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 2/2] build-sys: Don't use -Werror for generated lexer.c

Source files that are generated by tools can't be compiled with -Werror
because we can't really fix the issue in version of the tools that was
already release and is used by distributions.

After updating to flex 2.5.36 the following error occurs:

tools/lexer.c:1599:17: error: comparison between signed and
unsigned integer expressions [-Werror=sign-compare]

Override -Werror with -Wno-error for this specific file so warning is
still emitted but we no longer fail the build.
---
Makefile.tools | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/Makefile.tools b/Makefile.tools
index 5579b86..1499bf7 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -14,11 +14,15 @@ noinst_PROGRAMS += tools/avinfo tools/ppporc \

tools/kword.c: tools/parser.h

-tools_rfcomm_SOURCES = tools/rfcomm.c tools/parser.y tools/lexer.l \
- tools/kword.h tools/kword.c
+noinst_LTLIBRARIES += tools/librfcomm-lexer.la
+tools_librfcomm_lexer_la_SOURCES = tools/lexer.l
+tools_librfcomm_lexer_la_CFLAGS = $(AM_CFLAGS) -Wno-error
+
+tools_rfcomm_SOURCES = tools/rfcomm.c tools/parser.y tools/kword.h \
+ tools/kword.c
EXTRA_tools_rfcomm_SOURCES = tools/parser.h tools/parser.c \
tools/lexer.c
-tools_rfcomm_LDADD = lib/libbluetooth-private.la
+tools_rfcomm_LDADD = lib/libbluetooth-private.la tools/librfcomm-lexer.la

tools_l2ping_LDADD = lib/libbluetooth-private.la

--
1.7.11.3