1 /** @file 2 3 A brief file description 4 5 @section license License 6 7 Licensed to the Apache Software Foundation (ASF) under one 8 or more contributor license agreements. See the NOTICE file 9 distributed with this work for additional information 10 regarding copyright ownership. The ASF licenses this file 11 to you under the Apache License, Version 2.0 (the 12 "License"); you may not use this file except in compliance 13 with the License. You may obtain a copy of the License at 14 15 http://www.apache.org/licenses/LICENSE-2.0 16 17 Unless required by applicable law or agreed to in writing, software 18 distributed under the License is distributed on an "AS IS" BASIS, 19 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 See the License for the specific language governing permissions and 21 limitations under the License. 22 */ 23 24 #pragma once 25 26 #define inkliapi 27 #define inkcoreapi 28 #define ink_undoc_liapi 29 #define ink_undoc_coreapi inkcoreapi 30 31 #if defined(__GNUC__) || defined(__clang__) 32 #ifndef likely 33 #define likely(x) __builtin_expect(!!(x), 1) 34 #endif 35 #ifndef unlikely 36 #define unlikely(x) __builtin_expect(!!(x), 0) 37 #endif 38 #else 39 #ifndef likely 40 #define likely(x) (x) 41 #endif 42 #ifndef unlikely 43 #define unlikely(x) (x) 44 #endif 45 #endif 46 47 #if !defined(TS_NORETURN) 48 #if defined(__GNUC__) || defined(__clang__) 49 #define TS_NORETURN __attribute__((noreturn)) 50 #else 51 #define TS_NORETURN 52 #endif 53 #endif 54 55 /* Enable this to get printf() style warnings on the Inktomi functions. */ 56 /* #define PRINTFLIKE(IDX, FIRST) __attribute__((format (printf, IDX, FIRST))) */ 57 #if !defined(TS_PRINTFLIKE) 58 #if defined(__GNUC__) || defined(__clang__) 59 #define TS_PRINTFLIKE(fmt, arg) __attribute__((format(printf, fmt, arg))) 60 #else 61 #define TS_PRINTFLIKE(fmt, arg) 62 #endif 63 #endif 64 65 #if !defined(TS_NONNULL) 66 #if defined(__GNUC__) || defined(__clang__) 67 #define TS_NONNULL(...) __attribute__((nonnull(__VA_ARGS__))) 68 #else 69 #define TS_NONNULL(...) 70 #endif 71 #endif 72 73 #if !defined(TS_INLINE) 74 #define TS_INLINE inline 75 #endif 76