Merge pull request #4944 from libgit2/ethomson/deprecation Improve deprecation of old enums
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
diff --git a/include/git2/common.h b/include/git2/common.h
index 8d3d3c1..70c02a4 100644
--- a/include/git2/common.h
+++ b/include/git2/common.h
@@ -59,6 +59,7 @@ typedef size_t size_t;
#if defined(__GNUC__)
# define GIT_DEPRECATED(func) \
__attribute__((deprecated)) \
+ __attribute__((used)) \
func
#elif defined(_MSC_VER)
# define GIT_DEPRECATED(func) __declspec(deprecated) func
diff --git a/include/git2/refs.h b/include/git2/refs.h
index 84d9938..c11947b 100644
--- a/include/git2/refs.h
+++ b/include/git2/refs.h
@@ -762,18 +762,18 @@ GIT_EXTERN(const char *) git_reference_shorthand(const git_reference *ref);
#define git_ref_t git_reference_t
#define git_reference_normalize_t git_reference_format_t
-GIT_DEPRECATED(static const unsigned int) GIT_REF_INVALID = GIT_REFERENCE_INVALID;
-GIT_DEPRECATED(static const unsigned int) GIT_REF_OID = GIT_REFERENCE_DIRECT;
-GIT_DEPRECATED(static const unsigned int) GIT_REF_SYMBOLIC = GIT_REFERENCE_SYMBOLIC;
-GIT_DEPRECATED(static const unsigned int) GIT_REF_LISTALL = GIT_REFERENCE_ALL;
+GIT_DEPRECATED(static const git_ref_t) GIT_REF_INVALID = GIT_REFERENCE_INVALID;
+GIT_DEPRECATED(static const git_ref_t) GIT_REF_OID = GIT_REFERENCE_DIRECT;
+GIT_DEPRECATED(static const git_ref_t) GIT_REF_SYMBOLIC = GIT_REFERENCE_SYMBOLIC;
+GIT_DEPRECATED(static const git_ref_t) GIT_REF_LISTALL = GIT_REFERENCE_ALL;
-GIT_DEPRECATED(static const unsigned int) GIT_REF_FORMAT_NORMAL =
+GIT_DEPRECATED(static const git_reference_normalize_t) GIT_REF_FORMAT_NORMAL =
GIT_REFERENCE_FORMAT_NORMAL;
-GIT_DEPRECATED(static const unsigned int) GIT_REF_FORMAT_ALLOW_ONELEVEL =
+GIT_DEPRECATED(static const git_reference_normalize_t) GIT_REF_FORMAT_ALLOW_ONELEVEL =
GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL;
-GIT_DEPRECATED(static const unsigned int) GIT_REF_FORMAT_REFSPEC_PATTERN =
+GIT_DEPRECATED(static const git_reference_normalize_t) GIT_REF_FORMAT_REFSPEC_PATTERN =
GIT_REFERENCE_FORMAT_REFSPEC_PATTERN;
-GIT_DEPRECATED(static const unsigned int) GIT_REF_FORMAT_REFSPEC_SHORTHAND =
+GIT_DEPRECATED(static const git_reference_normalize_t) GIT_REF_FORMAT_REFSPEC_SHORTHAND =
GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND;
/**@}*/
diff --git a/include/git2/types.h b/include/git2/types.h
index fdecc3a..386958d 100644
--- a/include/git2/types.h
+++ b/include/git2/types.h
@@ -450,19 +450,19 @@ typedef struct git_mailmap git_mailmap;
/**@{*/
-GIT_DEPRECATED(static const int) GIT_OBJ_ANY = GIT_OBJECT_ANY;
-GIT_DEPRECATED(static const int) GIT_OBJ_BAD = GIT_OBJECT_INVALID;
-GIT_DEPRECATED(static const int) GIT_OBJ__EXT1 = 0;
-GIT_DEPRECATED(static const int) GIT_OBJ_COMMIT = GIT_OBJECT_COMMIT;
-GIT_DEPRECATED(static const int) GIT_OBJ_TREE = GIT_OBJECT_TREE;
-GIT_DEPRECATED(static const int) GIT_OBJ_BLOB = GIT_OBJECT_BLOB;
-GIT_DEPRECATED(static const int) GIT_OBJ_TAG = GIT_OBJECT_TAG;
-GIT_DEPRECATED(static const int) GIT_OBJ__EXT2 = 5;
-GIT_DEPRECATED(static const int) GIT_OBJ_OFS_DELTA = GIT_OBJECT_OFS_DELTA;
-GIT_DEPRECATED(static const int) GIT_OBJ_REF_DELTA = GIT_OBJECT_REF_DELTA;
-
#define git_otype git_object_t
+GIT_DEPRECATED(static const git_otype) GIT_OBJ_ANY = GIT_OBJECT_ANY;
+GIT_DEPRECATED(static const git_otype) GIT_OBJ_BAD = GIT_OBJECT_INVALID;
+GIT_DEPRECATED(static const git_otype) GIT_OBJ__EXT1 = 0;
+GIT_DEPRECATED(static const git_otype) GIT_OBJ_COMMIT = GIT_OBJECT_COMMIT;
+GIT_DEPRECATED(static const git_otype) GIT_OBJ_TREE = GIT_OBJECT_TREE;
+GIT_DEPRECATED(static const git_otype) GIT_OBJ_BLOB = GIT_OBJECT_BLOB;
+GIT_DEPRECATED(static const git_otype) GIT_OBJ_TAG = GIT_OBJECT_TAG;
+GIT_DEPRECATED(static const git_otype) GIT_OBJ__EXT2 = 5;
+GIT_DEPRECATED(static const git_otype) GIT_OBJ_OFS_DELTA = GIT_OBJECT_OFS_DELTA;
+GIT_DEPRECATED(static const git_otype) GIT_OBJ_REF_DELTA = GIT_OBJECT_REF_DELTA;
+
/**@}*/
/** @} */