* config/bfin-parse.y (gen_multi_instr_1): Check anomaly
[deliverable/binutils-gdb.git] / opcodes / z8kgen.c
index 5adbfecb5fd81d421160cc25d631b7993fc54642..2012bc44460f65e3b5cab472bcaa1d01d03d0da8 100644 (file)
@@ -1,21 +1,21 @@
-/* Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright 2001, 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
 
-   This file is part of GNU Binutils.
+   This file is part of the GNU opcodes library.
 
-   This program is free software; you can redistribute it and/or modify
+   This library is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
 
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
+   It is distributed in the hope that it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+   License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
-   USA.  */
+   along with this file; see the file COPYING.  If not, write to the
+   Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 /* This program generates z8k-opc.h.  Compile with -fwritable-strings.  */
 
@@ -904,14 +904,14 @@ static void
 internal (void)
 {
   int c = count ();
-  struct op *new = (struct op *) xmalloc (sizeof (struct op) * c);
+  struct op *new_op = xmalloc (sizeof (struct op) * c);
   struct op *p = opt;
-  memcpy (new, p, c * sizeof (struct op));
+  memcpy (new_op, p, c * sizeof (struct op));
 
   /* Sort all names in table alphabetically.  */
-  qsort (new, c, sizeof (struct op), (int (*)(const void *, const void *))func);
+  qsort (new_op, c, sizeof (struct op), (int (*)(const void *, const void *))func);
 
-  p = new;
+  p = new_op;
   while (p->flags && p->flags[0] != '*')
   {
     /* If there are any @rs, sub the ssss into a ssn0, (rs), (ssn0).  */
@@ -960,15 +960,33 @@ gas (void)
   struct op *p = opt;
   int idx = -1;
   char *oldname = "";
-  struct op *new = (struct op *) xmalloc (sizeof (struct op) * c);
+  struct op *new_op = xmalloc (sizeof (struct op) * c);
 
-  memcpy (new, p, c * sizeof (struct op));
+  memcpy (new_op, p, c * sizeof (struct op));
 
   /* Sort all names in table alphabetically.  */
-  qsort (new, c, sizeof (struct op), (int (*)(const void *, const void *))func);
+  qsort (new_op, c, sizeof (struct op), (int (*)(const void *, const void *)) func);
 
   printf ("/* DO NOT EDIT!  -*- buffer-read-only: t -*-\n");
   printf ("   This file is automatically generated by z8kgen.  */\n\n");
+  printf ("/* Copyright 2007, 2009 Free Software Foundation, Inc.\n\
+\n\
+   This file is part of the GNU opcodes library.\n\
+\n\
+   This library is free software; you can redistribute it and/or modify\n\
+   it under the terms of the GNU General Public License as published by\n\
+   the Free Software Foundation; either version 3, or (at your option)\n\
+   any later version.\n\
+\n\
+   It is distributed in the hope that it will be useful, but WITHOUT\n\
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\n\
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\n\
+   License for more details.\n\
+\n\
+   You should have received a copy of the GNU General Public License\n\
+   along with this file; see the file COPYING.  If not, write to the\n\
+   Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,\n\
+   MA 02110-1301, USA.  */\n\n");
 
   printf ("#define ARG_MASK         0x0f\n");
 
@@ -1251,7 +1269,7 @@ gas (void)
   printf ("#endif\n");
   printf ("  const char *name;\n");
   printf ("  unsigned char opcode;\n");
-  printf ("  void (*func) PARAMS ((void));\n");
+  printf ("  void (*func) (void);\n");
   printf ("  unsigned int arg_info[4];\n");
   printf ("  unsigned int byte_info[%d];\n", BYTE_INFO_LEN);
   printf ("  int noperands;\n");
@@ -1261,19 +1279,19 @@ gas (void)
   printf ("#ifdef DEFINE_TABLE\n");
   printf ("const opcode_entry_type z8k_table[] = {\n");
 
-  while (new->flags && new->flags[0])
+  while (new_op->flags && new_op->flags[0])
     {
       int nargs;
       int length;
 
-      printf ("\n/* %s *** %s */\n", new->bits, new->name);
+      printf ("\n/* %s *** %s */\n", new_op->bits, new_op->name);
       printf ("{\n");
 
       printf ("#ifdef NICENAMES\n");
-      printf ("\"%s\",%d,%d,", new->name, new->type, new->cycles);
+      printf ("\"%s\",%d,%d,", new_op->name, new_op->type, new_op->cycles);
       {
        int answer = 0;
-       char *p = new->flags;
+       char *p = new_op->flags;
 
        while (*p)
          {
@@ -1288,20 +1306,20 @@ gas (void)
 
       printf ("#endif\n");
 
-      nargs = chewname (&new->name);
+      nargs = chewname (&new_op->name);
 
       printf ("\n\t");
-      chewbits (new->bits, &length);
+      chewbits (new_op->bits, &length);
       length /= 2;
       if (length & 1)
        abort();
 
-      if (strcmp (oldname, new->name) != 0)
+      if (strcmp (oldname, new_op->name) != 0)
        idx++;
       printf (",%d,%d,%d", nargs, length, idx);
-      oldname = new->name;
+      oldname = new_op->name;
       printf ("},\n");
-      new++;
+      new_op++;
     }
   printf ("\n/* end marker */\n");
   printf ("{\n#ifdef NICENAMES\nNULL,0,0,\n0,\n#endif\n");
This page took 0.025807 seconds and 4 git commands to generate.