Re: [PATCH] remote.c: spell __attribute__ correctly
Thnx, From: "Ramsay Jones"On 25/04/16 22:50, Philip Oakley wrote: From: "Jeff King" On Mon, Apr 25, 2016 at 05:10:30PM -0400, Jeff King wrote: It should be handled in git-compat-util.h, which is included by cache.h, which is included by remote.c. There we have: #ifndef __GNUC__ #ifndef __attribute__ #define __attribute__(x) #endif #endif which should make it a noop on compilers which don't know about it. Is VS (or another file) setting __GNUC__? Of course it helps if we spell the name right... Indeed! ;-) Not that it matters, but the above #define in git-compat-util.h is not the relevant definition - msvc will not see it. Ah, I see that that block is further guarded with other if/elif/else clauses so that it's not seen if _MSC_VER is defined. git-compat-util.h#L400-411 However, it does see the #define on line 12 of compat/msvc.h. :-D ATB, Ramsay Jones -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] remote.c: spell __attribute__ correctly
On 25/04/16 22:50, Philip Oakley wrote: > From: "Jeff King">> On Mon, Apr 25, 2016 at 05:10:30PM -0400, Jeff King wrote: >> >>> It should be handled in git-compat-util.h, which is included by cache.h, >>> which is included by remote.c. >>> >>> There we have: >>> >>> #ifndef __GNUC__ >>> #ifndef __attribute__ >>> #define __attribute__(x) >>> #endif >>> #endif >>> >>> which should make it a noop on compilers which don't know about it. Is >>> VS (or another file) setting __GNUC__? >> >> Of course it helps if we spell the name right... Indeed! ;-) Not that it matters, but the above #define in git-compat-util.h is not the relevant definition - msvc will not see it. However, it does see the #define on line 12 of compat/msvc.h. :-D ATB, Ramsay Jones -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] remote.c: spell __attribute__ correctly
From: "Jeff King"On Mon, Apr 25, 2016 at 05:10:30PM -0400, Jeff King wrote: It should be handled in git-compat-util.h, which is included by cache.h, which is included by remote.c. There we have: #ifndef __GNUC__ #ifndef __attribute__ #define __attribute__(x) #endif #endif which should make it a noop on compilers which don't know about it. Is VS (or another file) setting __GNUC__? Of course it helps if we spell the name right... -- >8 -- Subject: remote.c: spell __attribute__ correctly We want to tell the compiler that error_buf() uses printf()-style arguments via the __attribute__ mechanism, but the original commit (3a429d0), forgot the trailing "__". This happens to work with real GNUC-compatible compilers like gcc and clang, but confuses our fallback macro in git-compat-util.h, which only matches the official name (and thus the build fails on compilers like Visual Studio). Reported-by: Philip Oakley Signed-off-by: Jeff King --- remote.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remote.c b/remote.c index 28fd676..ddc4f8f 100644 --- a/remote.c +++ b/remote.c @@ -1660,7 +1660,7 @@ int branch_merge_matches(struct branch *branch, return refname_match(branch->merge[i]->src, refname); } -__attribute((format (printf,2,3))) +__attribute__((format (printf,2,3))) static const char *error_buf(struct strbuf *err, const char *fmt, ...) { if (err) { -- Thanks for clarifying that (sorry about the crossed emails). The compile is now looking good. I'm just left with some unresolved external symbol link errors now. The same naming issue in compat/regex/regcomp.c, compat/regex/regexec.c, compat/regex/regex_internal.c and compat/regex/regex_internal.h was probably what lead me astray... Philip -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html