{"thread":{"id":"61316","subject":"[PATCH] git-compat-util: fix NO_OPENSSL on current macOS","startedAt":"2024-04-14T16:47:57Z","lastAt":"2024-04-18T17:22:11Z","messageCount":2,"participants":["René Scharfe","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"492923","messageId":"3188f4e2-9744-40b1-8f05-0896b8679d25@web.de","threadId":"61316","inReplyTo":null,"subject":"[PATCH] git-compat-util: fix NO_OPENSSL on current macOS","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2024-04-14T16:47:54Z","receivedAt":"2024-04-14T16:47:57Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"b195aa00c1 (git-compat-util: suppress unavoidable Apple-specific\ndeprecation warnings, 2014-12-16) started to define\n__AVAILABILITY_MACROS_USES_AVAILABILITY in git-compat-util.h.  On\ncurrent versions it is already defined (e.g. on macOS 14.4.1).  Undefine\nit before redefining it to avoid a compilation error.\n\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\nOn my system I can remove the whole ifdef __APPLE__ section, as the OS\ndoesn't include the deprecated OpenSSL anymore.  I get a current version\nvia Homebrew, which doesn't throw any deprecation warnings, of course.\n\nNot sure if this is the right fix, as the no longer needed section still\nundefines __AVAILABILITY_MACROS_USES_AVAILABILITY at the end, which we\nmay want to keep instead.  But compilation succeeds and tests pass, so\nperhaps it's fine.\n\n git-compat-util.h | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 7c2a6538e5..1a4f5a30c3 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -391,6 +391,7 @@ char *gitdirname(char *);\n\n #ifndef NO_OPENSSL\n #ifdef __APPLE__\n+#undef __AVAILABILITY_MACROS_USES_AVAILABILITY\n #define __AVAILABILITY_MACROS_USES_AVAILABILITY 0\n #include <AvailabilityMacros.h>\n #undef DEPRECATED_ATTRIBUTE\n--\n2.44.0\n"},{"id":"493146","messageId":"CAPig+cQr3xcnuoyf58YWbXCekhhRgN+M9=WsN4_PYcK7BydDUg@mail.gmail.com","threadId":"61316","inReplyTo":"3188f4e2-9744-40b1-8f05-0896b8679d25@web.de","subject":"Re: [PATCH] git-compat-util: fix NO_OPENSSL on current macOS","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2024-04-18T17:21:59Z","receivedAt":"2024-04-18T17:22:11Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Apr 14, 2024 at 12:47 PM René Scharfe <l.s.r@web.de> wrote:\n> b195aa00c1 (git-compat-util: suppress unavoidable Apple-specific\n> deprecation warnings, 2014-12-16) started to define\n> __AVAILABILITY_MACROS_USES_AVAILABILITY in git-compat-util.h.  On\n> current versions it is already defined (e.g. on macOS 14.4.1).  Undefine\n> it before redefining it to avoid a compilation error.\n>\n> Signed-off-by: René Scharfe <l.s.r@web.de>\n> ---\n> On my system I can remove the whole ifdef __APPLE__ section, as the OS\n> doesn't include the deprecated OpenSSL anymore.  I get a current version\n> via Homebrew, which doesn't throw any deprecation warnings, of course.\n>\n> Not sure if this is the right fix, as the no longer needed section still\n> undefines __AVAILABILITY_MACROS_USES_AVAILABILITY at the end, which we\n> may want to keep instead.  But compilation succeeds and tests pass, so\n> perhaps it's fine.\n\nI think I added the final `#undef\n__AVAILABILITY_MACROS_USES_AVAILABILITY` in b195aa00c1\n(git-compat-util: suppress unavoidable Apple-specific deprecation\nwarnings, 2014-12-16) just for completeness; since I #define'd it, I\nalso #undef'd it to ensure a clean state or the C preprocessor.\n\nHowever, taking this new situation into account, where\n__AVAILABILITY_MACROS_USES_AVAILABILITY is now defined by default, it\n_probably_ would be more correct to drop that final #undef.\n\nHaving said that, though, it doesn't seem that it is likely to matter\none way or the other as the project stands presently, especially since\nyou report that building and testing succeeds. Moreover, the only\nother place in the project where we seem to care about the Apple\nversion-compatibility macros is in\ncompat/fsmonitor/fsm-listen-darwin.c, but even that isn't a problem\nbecause it consults a version-compatibility macro before #include'ing\ngit-compat-util:\n\n    #ifndef AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER\n    #define kFSEventStreamEventFlagItemCloned 0x00400000\n    #endif\n    #include \"git-compat-util.h\"\n\nSo, this patch can't possibly have any sort of negative interaction\nwith that code even if __AVAILABILITY_MACROS_USES_AVAILABILITY somehow\nimpacted AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER.\n"}]}