{"thread":{"id":"33782","subject":"[PATCH] cache.h: avoid deprecation warnings on OS X 10.8","startedAt":"2013-05-11T02:23:30Z","lastAt":"2013-05-12T17:20:30Z","messageCount":2,"participants":["David Aguilar","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"216957","messageId":"1368239010-60894-1-git-send-email-davvid@gmail.com","threadId":"33782","inReplyTo":null,"subject":"[PATCH] cache.h: avoid deprecation warnings on OS X 10.8","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2013-05-11T02:23:30Z","receivedAt":"2013-05-11T02:23:30Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"Mac OS X Mountain Lion prints warnings when building git:\n\n\twarning: 'SHA1_Init' is deprecated\n\t(declared at /usr/include/openssl/sha.h:121)\n\nSilence the warnings by using the Common Digest SHA-1\nfunctions for SHA1_Init(), SHA1_Update(), and SHA1_Final().\n\nAdd a COMMON_DIGEST_SHA1 knob to the Makefile to allow\nchoosing this implementation and define it by default on Darwin.\n\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\nThis implements the suggestion from John Keeping instead\nof blindly setting NO_OPENSSL on Darwin.\n\n Makefile | 4 ++++\n cache.h  | 6 ++++++\n 2 files changed, 10 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex 0f931a2..ce62002 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1054,6 +1054,7 @@ ifeq ($(uname_S),Darwin)\n \t\t\tBASIC_LDFLAGS += -L/opt/local/lib\n \t\tendif\n \tendif\n+\tCOMMON_DIGEST_SHA1 = YesPlease\n \tPTHREAD_LIBS =\n endif\n \n@@ -1390,6 +1391,9 @@ ifdef PPC_SHA1\n else\n \tSHA1_HEADER = <openssl/sha.h>\n \tEXTLIBS += $(LIB_4_CRYPTO)\n+ifdef COMMON_DIGEST_SHA1\n+\tBASIC_CFLAGS += -DCOMMON_DIGEST_FOR_SHA1=1\n+endif\n endif\n endif\n ifdef NO_PERL_MAKEMAKER\ndiff --git a/cache.h b/cache.h\nindex 94ca1ac..f137fd4 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -11,10 +11,16 @@\n #include SHA1_HEADER\n #ifndef git_SHA_CTX\n #define git_SHA_CTX\tSHA_CTX\n+#ifdef COMMON_DIGEST_FOR_SHA1\n+#define git_SHA1_Init\tCC_SHA1_Init\n+#define git_SHA1_Update\tCC_SHA1_Update\n+#define git_SHA1_Final\tCC_SHA1_Final\n+#else\n #define git_SHA1_Init\tSHA1_Init\n #define git_SHA1_Update\tSHA1_Update\n #define git_SHA1_Final\tSHA1_Final\n #endif\n+#endif\n \n #include <zlib.h>\n typedef struct git_zstream {\n-- \n1.8.3.rc1.44.gb387c77.dirty\n"},{"id":"217088","messageId":"CAPig+cRsBay2tobNEMTujMR4q7xs-Fbq_3V=WQaw40KWAXwdLg@mail.gmail.com","threadId":"33782","inReplyTo":"1368239010-60894-1-git-send-email-davvid@gmail.com","subject":"Re: [PATCH] cache.h: avoid deprecation warnings on OS X 10.8","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-05-12T17:20:30Z","receivedAt":"2013-05-12T17:20:30Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, May 10, 2013 at 10:23 PM, David Aguilar <davvid@gmail.com> wrote:\n> Mac OS X Mountain Lion prints warnings when building git:\n>\n>         warning: 'SHA1_Init' is deprecated\n>         (declared at /usr/include/openssl/sha.h:121)\n>\n> Silence the warnings by using the Common Digest SHA-1\n> functions for SHA1_Init(), SHA1_Update(), and SHA1_Final().\n\nOn Lion, with this patch, I see diagnostics such as:\n\n    warning: implicit declaration of function 'CC_SHA1_Init'\n\nIf I #include <CommonCrypto/CommonDigest.h>, the \"implicit\ndeclaration\" warning is resolved, but a host of other warnings about\nincompatible pointer types crop up.\n\n(This is a bare Lion installation with latest XCode and \"Command Line\nTools\" package. No MacPorts, no Homebrew.)\n\n> Add a COMMON_DIGEST_SHA1 knob to the Makefile to allow\n> choosing this implementation and define it by default on Darwin.\n>\n> Signed-off-by: David Aguilar <davvid@gmail.com>\n> ---\n> This implements the suggestion from John Keeping instead\n> of blindly setting NO_OPENSSL on Darwin.\n"}]}