From d8d40fc676a9c5c3df01de07a296d718e88246a7 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Thu, 25 Sep 2014 00:32:56 +0200 Subject: [PATCH] e_os.h: allow inline functions to be compiled by legacy compilers. Reviewed-by: Matt Caswell (cherry picked from commit 40155f408985aff2e9f1b61b7cb04a3e518633a1) --- e_os.h | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/e_os.h b/e_os.h index 733155e48d..761c9ef046 100644 --- a/e_os.h +++ b/e_os.h @@ -375,15 +375,6 @@ static unsigned int _strlen31(const char *str) # define check_winnt() (GetVersion() < 0x80000000) #endif -/* - * Visual Studio: inline is available in C++ only, however - * __inline is available for C, see - * http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx - */ -#if defined(_MSC_VER) && !defined(__cplusplus) && !defined(inline) -# define inline __inline -#endif - #else /* The non-microsoft world */ # ifdef OPENSSL_SYS_VMS @@ -741,6 +732,22 @@ struct servent *getservbyname(const char *name, const char *proto); #include #endif +#if !defined(inline) && !defined(__cplusplus) +# if defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L + /* do nothing, inline works */ +# elif defined(__GNUC__) && __GNUC__>=3 && !defined(__NO_INLINE__) + /* do nothing, inline works */ +# elif defined(_MSC_VER) + /* + * Visual Studio: inline is available in C++ only, however + * __inline is available for C, see + * http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx + */ +# define inline __inline +# else +# define inline +# endif +#endif #ifdef __cplusplus } -- 2.25.1