1 /* Copyright (c) INRIA and Microsoft Corporation. All rights reserved. 2 Licensed under the Apache 2.0 License. */ 3 4 #ifndef __KREMLIN_CALLCONV_H 5 #define __KREMLIN_CALLCONV_H 6 7 /******************************************************************************/ 8 /* Some macros to ease compatibility */ 9 /******************************************************************************/ 10 11 /* We want to generate __cdecl safely without worrying about it being undefined. 12 * When using MSVC, these are always defined. When using MinGW, these are 13 * defined too. They have no meaning for other platforms, so we define them to 14 * be empty macros in other situations. */ 15 #ifndef _MSC_VER 16 #ifndef __cdecl 17 #define __cdecl 18 #endif 19 #ifndef __stdcall 20 #define __stdcall 21 #endif 22 #ifndef __fastcall 23 #define __fastcall 24 #endif 25 #endif 26 27 /* Since KreMLin emits the inline keyword unconditionally, we follow the 28 * guidelines at https://gcc.gnu.org/onlinedocs/gcc/Inline.html and make this 29 * __inline__ to ensure the code compiles with -std=c90 and earlier. */ 30 #ifdef __GNUC__ 31 # define inline __inline__ 32 #endif 33 34 /* GCC-specific attribute syntax; everyone else gets the standard C inline 35 * attribute. */ 36 #ifdef __GNU_C__ 37 # ifndef __clang__ 38 # define force_inline inline __attribute__((always_inline)) 39 # else 40 # define force_inline inline 41 # endif 42 #else 43 # define force_inline inline 44 #endif 45 46 #endif 47