Description: Rename enums in src/code/ia32.c
 They conflict with /usr/include/i386-linux-gnu/sys/ucontext.h of newer eglibc
Author: Magnus Holmgren
Bug-Debian: http://bugs.debian.org/708366
Forwarded: yes

--- a/src/code/ia32.c
+++ b/src/code/ia32.c
@@ -14,14 +14,9 @@
 #include "object.h"
 #include "builtin_functions.h"
 
-/* This is defined on windows */
-#ifdef REG_NONE
-#undef REG_NONE
-#endif
-
-enum ia32_reg {REG_EAX = 0, REG_EBX = 3, REG_ECX = 1, REG_EDX = 2, REG_NONE = 4};
+enum ia32_reg {PIKE_REG_EAX = 0, PIKE_REG_EBX = 3, PIKE_REG_ECX = 1, PIKE_REG_EDX = 2, PIKE_REG_NONE = 4};
 
-#define REG_BITMASK ((1 << REG_NONE) - 1)
+#define REG_BITMASK ((1 << PIKE_REG_NONE) - 1)
 
 /* #define REGISTER_DEBUG */
 
@@ -71,7 +66,7 @@ static int alloc_regs = 0, valid_regs =
 #define MOV_ABSADDR_TO_REG(ADDR, REG) do {				\
     MAKE_VALID_REG (REG);						\
     /* movl addr,%reg */						\
-    if ((REG) == REG_EAX)						\
+    if ((REG) == PIKE_REG_EAX)						\
       add_to_program (0xa1); /* Move dword at address to EAX. */	\
     else {								\
       add_to_program (0x8b); /* Move r/m32 to r32. */			\
@@ -83,7 +78,7 @@ static int alloc_regs = 0, valid_regs =
 #define MOV_REG_TO_ABSADDR(REG, ADDR) do {				\
     CHECK_VALID_REG (REG);						\
     /* movl %reg,addr */						\
-    if ((REG) == REG_EAX)						\
+    if ((REG) == PIKE_REG_EAX)						\
       add_to_program (0xa3); /* Move EAX to dword at address. */	\
     else {								\
       add_to_program (0x89); /* Move r32 to r/m32. */			\
@@ -217,7 +212,7 @@ static int alloc_regs = 0, valid_regs =
       add_to_program (0x48 | (REG)); /* Decrement r32. */		\
     else if (val_ < -128 || val_ > 127) {				\
       /* addl $val,%reg */						\
-      if ((REG) == REG_EAX)						\
+      if ((REG) == PIKE_REG_EAX)						\
 	add_to_program (0x05); /* Add imm32 to EAX. */			\
       else {								\
 	add_to_program (0x81); /* Add imm32 to r/m32. */		\
@@ -334,8 +329,8 @@ ptrdiff_t ia32_prev_stored_pc; /* PROG_P
 
 void ia32_flush_code_generator(void)
 {
-  next_reg = REG_EAX;
-  sp_reg = fp_reg = mark_sp_reg = REG_NONE;
+  next_reg = PIKE_REG_EAX;
+  sp_reg = fp_reg = mark_sp_reg = PIKE_REG_NONE;
   CLEAR_REGS();
   ia32_prev_stored_pc = -1;
 }
@@ -351,7 +346,7 @@ static enum ia32_reg alloc_reg (int avoi
     /* There's a free register. */
 
     for (reg = next_reg; (1 << reg) & used_regs;) {
-      reg = (reg + 1) % REG_NONE;
+      reg = (reg + 1) % PIKE_REG_NONE;
 #ifdef PIKE_DEBUG
       if (reg == next_reg) Pike_fatal ("Failed to find a free register.\n");
 #endif
@@ -364,15 +359,15 @@ static enum ia32_reg alloc_reg (int avoi
      * probably be replaced with an LRU strategy. */
 
     for (reg = next_reg; (1 << reg) & avoid_regs;) {
-      reg = (reg + 1) % REG_NONE;
+      reg = (reg + 1) % PIKE_REG_NONE;
 #ifdef PIKE_DEBUG
       if (reg == next_reg) Pike_fatal ("Failed to find a non-excluded register.\n");
 #endif
     }
 
-    if (sp_reg == reg)			{sp_reg = REG_NONE; DEALLOC_REG (reg);}
-    else if (fp_reg == reg)		{fp_reg = REG_NONE; DEALLOC_REG (reg);}
-    else if (mark_sp_reg == reg)	{mark_sp_reg = REG_NONE; DEALLOC_REG (reg);}
+    if (sp_reg == reg)			{sp_reg = PIKE_REG_NONE; DEALLOC_REG (reg);}
+    else if (fp_reg == reg)		{fp_reg = PIKE_REG_NONE; DEALLOC_REG (reg);}
+    else if (mark_sp_reg == reg)	{mark_sp_reg = PIKE_REG_NONE; DEALLOC_REG (reg);}
   }
 
 #ifdef REGISTER_DEBUG
@@ -386,11 +381,11 @@ static enum ia32_reg alloc_reg (int avoi
 #define DEF_LOAD_REG(REG, SET)						\
   static void PIKE_CONCAT(load_,REG) (int avoid_regs)			\
   {									\
-    if (REG == REG_NONE) {						\
+    if (REG == PIKE_REG_NONE) {						\
       REG = alloc_reg (avoid_regs);					\
       /* Update the round robin pointer here so that we disregard */	\
       /* the direct calls to alloc_reg for temporary registers. */	\
-      next_reg = (REG + 1) % REG_NONE;					\
+      next_reg = (REG + 1) % PIKE_REG_NONE;					\
       {SET;}								\
     }									\
     else								\
@@ -410,8 +405,8 @@ DEF_LOAD_REG (mark_sp_reg, {
 static void ia32_call_c_function(void *addr)
 {
   CALL_RELATIVE(addr);
-  next_reg = REG_EAX;
-  sp_reg = fp_reg = mark_sp_reg = REG_NONE;
+  next_reg = PIKE_REG_EAX;
+  sp_reg = fp_reg = mark_sp_reg = PIKE_REG_NONE;
   CLEAR_REGS();
 }
 
