Commit 396e49600c2131b5727d07f06fb28ba3c0c73923

Patrick Steinhardt 2018-02-08T11:05:17

common.h: create `GIT_DEPRECATED` macro

diff --git a/include/git2/common.h b/include/git2/common.h
index f65cfdd..d9a2d40 100644
--- a/include/git2/common.h
+++ b/include/git2/common.h
@@ -48,6 +48,17 @@ typedef size_t size_t;
 # define GIT_EXTERN(type) extern type
 #endif
 
+/** Declare a function as deprecated. */
+#if defined(__GNUC__)
+# define GIT_DEPRECATED(func) \
+			 __attribute__((deprecated)) \
+			 func
+#elif defined(_MSC_VER)
+# define GIT_DEPRECATED(func) __declspec(deprecated) func
+#else
+# define GIT_DEPRECATED(func) func
+#endif
+
 /** Declare a function's takes printf style arguments. */
 #ifdef __GNUC__
 # define GIT_FORMAT_PRINTF(a,b) __attribute__((format (printf, a, b)))