git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-compat-util: do not step on MAC_OS_X_VERSION_MIN_REQUIRED

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Feb 6, 2015, 10:00 UTC
Message-ID
<CAPig+cT0-ftZZyRORx-W2_Nit6XdgrpiyGS=pRjGtHoz1jW+Kg@mail.gmail.com>
In-Reply-To
<f2a35ed9fba20d48ef5736ee4564101@74d39fa044aa309eaea14b9f57fe79c>
On Fri, Feb 6, 2015 at 4:35 AM, Kyle J. McKay <mackyle@gmail.com> wrote:
Show 22 quoted lines
> MAC_OS_X_VERSION_MIN_REQUIRED may be defined by the builder to a
> specific version in order to produce compatible binaries for a
> particular system.  Blindly defining it to MAC_OS_X_VERSION_10_6
> is bad.
>
> Additionally MAC_OS_X_VERSION_10_6 will not be defined on older
> systems and should AvailabilityMacros.h be included on such as
> system an error will result.  However, using the explicit value
> of 1060 (which is what MAC_OS_X_VERSION_10_6 is defined to) does
> not solve the problem.
>
> The changes that introduced stepping on MAC_OS_X_VERSION_MIN were
> made in b195aa00 (git-compat-util: suppress unavoidable
> Apple-specific deprecation warnings) to avoid deprecation
> warnings.
>
> Instead of blindly setting MAC_OS_X_VERSION_MIN to 1060 change
> the definition of DEPRECATED_ATTRIBUTE to empty to avoid the
> warnings.  This preserves any MAC_OS_X_VERSION_MIN_REQUIRED
> setting while avoiding the warnings as intended by b195aa00.
>
> Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
Tested on 10.10.2 (Yosemite) and 10.5.8 (Snow Leopard).
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
More below...
Show 24 quoted lines
> ---
>  git-compat-util.h | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/git-compat-util.h b/git-compat-util.h
> index eb9b0ff3..0efd32c4 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -212,12 +212,15 @@ extern char *gitbasename(char *);
>  #endif
>
>  #ifndef NO_OPENSSL
> +#ifdef __APPLE__
>  #define __AVAILABILITY_MACROS_USES_AVAILABILITY 0
> -#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6
> +#include <AvailabilityMacros.h>
> +#undef DEPRECATED_ATTRIBUTE
> +#define DEPRECATED_ATTRIBUTE
> +#undef __AVAILABILITY_MACROS_USES_AVAILABILITY
> +#endif
>  #include <openssl/ssl.h>
>  #include <openssl/err.h>
> -#undef MAC_OS_X_VERSION_MIN_REQUIRED
> -#undef __AVAILABILITY_MACROS_USES_AVAILABILITY

DEPRECATED_ATTRIBUTE is a fairly generic name. Do we want to be extra careful and #undef it here to avoid potential unintended interactions with other #includes (Apple or not)?

    #ifdef __APPLE__
    #undef DEPRECATED_ATTRIBUTE
    #endif
On the other hand, we've already mucked with it, so #undef may be superfluous.
>  #ifdef NO_HMAC_CTX_CLEANUP
>  #define HMAC_CTX_cleanup HMAC_cleanup
>  #endif
> --
Previous: Kyle J. McKayNext: Kyle J. McKay
Message 2 of 6 in “git-compat-util: do not step on MAC_OS_X_VERSION_MIN_REQUIRED”
  1. git-compat-util: do not step on MAC_OS_X_VERSION_MIN_REQUIREDKyle J. McKay, Feb 6, 2015
  2. Eric SunshineFeb 6, 2015
  3. Kyle J. McKayFeb 6, 2015
  4. Junio C HamanoFeb 6, 2015
  5. Kyle J. McKayFeb 6, 2015
  6. Eric SunshineFeb 6, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.