1 /* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FOUNDATION_ACE_INTERFACES_INNER_API_ACE_KIT_INCLUDE_BASE_MACROS_H 17 #define FOUNDATION_ACE_INTERFACES_INNER_API_ACE_KIT_INCLUDE_BASE_MACROS_H 18 19 #define ACE_WEAK_SYM __attribute__((weak)) 20 21 #ifndef ACE_FORCE_EXPORT 22 #ifndef WINDOWS_PLATFORM 23 #define ACE_FORCE_EXPORT __attribute__((visibility("default"))) 24 #else 25 #define ACE_FORCE_EXPORT __declspec(dllexport) 26 #endif 27 #endif 28 29 #ifndef ACE_EXPORT 30 #if !defined(HIDDEN_SYMBOL) && !defined(WINDOWS_PLATFORM) 31 #define ACE_EXPORT ACE_FORCE_EXPORT 32 #else 33 #define ACE_EXPORT 34 #endif 35 #endif 36 37 #ifndef CJ_FORCE_EXPORT 38 #ifndef WINDOWS_PLATFORM 39 #define CJ_FORCE_EXPORT ACE_FORCE_EXPORT 40 #else 41 #define CJ_FORCE_EXPORT ACE_EXPORT 42 #endif 43 #endif 44 45 #ifdef ACE_DEBUG 46 47 #ifdef NDEBUG 48 #define CANCEL_NDEBUG 49 #undef NDEBUG 50 #endif // NDEBUG 51 52 #include <cassert> 53 54 #ifdef CANCEL_NDEBUG 55 #define NDEBUG 56 #undef CANCEL_NDEBUG 57 #endif // CANCEL_NDEBUG 58 59 #define ACE_DCHECK(expr) assert(expr) 60 #else 61 #define ACE_DCHECK(expr) ((void)0) 62 63 #endif // ACE_DEBUG 64 65 #define ACE_LIKELY(x) __builtin_expect(!!(x), 1) 66 #define ACE_UNLIKELY(x) __builtin_expect(!!(x), 0) 67 68 #endif // FOUNDATION_ACE_INTERFACES_INNER_API_ACE_KIT_INCLUDE_BASE_MACROS_H 69