zigbee_wrapper: Do IEEE754 test at runtime
authorPhilippe Coval <philippe.coval@osg.samsung.com>
Wed, 29 Mar 2017 12:44:06 +0000 (14:44 +0200)
committerJoseph Morrow <joseph.l.morrow@intel.com>
Thu, 30 Mar 2017 18:02:42 +0000 (18:02 +0000)
Some systems (Tizen) havent __STDC_IEC_559__ defined
while sizeof(double) = 8, build breaks.

Moving test to run time is more flexible

For the record:
  BUILD_ID=tizen-ivi_20170328.2_ivi-target-odroidxu3
  gcc -dM -E - < /dev/null | grep 559
  #define __GCC_IEC_559_COMPLEX 0
  #define __GCC_IEC_559 0

Change-Id: I427188afcb6178e9a5e15c341185eb1b3d951fc8
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18333
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Joseph Morrow <joseph.l.morrow@intel.com>
Tested-by: Joseph Morrow <joseph.l.morrow@intel.com>
plugins/zigbee_wrapper/src/zigbee_wrapper.c

index 7087fc3..6f96e02 100644 (file)
@@ -42,7 +42,7 @@
 // then we are guaranteed that the 'double' type is 64-bit. Otherwise, the
 // compilation of this file should fail because we are no longer guaranteed.
 #ifndef __STDC_IEC_559__
-#error "Requires IEEE 754 floating point!"
+#warning "Requires IEEE 754 floating point!"
 #endif
 
 #include "zigbee_wrapper.h"
@@ -435,6 +435,10 @@ OCStackResult ZigbeeInit(const char * comPort, PIPlugin_Zigbee ** plugin,
                          PINewResourceFound newResourceCB,
                          PIObserveNotificationUpdate observeNotificationUpdate)
 {
+    if (sizeof(double) != 64/8)
+    {
+        return OC_STACK_ERROR;
+    }
     if (!plugin)
     {
         return OC_STACK_INVALID_PARAM;