Public bluetooth.h API requires use of GNU extensions

Bug #950032 reported by Ingo Ruhnke
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
bluez (Ubuntu)
Invalid
Low
Unassigned

Bug Description

Compiling code that uses the gcc -ansi flag no longer works with libbluetooth-dev, as the public API now makes use of typeof() which is a GNU extension and disabled by the -ansi flag.

$ cat main.c
#include <bluetooth/bluetooth.h>
int main() { return 0; }

$ gcc main.c -o main -ansi
In file included from main.c:1:0:
/usr/include/bluetooth/bluetooth.h:131:1: error: unknown type name ‘inline’
/usr/include/bluetooth/bluetooth.h:131:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘bt_get_le64’
/usr/include/bluetooth/bluetooth.h:136:1: error: unknown type name ‘inline’
/usr/include/bluetooth/bluetooth.h:136:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘bt_get_be64’
/usr/include/bluetooth/bluetooth.h:141:1: error: unknown type name ‘inline’
/usr/include/bluetooth/bluetooth.h:141:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘bt_get_le32’
/usr/include/bluetooth/bluetooth.h:146:1: error: unknown type name ‘inline’
/usr/include/bluetooth/bluetooth.h:146:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘bt_get_be32’
/usr/include/bluetooth/bluetooth.h:151:1: error: unknown type name ‘inline’
/usr/include/bluetooth/bluetooth.h:151:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘bt_get_le16’
/usr/include/bluetooth/bluetooth.h:156:1: error: unknown type name ‘inline’
/usr/include/bluetooth/bluetooth.h:156:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘bt_get_be16’
/usr/include/bluetooth/bluetooth.h:204:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’
/usr/include/bluetooth/bluetooth.h:208:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
/usr/include/bluetooth/bluetooth.h:255:1: error: unknown type name ‘inline’
/usr/include/bluetooth/bluetooth.h:255:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ntoh64’
/usr/include/bluetooth/bluetooth.h:266:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
/usr/include/bluetooth/bluetooth.h:274:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’

$ apt-cache policy libbluetooth-dev
libbluetooth-dev:
  Installed: 4.98-2ubuntu4
  Candidate: 4.98-2ubuntu4
  Version table:
 *** 4.98-2ubuntu4 0
        500 http://de.archive.ubuntu.com/ubuntu/ precise/main i386 Packages
        100 /var/lib/dpkg/status

$ lsb_release -rd
Description: Ubuntu precise (development branch)
Release: 12.04

Changed in bluez (Ubuntu):
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

This is an issue that should be worked on upstream. As far as I know, there was a "conscious" decision to use typeof there to support different other uses of compiling against bluetooth.h, especially for C++ applications.

Please see http://www.bluez.org/contact/ for how to report this bug upstream, then comment here with a link to the discussion if possible.

Thanks in advance!

Revision history for this message
Konrad Zapałowicz (kzapalowicz) wrote :

This is reported against an old version of Ubuntu and many things has changed since then. Because of that we won't fix this issue however if this behavior repeats on a modern version please fill a bug report against it and we will take it from there.

Changed in bluez (Ubuntu):
status: Triaged → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.