[21/36] opcodes/microblaze: Rename 'or', 'and', 'xor' to avoid C++ conflict

Message ID 1423524046-20605-22-git-send-email-palves@redhat.com
State New, archived
Headers

Commit Message

Pedro Alves Feb. 9, 2015, 11:20 p.m. UTC
  Building GDB as a C++ program, we see:

  In file included from gdb/microblaze-tdep.c:37:0:
  gdb/../opcodes/../opcodes/microblaze-opcm.h: At global scope:
  gdb/../opcodes/../opcodes/microblaze-opcm.h:32:51: error: expected identifier before ‘or’ token
     ncget, ncput, muli, bslli, bsrai, bsrli, mului, or, and, xor,
						     ^
  gdb/../opcodes/../opcodes/microblaze-opcm.h:32:51: error: expected ‘}’ before ‘or’ token
  gdb/../opcodes/../opcodes/microblaze-opcm.h:32:51: error: expected unqualified-id before ‘or’ token
  gdb/../opcodes/../opcodes/microblaze-opcm.h:60:1: error: expected declaration before ‘}’ token
   };
   ^

opcodes/ChangeLog:
2015-10-20  Pedro Alves  <palves@redhat.com>
	    Tom Tromey  <tromey@redhat.com>

	* microblaze-opcm.h (or, and, xor): Rename to microblaze_or,
	microblaze_and, microblaze_xor.
	* microblaze-opc.h (struct op_code_struct): Adjust.
---
 opcodes/microblaze-opc.h  | 6 +++---
 opcodes/microblaze-opcm.h | 4 +++-
 2 files changed, 6 insertions(+), 4 deletions(-)
  

Comments

Michael Eager Feb. 10, 2015, 3:05 p.m. UTC | #1
On 02/09/15 15:20, Pedro Alves wrote:
> Building GDB as a C++ program, we see:
>
>    In file included from gdb/microblaze-tdep.c:37:0:
>    gdb/../opcodes/../opcodes/microblaze-opcm.h: At global scope:
>    gdb/../opcodes/../opcodes/microblaze-opcm.h:32:51: error: expected identifier before ‘or’ token
>       ncget, ncput, muli, bslli, bsrai, bsrli, mului, or, and, xor,
> 						     ^
>    gdb/../opcodes/../opcodes/microblaze-opcm.h:32:51: error: expected ‘}’ before ‘or’ token
>    gdb/../opcodes/../opcodes/microblaze-opcm.h:32:51: error: expected unqualified-id before ‘or’ token
>    gdb/../opcodes/../opcodes/microblaze-opcm.h:60:1: error: expected declaration before ‘}’ token
>     };
>     ^
>
> opcodes/ChangeLog:
> 2015-10-20  Pedro Alves  <palves@redhat.com>
> 	    Tom Tromey  <tromey@redhat.com>
>
> 	* microblaze-opcm.h (or, and, xor): Rename to microblaze_or,
> 	microblaze_and, microblaze_xor.
> 	* microblaze-opc.h (struct op_code_struct): Adjust.

OK.
  
Pedro Alves Feb. 10, 2015, 6:11 p.m. UTC | #2
On 02/10/2015 03:05 PM, Michael Eager wrote:

>> opcodes/ChangeLog:
>> 2015-10-20  Pedro Alves  <palves@redhat.com>
>> 	    Tom Tromey  <tromey@redhat.com>
>>
>> 	* microblaze-opcm.h (or, and, xor): Rename to microblaze_or,
>> 	microblaze_and, microblaze_xor.
>> 	* microblaze-opc.h (struct op_code_struct): Adjust.
> 
> OK.
> 

Thanks, pushed.

Pedro Alves
  

Patch

diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
index 668e27e..bf62906 100644
--- a/opcodes/microblaze-opc.h
+++ b/opcodes/microblaze-opc.h
@@ -158,9 +158,9 @@  struct op_code_struct
   {"bslli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000400, OPCODE_MASK_H3, bslli, barrel_shift_inst },
   {"bsrai", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000200, OPCODE_MASK_H3, bsrai, barrel_shift_inst },
   {"bsrli", INST_TYPE_RD_R1_IMM5, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x64000000, OPCODE_MASK_H3, bsrli, barrel_shift_inst },
-  {"or",    INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, or, logical_inst },
-  {"and",   INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000000, OPCODE_MASK_H4, and, logical_inst },
-  {"xor",   INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000000, OPCODE_MASK_H4, xor, logical_inst },
+  {"or",    INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000000, OPCODE_MASK_H4, microblaze_or, logical_inst },
+  {"and",   INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000000, OPCODE_MASK_H4, microblaze_and, logical_inst },
+  {"xor",   INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x88000000, OPCODE_MASK_H4, microblaze_xor, logical_inst },
   {"andn",  INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x8C000000, OPCODE_MASK_H4, andn, logical_inst },
   {"pcmpbf",INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x80000400, OPCODE_MASK_H4, pcmpbf, logical_inst },
   {"pcmpbc",INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x84000400, OPCODE_MASK_H4, pcmpbc, logical_inst },
diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
index f59c48c..0263148 100644
--- a/opcodes/microblaze-opcm.h
+++ b/opcodes/microblaze-opcm.h
@@ -29,7 +29,9 @@  enum microblaze_instr
   addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul, 
   mulh, mulhu, mulhsu,swapb,swaph,
   idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput,
-  ncget, ncput, muli, bslli, bsrai, bsrli, mului, or, and, xor,
+  ncget, ncput, muli, bslli, bsrai, bsrli, mului,
+  /* 'or/and/xor' are C++ keywords.  */
+  microblaze_or, microblaze_and, microblaze_xor,
   andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16, 
   wic, wdc, wdcclear, wdcflush, mts, mfs, mbar, br, brd,
   brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt,