X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fpublic-api%2Fcommon%2Fdali-common.h;h=d5424f8762ad277616e7d48bc5778ab19a085312;hb=a770afdd3196e242b4938dfb2cbec3b5666593b2;hp=4b7c4aaf877d5b32753257a2e5066966d862cfd9;hpb=8bccadc96b3773fb10c562a5ccdf1b071b2efe8e;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/public-api/common/dali-common.h b/dali/public-api/common/dali-common.h index 4b7c4aa..d5424f8 100755 --- a/dali/public-api/common/dali-common.h +++ b/dali/public-api/common/dali-common.h @@ -1,8 +1,8 @@ -#ifndef __DALI_COMMON_H__ -#define __DALI_COMMON_H__ +#ifndef DALI_COMMON_H +#define DALI_COMMON_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,9 +23,9 @@ /* * Definitions for shared library support. * - * If a library is configured with --enable-exportall or --enable-debug + * If a library is built with -DENABLE_EXPORTALL=ON or -DENABLE_DEBUG=ON * then HIDE_DALI_INTERNALS is not defined, and nothing is hidden. - * If it is configured without these options (the default), then HIDE_INTERNALS + * If it is built without these options (the default), then HIDE_INTERNALS * is defined when building the library, visibility is automatically hidden, and the explicit * defines below come into use. * When building a library that uses DALI, HIDE_DALI_INTERNALS. @@ -43,12 +43,26 @@ # define DALI_INTERNAL __attribute__ ((visibility ("hidden"))) # endif #else -/** Visibility attribute to show method definitions */ +#ifdef WIN32 + /** Visibility attribute to show declarations */ +# define DALI_EXPORT_API __declspec(dllexport) + +#ifdef BUILDING_DALI_CORE + /** Visibility attribute to hide declarations */ +# define DALI_CORE_API __declspec(dllexport) +#else +/** Visibility attribute to hide declarations */ +# define DALI_CORE_API __declspec(dllimport) +#endif + +#else + /** Visibility attribute to show declarations */ # define DALI_EXPORT_API /** Visibility attribute to show declarations */ # define DALI_IMPORT_API /** Visibility attribute to show declarations */ # define DALI_CORE_API +#endif /** Visibility attribute to hide declarations */ # define DALI_INTERNAL #endif @@ -73,8 +87,13 @@ * DALI_UNLIKELY should be used when a branch is almost never taken. * @SINCE_1_0.0 */ +#ifdef __GNUC #define DALI_LIKELY(expression) __builtin_expect( !!(expression), 1 ) #define DALI_UNLIKELY(expression) __builtin_expect( !!(expression), 0 ) +#else +#define DALI_LIKELY(expression) !!(expression) +#define DALI_UNLIKELY(expression) !!(expression) +#endif /** * @brief The DALi namespace. @@ -150,7 +169,11 @@ public: * @SINCE_1_0.0 */ #if defined(DEBUG_ENABLED) +#if defined(WIN32) +#define ASSERT_LOCATION __FUNCSIG__ +#else #define ASSERT_LOCATION __PRETTY_FUNCTION__ +#endif #else #define ASSERT_LOCATION NULL #endif @@ -180,4 +203,11 @@ public: #define DALI_ASSERT_DEBUG(cond) #endif -#endif // __DALI_COMMON_H__ +/// Use DALI_FALLTHROUGH in switch statements where one case is supposed to fall through into another case +#if __has_cpp_attribute(fallthrough) +#define DALI_FALLTHROUGH [[fallthrough]] +#else +#define DALI_FALLTHROUGH +#endif + +#endif // DALI_COMMON_H