From 7d5ff0b74b29dac8c413b5707e18453876b608cd Mon Sep 17 00:00:00 2001
From: Alex Blasche <alexander.blasche@qt.io>
Date: Wed, 19 Jul 2017 10:03:17 +0200
Subject: [PATCH] Make bluez compile test pass again
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The compiler error is:

In file included from main.cpp:29:0:
main.cpp: In function 'int main()'
main.cpp:33:11: error: taking address of temporary [-fpermissive]
     bacmp(BDADDR_ANY, BDADDR_NONE);
           ^
main.cpp:33:23: error: 'BDADDR_NONE' was not declared in this scope
     bacmp(BDADDR_ANY, BDADDR_NONE);

BDADDR_NONE only exists in Linux iBluetooth kernel headers but not in the
Bluez project headers. Furthermore the usage of the BDADDR_* defines
is known to trigger -fpermissive violations. For the prupose of this test
fpermissive is not relevant as the test is never executed and the focus
is in checking the existence of the very same defines.

Change-Id: I56db5406ec91fdd5e7998cac4900ee9f9b628c00
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
---
 config.tests/bluez/bluez.pro | 4 ++++
 config.tests/bluez/main.cpp  | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/config.tests/bluez/bluez.pro b/config.tests/bluez/bluez.pro
index 28dcadcb..8bbff78a 100644
--- a/config.tests/bluez/bluez.pro
+++ b/config.tests/bluez/bluez.pro
@@ -1 +1,5 @@
 SOURCES += main.cpp
+
+# test checks existence of certain bluez defines whose
+# usage is known to violate the permissive test
+QMAKE_CXXFLAGS += -fpermissive
diff --git a/config.tests/bluez/main.cpp b/config.tests/bluez/main.cpp
index bfc2a0c5..3fe5ee09 100644
--- a/config.tests/bluez/main.cpp
+++ b/config.tests/bluez/main.cpp
@@ -30,6 +30,11 @@
 
 int main()
 {
+#ifdef BDADDR_NONE
     bacmp(BDADDR_ANY, BDADDR_NONE);
+#else
+    bacmp(BDADDR_ANY, BDADDR_LOCAL);
+#endif
+
     return 0;
 }
-- 
GitLab