1 //******************************************************************
3 // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //******************************************************************
24 * This file contains compiler and platform feature definitions. These
25 * can be used to enable functionality on only platforms that support
29 #ifndef PLATFORM_FEATURES_H_
30 #define PLATFORM_FEATURES_H_
33 #if (__cplusplus >=201103L) || defined(__GXX_EXPERIMENTAL_CXX0X__)
34 #define SUPPORTS_DEFAULT_CTOR
37 #if (__STDC_VERSION__ >= 201112L)
39 #define OC_STATIC_ASSERT(condition, msg) static_assert(condition, msg)
41 #if defined(__msys_nt__) && !defined(__cplusplus)
42 #define static_assert _Static_assert
44 #define OC_STATIC_ASSERT(condition, msg) static_assert(condition, msg)
46 #define OC_STATIC_ASSERT(condition, msg) ((void)sizeof(char[2*!!(condition) - 1]))
50 # if defined(__cplusplus)
51 # define INLINE_API inline
54 # define INLINE_API static __inline
56 # define INLINE_API static inline
63 # define OC_EXPORT __declspec(dllexport)
65 # define OC_EXPORT __declspec(dllimport)
67 # ifdef ENABLE_TEST_EXPORTS
68 # define OC_EXPORT_TEST OC_EXPORT
70 # define OC_EXPORT_TEST
72 # define OC_ANNOTATE_UNUSED
74 # define OC_ANNOTATE_UNUSED __attribute__((unused))
76 # define OC_EXPORT_TEST
80 # define __func__ __FUNCTION__
81 # define strncasecmp _strnicmp
82 # define strtok_r strtok_s
83 # if _MSC_VER && (_MSC_VER < 1900)
84 # include "windows/include/vs12_snprintf.h"
86 # define ssize_t SSIZE_T
88 # define sleep(SECS) Sleep(1000*(SECS))
90 # define SUPPORTS_DEFAULT_CTOR
92 # include "windows/include/win_sleep.h"
93 # include "windows/include/pthread_create.h"
96 #ifdef HAVE_WINSOCK2_H
97 # define OPTVAL_T(t) (const char*)(t)
99 # define OPTVAL_T(t) (t)