]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[PATCH] fix windmc typedef bug
authorJoel Anderson <joelanderson333@gmail.com>
Wed, 3 Jun 2020 15:44:37 +0000 (16:44 +0100)
committerNick Clifton <nickc@redhat.com>
Wed, 3 Jun 2020 15:44:37 +0000 (16:44 +0100)
While a typedef can be specified in message files for the messages following
with the `MessageIdTypedef` directive, only the last typedef was honored by
windmc. This corrects this behavior, matching mc.exe functionality.

* windmc.h (struct mc_node): Add id_typecast field.
* mcparse.y (message): Initialise the id_typecast field.
* windmc.c (write_dbg): Use the id_typecast field as a parameter
when calling write_dbg_define.
(write_header): Likewise.

binutils/ChangeLog
binutils/mcparse.y
binutils/windmc.c
binutils/windmc.h

index ff1e52c14dde8f1a8d6180ea83838fc0860efd6d..44200c224bf3d873af50899b5c21aa4f4286e899 100644 (file)
@@ -1,3 +1,11 @@
+2020-06-03  Joel Anderson  <joelanderson333@gmail.com>
+
+       * windmc.h (struct mc_node): Add id_typecast field.
+       * mcparse.y (message): Initialise the id_typecast field.
+       * windmc.c (write_dbg): Use the id_typecast field as a parameter
+       when calling write_dbg_define.
+       (write_header): Likewise.
+
 2020-06-03  Alan Modra  <amodra@gmail.com>
 
        PR 26069
index 0fbef9b47058cf53a83ba0cf4e03980f7d037850..a274eeee5a53ed2b750f65456c16731f1e18f8f1 100644 (file)
@@ -181,6 +181,7 @@ message:
            cur_node->severity = mc_cur_severity;
            cur_node->id = ($1 & 0xffffUL);
            cur_node->vid = ($1 & 0xffffUL) | mc_sefa_val;
+           cur_node->id_typecast = mcset_msg_id_typedef;
            mc_last_id = $1;
          }
          lang_entities
index 0aae65071fd35da50cb12b1ddb04a65a6e6c4f68..98bb3ad6908dc7f25156b895170c5862b4f4b83d 100644 (file)
@@ -821,7 +821,7 @@ write_dbg (FILE *fp)
   while (h != NULL)
     {
       if (h->symbol)
-       write_dbg_define (fp, h->symbol, mcset_msg_id_typedef);
+       write_dbg_define (fp, h->symbol, h->id_typecast);
       h = h->next;
     }
   fprintf (fp, "  { (");
@@ -908,7 +908,7 @@ write_header (FILE *fp)
            fprintf (fp, "%s", s);
        }
       if (h->symbol)
-       write_header_define (fp, h->symbol, h->vid, mcset_msg_id_typedef, h->sub);
+       write_header_define (fp, h->symbol, h->vid, h->id_typecast, h->sub);
       h = h->next;
     }
 }
index 784ecc856ad1b6baec47937b1f4184302916f6e0..5c74124f442cad7301a4d5ba6567a77aa4c980ad 100644 (file)
@@ -66,6 +66,7 @@ typedef struct mc_node
   unichar *symbol;
   rc_uint_type id;
   rc_uint_type vid;
+  unichar *id_typecast;
   mc_node_lang *sub;
 } mc_node;