Linux bluetooth development
 help / color / mirror / Atom feed
* [Bluez-devel] [PATCH] inline keyword & ansi-C compilers
@ 2006-07-31 20:32 thermal
  2006-07-31 22:41 ` Marcel Holtmann
  0 siblings, 1 reply; 4+ messages in thread
From: thermal @ 2006-07-31 20:32 UTC (permalink / raw)
  To: bluez-devel

Hi

Recently when I`ve tried to compile KDE (ktnef to be exact) I came upon 
an error in your include files:

configure:34044: result: /usr/bin/doxygen
configure:34133: checking bluetooth/bluetooth.h usability
configure:34145: 
i686-pc-linux-gnu-gcc -c -std=iso9899:1990 -W -Wall -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes
 -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -DNDEBUG -O2  -O2 -march=k6 -mtune=athlon-xp -pipe -Wformat-security -Wmissing-fo
rmat-attribute  -DQT_THREAD_SUPPORT  -D_REENTRANT conftest.c >&5
In file included from conftest.c:101:
/usr/include/bluetooth/bluetooth.h:113: error: 
expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
/usr/include/bluetooth/bluetooth.h:117: error: 
expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
configure:34151: $? = 1

After checking the header file it became clear that the 'inline' keyword 
is responsible for the mess. As you can see ./configure is executing 
gcc with -std=iso9899:1990 flag which sets the language dialect to pure 
C89. Unfortunately this dialect doesn`t support the 'inline' keyword. 
To reproduce this bug try:

thermal@newhope ~ $ cat > a.c
#include <bluetooth.h>
thermal@newhope ~ $ gcc -std=iso9899:1990 -c -I ~/bluez-libs-3.2/include 
a.c
In file included from a.c:1:
/home/thermal/bluez-libs-3.2/include/bluetooth.h:113: error: 
expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
/home/thermal/bluez-libs-3.2/include/bluetooth.h:117: error: 
expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
thermal@newhope ~ $

So I wrote a tiny patch to fix this:

--- bluez-libs-3.2/include/bluetooth.h  2006-07-31 20:57:08.000000000 
+0200
+++ /usr/include/bluetooth/bluetooth.h  2006-07-31 20:55:55.000000000 
+0200
@@ -109,12 +109,19 @@
 #define BDADDR_ALL   (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 
0xff}})
 #define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}})

+/* No inline keyword in the iso8988:1990 standard */
+#ifdef __STRICT_ANSI__
+    #define __INLINE
+#else
+    #define __INLINE inline
+#endif
+
 /* Copy, swap, convert BD Address */
-static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2)
+static __INLINE int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2)
 {
        return memcmp(ba1, ba2, sizeof(bdaddr_t));
 }
-static inline void bacpy(bdaddr_t *dst, const bdaddr_t *src)
+static __INLINE void bacpy(bdaddr_t *dst, const bdaddr_t *src)
 {
        memcpy(dst, src, sizeof(bdaddr_t));
 }

After applying it all compiles nicely:

thermal@newhope ~ $ cat > a.c
#include <bluetooth/bluetooth.h>
thermal@newhope ~ $ gcc -std=iso9899:1990 -c a.c
thermal@newhope ~ $

(Note: my patched header file lives in /usr/inlude/bluetooth). It would 
be nice if the patch was included in the main source.

-- 
|   ******* Maciek Grela RV409b *********
|        JID: thermal@jabber.wroc.pl
| Linux user #319794 ++ There is no spoon ...

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] [PATCH] inline keyword & ansi-C compilers
  2006-07-31 20:32 [Bluez-devel] [PATCH] inline keyword & ansi-C compilers thermal
@ 2006-07-31 22:41 ` Marcel Holtmann
  2006-08-01 16:23   ` thermal
  0 siblings, 1 reply; 4+ messages in thread
From: Marcel Holtmann @ 2006-07-31 22:41 UTC (permalink / raw)
  To: BlueZ development

Hi,

> Recently when I`ve tried to compile KDE (ktnef to be exact) I came upon 
> an error in your include files:

no idea what ktnef has to do with BlueZ. This seems to be the main
problem here.

> So I wrote a tiny patch to fix this:
> 
> --- bluez-libs-3.2/include/bluetooth.h  2006-07-31 20:57:08.000000000 
> +0200
> +++ /usr/include/bluetooth/bluetooth.h  2006-07-31 20:55:55.000000000 
> +0200
> @@ -109,12 +109,19 @@
>  #define BDADDR_ALL   (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 
> 0xff}})
>  #define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}})
> 
> +/* No inline keyword in the iso8988:1990 standard */
> +#ifdef __STRICT_ANSI__
> +    #define __INLINE
> +#else
> +    #define __INLINE inline
> +#endif
> +

I don't like to provide any workarounds for any crazy standard that
forcing it makes no real sense to me. However what about this:

#ifdef __STRICT_ANSI__
#define inline
#endif

Regards

Marcel



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] [PATCH] inline keyword & ansi-C compilers
  2006-07-31 22:41 ` Marcel Holtmann
@ 2006-08-01 16:23   ` thermal
  2006-08-02  1:13     ` Marcel Holtmann
  0 siblings, 1 reply; 4+ messages in thread
From: thermal @ 2006-08-01 16:23 UTC (permalink / raw)
  To: BlueZ development

On wtorek, 1 sierpnia 2006 00:41, Marcel Holtmann wrote:
> Hi,
>
> > Recently when I`ve tried to compile KDE (ktnef to be exact) I came
> > upon an error in your include files:
>
> no idea what ktnef has to do with BlueZ. This seems to be the main
> problem here.
>

Yes, this may look a bit weird but ktnef is a part of the kdepim source 
bundle which contains addressbook, organizer, etc. and thus can make 
use of Bluetooth.

>
> #ifdef __STRICT_ANSI__
> #define inline
> #endif
>

You`re right, that will be much better.

-- 
|   ******* Maciek Grela RV409b *********
|        JID: thermal@jabber.wroc.pl
| Linux user #319794 ++ There is no spoon ...

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] [PATCH] inline keyword & ansi-C compilers
  2006-08-01 16:23   ` thermal
@ 2006-08-02  1:13     ` Marcel Holtmann
  0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2006-08-02  1:13 UTC (permalink / raw)
  To: BlueZ development

Hi,

> > > Recently when I`ve tried to compile KDE (ktnef to be exact) I came
> > > upon an error in your include files:
> >
> > no idea what ktnef has to do with BlueZ. This seems to be the main
> > problem here.
> >
> 
> Yes, this may look a bit weird but ktnef is a part of the kdepim source 
> bundle which contains addressbook, organizer, etc. and thus can make 
> use of Bluetooth.
> 
> >
> > #ifdef __STRICT_ANSI__
> > #define inline
> > #endif
> >
> 
> You`re right, that will be much better.

and why not including this into the ktnef source. I personally don't
like this hack to be in bluez-libs.

Regards

Marcel



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

end of thread, other threads:[~2006-08-02  1:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-31 20:32 [Bluez-devel] [PATCH] inline keyword & ansi-C compilers thermal
2006-07-31 22:41 ` Marcel Holtmann
2006-08-01 16:23   ` thermal
2006-08-02  1:13     ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox