git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ewah/bitmap: silence warning about MASK macro redefinition
@ 2015-06-02 21:47 Eric Sunshine
  2015-06-02 22:15 ` Junio C Hamano
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Sunshine @ 2015-06-02 21:47 UTC (permalink / raw)
  To: git; +Cc: Eric Sunshine

On PowerPC Mac OS X (10.5.8 "Leopard" with Xcode 3.1), system header
/usr/include/ppc/param.h[1] pollutes the preprocessor namespace with a
macro generically named MASK. This conflicts with the same-named macro
in ewah/bitmap.c.

[1]: Included indirectly via:
     git-compat-util.h ->
     sys/sysctl.h ->
     sys/ucred.h ->
     sys/param.h ->
     machine/param.h ->
     ppc/param.h

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
---

The alternative is to rename MASK in ewah/bitmap.c to something less
generic, resulting in a slightly more noisy patch. I chose the #undef
approach since it's a relatively common idiom to #undef a macro before
#defining it in order to avoid exactly this sort of redefinition
problem.

 ewah/bitmap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ewah/bitmap.c b/ewah/bitmap.c
index 710e58c..b31cf75 100644
--- a/ewah/bitmap.c
+++ b/ewah/bitmap.c
@@ -20,6 +20,8 @@
 #include "git-compat-util.h"
 #include "ewok.h"
 
+#undef MASK
+#undef BLOCK
 #define MASK(x) ((eword_t)1 << (x % BITS_IN_WORD))
 #define BLOCK(x) (x / BITS_IN_WORD)
 
-- 
2.4.2.598.gb4379f4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-06-03  6:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-02 21:47 [PATCH] ewah/bitmap: silence warning about MASK macro redefinition Eric Sunshine
2015-06-02 22:15 ` Junio C Hamano
2015-06-03  4:51   ` Jeff King
2015-06-03  6:28     ` Eric Sunshine
2015-06-03  6:38       ` Jeff King
2015-06-03  6:39         ` [PATCH 1/2] " Jeff King
2015-06-03  6:46           ` Eric Sunshine
2015-06-03  6:39         ` [PATCH 2/2] ewah: use less generic macro name Jeff King
2015-06-03  6:51           ` Eric Sunshine
2015-06-03  6:50       ` [PATCH] ewah/bitmap: silence warning about MASK macro redefinition Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).