Avoid using 'template' C++ keyword
authorYao Qi <yao.qi@linaro.org>
Wed, 7 Oct 2015 11:23:15 +0000 (12:23 +0100)
committerYao Qi <yao.qi@linaro.org>
Wed, 7 Oct 2015 14:22:47 +0000 (15:22 +0100)
'template' is used in include/opcode/aarch64.h as below,

 typedef struct
 {
   const char *template;
   uint32_t value;
   int has_xt;
 } aarch64_sys_ins_reg;

and it triggers compilation errors when GDB is built in C++ mode.

In file included from git/gdb/aarch64-tdep.c:62:0:
git/gdb/../include/opcode/aarch64.h:651:15: error: expected unqualified-id before 'template'
   const char *template;

This patch is to rename field template to name.

gas/

* config/tc-aarch64.c (md_begin): Access field 'name' rather
than 'template'.

include/opcode/

* aarch64.h (aarch64_sys_ins_reg) <template>: Removed.
<name>: New field.

opcodes/

* aarch64-dis.c (aarch64_ext_sysins_op): Access field
'name' rather than 'template'.
* aarch64-opc.c (aarch64_print_operand): Likewise.

gas/ChangeLog
gas/config/tc-aarch64.c
include/opcode/ChangeLog
include/opcode/aarch64.h
opcodes/ChangeLog
opcodes/aarch64-dis.c
opcodes/aarch64-opc.c

index 14b1647bc315c7f56bf815a42b6ff73a03c58d0b..1d08101feadc145b68d2d93744096af9e73aca77 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-07  Yao Qi  <yao.qi@linaro.org>
+
+       * config/tc-aarch64.c (md_begin): Access field 'name' rather
+       than 'template'.
+
 2015-10-07  Claudiu Zissulescu  <claziss@synopsys.com>
 
         * config/tc-arc.c: Revamped file for ARC support.
index a0cf9763f07c3ce28e06bd3509763668ebfb3e02..81b8e2db7e4b8a43cf29b09cace7bc7d44a95074 100644 (file)
@@ -7511,24 +7511,24 @@ md_begin (void)
                         aarch64_pstatefields[i].name,
                         (void *) (aarch64_pstatefields + i));
 
-  for (i = 0; aarch64_sys_regs_ic[i].template != NULL; i++)
+  for (i = 0; aarch64_sys_regs_ic[i].name != NULL; i++)
     checked_hash_insert (aarch64_sys_regs_ic_hsh,
-                        aarch64_sys_regs_ic[i].template,
+                        aarch64_sys_regs_ic[i].name,
                         (void *) (aarch64_sys_regs_ic + i));
 
-  for (i = 0; aarch64_sys_regs_dc[i].template != NULL; i++)
+  for (i = 0; aarch64_sys_regs_dc[i].name != NULL; i++)
     checked_hash_insert (aarch64_sys_regs_dc_hsh,
-                        aarch64_sys_regs_dc[i].template,
+                        aarch64_sys_regs_dc[i].name,
                         (void *) (aarch64_sys_regs_dc + i));
 
-  for (i = 0; aarch64_sys_regs_at[i].template != NULL; i++)
+  for (i = 0; aarch64_sys_regs_at[i].name != NULL; i++)
     checked_hash_insert (aarch64_sys_regs_at_hsh,
-                        aarch64_sys_regs_at[i].template,
+                        aarch64_sys_regs_at[i].name,
                         (void *) (aarch64_sys_regs_at + i));
 
-  for (i = 0; aarch64_sys_regs_tlbi[i].template != NULL; i++)
+  for (i = 0; aarch64_sys_regs_tlbi[i].name != NULL; i++)
     checked_hash_insert (aarch64_sys_regs_tlbi_hsh,
-                        aarch64_sys_regs_tlbi[i].template,
+                        aarch64_sys_regs_tlbi[i].name,
                         (void *) (aarch64_sys_regs_tlbi + i));
 
   for (i = 0; i < ARRAY_SIZE (reg_names); i++)
index 67b4e41f41ef8bdc107f29cc2d2aadfd55832757..ea833f73657da8e6f8d08c15c37b40e7b184a5de 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-07  Yao Qi  <yao.qi@linaro.org>
+
+       * aarch64.h (aarch64_sys_ins_reg) <template>: Removed.
+       <name>: New field.
+
 2015-10-07  Yao Qi  <yao.qi@linaro.org>
 
        * aarch64.h [__cplusplus]: Wrap in extern "C".
index a8b1f8953eedad815994980fce6e5d04d523cf75..c423858bb7cb0bbe0b054b7c9c2b5dda597409f2 100644 (file)
@@ -652,7 +652,7 @@ extern bfd_boolean aarch64_pstatefield_supported_p (const aarch64_feature_set,
 
 typedef struct
 {
-  const char *template;
+  const char *name;
   uint32_t value;
   int has_xt;
 } aarch64_sys_ins_reg;
index c9c576f43b52e0e513e8847e91e2b58a251552ce..1effd130aef610c7a00b8f48863e5e4e2b68b232 100644 (file)
@@ -1,3 +1,9 @@
+2015-10-07  Yao Qi  <yao.qi@linaro.org>
+
+       * aarch64-dis.c (aarch64_ext_sysins_op): Access field
+       'name' rather than 'template'.
+       * aarch64-opc.c (aarch64_print_operand): Likewise.
+
 2015-10-07  Claudiu Zissulescu <claziss@synopsys.com>
 
        * arc-dis.c: Revamped file for ARC support
index fe3caacd54cfa2217f258625fd539cc387cefb2c..9b96cff572fa743b67929dc685196646d844bdc4 100644 (file)
@@ -1027,12 +1027,12 @@ aarch64_ext_sysins_op (const aarch64_operand *self ATTRIBUTE_UNUSED,
     default: assert (0); return 0;
     }
 
-  for (i = 0; sysins_ops[i].template != NULL; ++i)
+  for (i = 0; sysins_ops[i].name != NULL; ++i)
     if (sysins_ops[i].value == value)
       {
        info->sysins_op = sysins_ops + i;
        DEBUG_TRACE ("%s found value: %x, has_xt: %d, i: %d.",
-                    info->sysins_op->template,
+                    info->sysins_op->name,
                     (unsigned)info->sysins_op->value,
                     info->sysins_op->has_xt, i);
        return 1;
index 9880142873e6bbc65e0742eb1d41d815e4405a5c..c6ab4b24950c39dbae9c10ee6a27cc5e581b79ac 100644 (file)
@@ -2667,7 +2667,7 @@ aarch64_print_operand (char *buf, size_t size, bfd_vma pc,
     case AARCH64_OPND_SYSREG_DC:
     case AARCH64_OPND_SYSREG_IC:
     case AARCH64_OPND_SYSREG_TLBI:
-      snprintf (buf, size, "%s", opnd->sysins_op->template);
+      snprintf (buf, size, "%s", opnd->sysins_op->name);
       break;
 
     case AARCH64_OPND_BARRIER: