summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2018-06-25 14:57:07 +0200
committerPatrick Steinhardt <ps@pks.im>2018-07-13 08:25:12 +0200
commitd19381e25e46db07617f91627a9fdc66b88aa0b3 (patch)
tree5b632219aa8eb8be481cf8a8461a79cd51caf8b2
parentc13e56f91c3a15dd47b9543984e763ab74270aa9 (diff)
downloadlibgit2-d19381e25e46db07617f91627a9fdc66b88aa0b3.tar.gz
mbedtls: fix `inline` being used in mbedtls headers
The mbedtls headers make direct use of the `inline` attribute to instruct the compiler to inline functions. As this function is not C90 compliant, this can cause the compiler to error as soon as any of these files is included and the `-std=c90` flag is being added. The mbedtls headers declaring functions as inline always have a prelude which define `inline` as a macro in case it is not yet defined. Thus, we can easily replace their define with our own define, which simply copies the logic of our own `GIT_INLINE` macro.
-rw-r--r--src/streams/mbedtls.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/streams/mbedtls.c b/src/streams/mbedtls.c
index 0a49a36a6..7cecb2ade 100644
--- a/src/streams/mbedtls.c
+++ b/src/streams/mbedtls.c
@@ -26,12 +26,23 @@
#define GIT_DEFAULT_CERT_LOCATION NULL
#endif
+/* Work around C90-conformance issues */
+#if defined(_MSC_VER)
+# define inline __inline
+#elif defined(__GNUC__)
+# define inline __inline__
+#else
+# define inline
+#endif
+
#include <mbedtls/config.h>
#include <mbedtls/ssl.h>
#include <mbedtls/error.h>
#include <mbedtls/entropy.h>
#include <mbedtls/ctr_drbg.h>
+#undef inline
+
mbedtls_ssl_config *git__ssl_conf;
mbedtls_entropy_context *mbedtls_entropy;