[IOT-2539] Clean implicit-function warning
authorGeorge Nash <george.nash@intel.com>
Tue, 1 Aug 2017 19:34:06 +0000 (12:34 -0700)
committerGeorge Nash <george.nash@intel.com>
Mon, 28 Aug 2017 23:18:39 +0000 (23:18 +0000)
pmutility.c code would give an implicit-funtion-declaration
warning when the usleep function was used. On linux the
usleep function is part of unistd.h which was already
included.

usleep is not exposed unless _DEFAULT_SOURCE or _BSD_SOURCE
is defined before including unistd.h. To prevent another warning
[-Wcpp] both macros are included. As directed in the glibc
release notes:
https://sourceware.org/glibc/wiki/Release/2.20#Packaging_Changes

Bug: https://jira.iotivity.org/browse/IOT-2539
Change-Id: I7002ef303ba685bda76f70590d7c9593435b4ba7
Signed-off-by: George Nash <george.nash@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/21707
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
(cherry picked from commit f00086bf5f66b31e77c7d11c2780d75cd0e95150)

resource/csdk/security/provisioning/src/pmutility.c

index 3f9fde8..0009d3a 100644 (file)
 #define _POSIX_C_SOURCE 200112L
 #endif
 
+/* Legacy feature macro. For older versions of glibc < 2.19 */
+#define _BSD_SOURCE
+/* New feature macro that provides everything _BSD_SOURCE and more glibc >= 2.20 */
+#define _DEFAULT_SOURCE
+
 #include "iotivity_config.h"
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>