Linux bluetooth development
 help / color / mirror / Atom feed
From: thermal@o2.pl
To: bluez-devel@lists.sourceforge.net
Subject: [Bluez-devel] [PATCH] inline keyword & ansi-C compilers
Date: Mon, 31 Jul 2006 22:32:58 +0200	[thread overview]
Message-ID: <200607312232.58278.thermal@o2.pl> (raw)

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

             reply	other threads:[~2006-07-31 20:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-31 20:32 thermal [this message]
2006-07-31 22:41 ` [Bluez-devel] [PATCH] inline keyword & ansi-C compilers Marcel Holtmann
2006-08-01 16:23   ` thermal
2006-08-02  1:13     ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200607312232.58278.thermal@o2.pl \
    --to=thermal@o2.pl \
    --cc=bluez-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox