diff options
author | Patrick Steinhardt <ps@pks.im> | 2020-06-08 21:07:36 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2020-06-09 14:57:06 +0200 |
commit | c6184f0c4b209e462bf3f42ab20df2d13d8ee918 (patch) | |
tree | 1960a7424f9000eefd19ad8ce8b759c38ff7e516 /src/fetch.c | |
parent | 6e1efcd66934bd6c5946af01a6d5b1b83b84ddb8 (diff) | |
download | libgit2-c6184f0c4b209e462bf3f42ab20df2d13d8ee918.tar.gz |
tree-wide: do not compile deprecated functions with hard deprecation
When compiling libgit2 with -DDEPRECATE_HARD, we add a preprocessor
definition `GIT_DEPRECATE_HARD` which causes the "git2/deprecated.h"
header to be empty. As a result, no function declarations are made
available to callers, but the implementations are still available to
link against. This has the problem that function declarations also
aren't visible to the implementations, meaning that the symbol's
visibility will not be set up correctly. As a result, the resulting
library may not expose those deprecated symbols at all on some platforms
and thus cause linking errors.
Fix the issue by conditionally compiling deprecated functions, only.
While it becomes impossible to link against such a library in case one
uses deprecated functions, distributors of libgit2 aren't expected to
pass -DDEPRECATE_HARD anyway. Instead, users of libgit2 should manually
define GIT_DEPRECATE_HARD to hide deprecated functions. Using "real"
hard deprecation still makes sense in the context of CI to test we don't
use deprecated symbols ourselves and in case a dependant uses libgit2 in
a vendored way and knows it won't ever use any of the deprecated symbols
anyway.
Diffstat (limited to 'src/fetch.c')
-rw-r--r-- | src/fetch.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/fetch.c b/src/fetch.c index f2f313192..f4a4c9f81 100644 --- a/src/fetch.c +++ b/src/fetch.c @@ -155,7 +155,9 @@ int git_fetch_options_init(git_fetch_options *opts, unsigned int version) return 0; } +#ifndef GIT_DEPRECATE_HARD int git_fetch_init_options(git_fetch_options *opts, unsigned int version) { return git_fetch_options_init(opts, version); } +#endif |