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

[PATCH] ewah/bitmap: silence warning about MASK macro redefinition

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jun 2, 2015, 21:47 UTC
Message-ID
<1433281675-24893-1-git-send-email-sunshine@sunshineco.com>

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
Next: Junio C Hamano
Message 1 of 10 in “ewah/bitmap: silence warning about MASK macro redefinition”
  1. ewah/bitmap: silence warning about MASK macro redefinitionEric Sunshine, Jun 2, 2015
  2. Junio C HamanoJun 2, 2015
  3. Jeff KingJun 3, 2015
  4. Eric SunshineJun 3, 2015
  5. Jeff KingJun 3, 2015
  6. 1/2 ewah/bitmap: silence warning about MASK macro redefinitionJeff King, Jun 3, 2015
  7. Eric SunshineJun 3, 2015
  8. 2/2 ewah: use less generic macro nameJeff King, Jun 3, 2015
  9. Eric SunshineJun 3, 2015
  10. Junio C HamanoJun 3, 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.