e_os.h: allow inline functions to be compiled by legacy compilers.
authorAndy Polyakov <appro@openssl.org>
Wed, 24 Sep 2014 22:32:56 +0000 (00:32 +0200)
committerEmilia Kasper <emilia@openssl.org>
Fri, 17 Oct 2014 09:55:02 +0000 (11:55 +0200)
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 40155f408985aff2e9f1b61b7cb04a3e518633a1)

e_os.h

diff --git a/e_os.h b/e_os.h
index 919fec8f28e7afb98eb30a4f10eb40d88b3baa9f..e63fd7af5ded22a83c06a2f6139375f3834e8d52 100644 (file)
--- a/e_os.h
+++ b/e_os.h
@@ -378,15 +378,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
@@ -753,6 +744,22 @@ struct servent *getservbyname(const char *name, const char *proto);
 #include <OS.h>
 #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
 }