summaryrefslogtreecommitdiffstats
path: root/osi/include
diff options
context:
space:
mode:
authorChris Manton <cmanton@google.com>2015-01-06 15:45:41 -0800
committerAndre Eisenbach <eisenbach@google.com>2015-03-16 16:51:41 -0700
commite17abd8cc1394db0da61c56e6a466f92b58d2125 (patch)
tree48a93ff9510bd83db964e6d512f61a929fa57c07 /osi/include
parent3623bc8d9533f30c96dc17e50cd5dc2baf0799a4 (diff)
downloadandroid_system_bt-e17abd8cc1394db0da61c56e6a466f92b58d2125.tar.gz
android_system_bt-e17abd8cc1394db0da61c56e6a466f92b58d2125.tar.bz2
android_system_bt-e17abd8cc1394db0da61c56e6a466f92b58d2125.zip
Add compile time checks
Diffstat (limited to 'osi/include')
-rw-r--r--osi/include/osi.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/osi/include/osi.h b/osi/include/osi.h
index 6928e0c1a..c035bf810 100644
--- a/osi/include/osi.h
+++ b/osi/include/osi.h
@@ -7,4 +7,16 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define INVALID_FD (-1)
+#define CONCAT(a, b) a##b
+
+// Use during compile time to check conditional values
+// NOTE: The the failures will present as a generic error
+// "error: initialization makes pointer from integer without a cast"
+// but the file and line number will present the condition that
+// failed.
+#define DUMMY_COUNTER(c) CONCAT(__osi_dummy_, c)
+#define DUMMY_PTR DUMMY_COUNTER(__COUNTER__)
+
+#define COMPILE_ASSERT(x) char * DUMMY_PTR = !(x)
+
typedef uint32_t timeout_t;