]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: replace custom attributes with ansidecl.h
authorMike Frysinger <vapier@gentoo.org>
Sun, 2 May 2021 04:07:21 +0000 (00:07 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sun, 2 May 2021 14:58:20 +0000 (10:58 -0400)
A lot of this code predates the common attributes.  We had already
started migrating over piece by piece, so just do a pass across all
the attributes and replace most of them.

20 files changed:
sim/bfin/ChangeLog
sim/bfin/bfin-sim.c
sim/common/ChangeLog
sim/common/callback.c
sim/common/hw-device.h
sim/common/hw-events.h
sim/common/hw-tree.h
sim/common/sim-basics.h
sim/common/sim-engine.h
sim/common/sim-hw.h
sim/common/sim-inline.h
sim/common/sim-io.h
sim/common/sim-profile.c
sim/common/sim-trace.h
sim/igen/ChangeLog
sim/igen/lf.h
sim/m32c/ChangeLog
sim/m32c/m32c.opc
sim/m32c/opc2c.c
sim/m32c/r8c.opc

index 4fe2a9dd1f5a068a387d93625c0d440411c60477..98d8e668eca80ae98b264d2d52389b759132d039 100644 (file)
@@ -1,3 +1,11 @@
+2021-05-02  Mike Frysinger  <vapier@gentoo.org>
+
+       * bfin-sim.c: Include ansidecl.h.
+       (illegal_instruction): Change __attribute__((noreturn)) to
+       ATTRIBUTE_NORETURN.
+       (illegal_instruction_combination, illegal_instruction_or_combination,
+       unhandled_instruction): Likewise.
+
 2021-05-01  Mike Frysinger  <vapier@gentoo.org>
 
        * dv-bfin_mmu.c (bfin_mmu_options): Mark static.
index 674ae87d5e76557c84f0e941091a0202fa0fa186..33bbc6e4963f7827bdb4e9a91df10dc1b80fc299 100644 (file)
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <inttypes.h>
 
+#include "ansidecl.h"
 #include "opcode/bfin.h"
 #include "sim-main.h"
 #include "dv-bfin_cec.h"
@@ -35,7 +36,7 @@
 #define SIGNEXTEND(v, n) \
   (((bs32)(v) << (HOST_LONG_WORD_SIZE - (n))) >> (HOST_LONG_WORD_SIZE - (n)))
 
-static __attribute__ ((noreturn)) void
+static ATTRIBUTE_NORETURN void
 illegal_instruction (SIM_CPU *cpu)
 {
   TRACE_INSN (cpu, "ILLEGAL INSTRUCTION");
@@ -43,7 +44,7 @@ illegal_instruction (SIM_CPU *cpu)
     cec_exception (cpu, VEC_UNDEF_I);
 }
 
-static __attribute__ ((noreturn)) void
+static ATTRIBUTE_NORETURN void
 illegal_instruction_combination (SIM_CPU *cpu)
 {
   TRACE_INSN (cpu, "ILLEGAL INSTRUCTION COMBINATION");
@@ -51,7 +52,7 @@ illegal_instruction_combination (SIM_CPU *cpu)
     cec_exception (cpu, VEC_ILGAL_I);
 }
 
-static __attribute__ ((noreturn)) void
+static ATTRIBUTE_NORETURN void
 illegal_instruction_or_combination (SIM_CPU *cpu)
 {
   if (PARALLEL_GROUP != BFIN_PARALLEL_NONE)
@@ -60,7 +61,7 @@ illegal_instruction_or_combination (SIM_CPU *cpu)
     illegal_instruction (cpu);
 }
 
-static __attribute__ ((noreturn)) void
+static ATTRIBUTE_NORETURN void
 unhandled_instruction (SIM_CPU *cpu, const char *insn)
 {
   SIM_DESC sd = CPU_STATE (cpu);
index 7abaeb3a81669078e7afe5093626dba9435872cf..4aeae9c9209cc5ed2985626af10c5836a7140a4b 100644 (file)
@@ -1,3 +1,26 @@
+2021-05-02  Mike Frysinger  <vapier@gentoo.org>
+
+       * callback.c (os_error): Change __attribute__((noreturn)) to
+       ATTRIBUTE_NORETURN.
+       * hw-device.h (hw_abort, hw_vabort, hw_halthw_trace): Change
+       attributes to ATTRIBUTE_PRINTF and ATTRIBUTE_NORETURN.
+       * hw-events.h (hw_event_queue_schedule_tracef): Likewise.
+       * hw-tree.h (hw_tree_delete): Likewise.
+       * sim-basics.h (__attribute__): Delete.
+       * sim-engine.h (sim_engine_halt): Change __attribute__((noreturn))
+       to ATTRIBUTE_NORETURN.
+       (sim_engine_abort, sim_engine_vabort): Likewise.
+       * sim-hw.h (sim_hw_install, sim_hw_abort): Change
+       __attribute__((printf)) to ATTRIBUTE_PRINTF.
+       * sim-inline.h (NORETURN): Delete.
+       (UNUSED): Change to ATTRIBUTE_UNUSED.
+       * sim-io.h (sim_io_printf): Change attributes to ATTRIBUTE_PRINTF
+       and ATTRIBUTE_NORETURN.
+       (sim_io_eprintf, sim_io_error): Likewise.
+       * sim-profile.c (profile_printf): Likewise.
+       * sim-trace.h (trace_prefix, trace_generic, trace_printf,
+       sim_debug_printf): Likewise.
+
 2021-05-01  Mike Frysinger  <vapier@gentoo.org>
 
        * sim-options.c (dup_arg_p): Call htab_empty.
index aae0630d645ca908d374e54f136d9284ce32180a..55280abb04b9c7fd28ba5f8742a7017145bfcbb0 100644 (file)
@@ -698,10 +698,7 @@ os_evprintf_filtered (host_callback *p ATTRIBUTE_UNUSED, const char *format, va_
 }
 
 /* VARARGS */
-#ifdef __GNUC__
-__attribute__ ((__noreturn__))
-#endif
-static void ATTRIBUTE_PRINTF (2, 3)
+static void ATTRIBUTE_PRINTF (2, 3) ATTRIBUTE_NORETURN
 os_error (host_callback *p ATTRIBUTE_UNUSED, const char *format, ...)
 {
   va_list args;
index a745cb78c748bf247cc389cfdec5b628774129ef..ffd627a441f08ce1f25048218f3aea6725992bb7 100644 (file)
@@ -432,17 +432,17 @@ int hw_ioctl
 void hw_abort
 (struct hw *me,
  const char *fmt,
- ...) __attribute__ ((format (printf, 2, 3), noreturn));
+ ...) ATTRIBUTE_PRINTF (2, 3) ATTRIBUTE_NORETURN;
 
 void hw_vabort
 (struct hw *me,
  const char *fmt,
- va_list ap) __attribute__ ((noreturn));
+ va_list ap) ATTRIBUTE_NORETURN;
 
 void hw_halt
 (struct hw *me,
  int reason,
- int status) __attribute__ ((noreturn));
+ int status) ATTRIBUTE_NORETURN;
 
 
 #define hw_trace_p(hw) ((hw)->trace_of_hw_p + 0)
@@ -450,7 +450,7 @@ void hw_halt
 void hw_trace
 (struct hw *me,
  const char *fmt,
- ...) __attribute__ ((format (printf, 2, 3)));
+ ...) ATTRIBUTE_PRINTF (2, 3);
 
 #define HW_TRACE(ARGS) \
 do { \
index 9307f8d131b028944df05804a17463d4d451f396..901063b73da2b1862fa6d29100edfa63a214c674 100644 (file)
@@ -39,7 +39,7 @@ struct hw_event *hw_event_queue_schedule_tracef
  hw_event_callback *handler,
  void *data,
  const char *fmt,
- ...) __attribute__ ((format (printf, 5, 6)));
+ ...) ATTRIBUTE_PRINTF (5, 6);
 
 struct hw_event *hw_event_queue_schedule_vtracef
 (struct hw *me,
index 55975df9e9c1f6ee66e89249c0694e7459f73a3b..86ebf1709cad4b097f86af9221139767aa34036f 100644 (file)
@@ -34,7 +34,7 @@ void hw_tree_delete
 struct hw *hw_tree_parse
 (struct hw *root,
  const char *fmt,
- ...) __attribute__ ((format (printf, 2, 3)));
+ ...) ATTRIBUTE_PRINTF (2, 3);
 
 struct hw *hw_tree_vparse
 (struct hw *root,
index 52c9b2fa40c3f7c809f106518ec978f0307dfa16..e822fb2eb818a64a58c2c6fb43158185cf3785b0 100644 (file)
 #endif
 
 
-/* Some versions of GCC include an attribute operator, define it */
-
-#if !defined (__attribute__)
-#if (!defined(__GNUC__) || (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 6))
-#define __attribute__(arg)
-#endif
-#endif
-
-
 /* Global types that code manipulates */
 
 struct hw;
index 5adce8deedbc03e9967192151b4becfa210c731b..3ebf8acbaccc38550f92527d5bc0a72d1f35dc29 100644 (file)
@@ -62,7 +62,7 @@ extern void sim_engine_halt
  sim_cpu *next_cpu, /* NULL -> succ (last_cpu) or event-mgr */
  sim_cia cia,
  enum sim_stop reason,
- int sigrc) __attribute__ ((noreturn));
+ int sigrc) ATTRIBUTE_NORETURN;
 
 /* Halt hook - allow target specific operation when halting a
    simulator */
@@ -115,14 +115,14 @@ extern void sim_engine_abort
  sim_cpu *cpu,
  sim_cia cia,
  const char *fmt,
- ...) ATTRIBUTE_PRINTF (4, 5) __attribute__ ((noreturn));
+ ...) ATTRIBUTE_PRINTF (4, 5) ATTRIBUTE_NORETURN;
 
 extern void sim_engine_vabort
 (SIM_DESC sd,
  sim_cpu *cpu,
  sim_cia cia,
  const char *fmt,
- va_list ap) ATTRIBUTE_PRINTF (4, 0) __attribute__ ((noreturn));
+ va_list ap) ATTRIBUTE_PRINTF (4, 0) ATTRIBUTE_NORETURN;
 
 /* No abort hook - when possible this function exits using the
    engine_halt function (and SIM_ENGINE_HALT_HOOK). */
index 95b98560fccd656afcadc38ae24f1d898195f036..976a22007169bd1e7df0f5882558d3d2ad654da5 100644 (file)
@@ -32,7 +32,7 @@ SIM_RC sim_hw_install
 struct hw *sim_hw_parse
 (struct sim_state *sd,
  const char *fmt,
- ...) __attribute__ ((format (printf, 2, 3)));
+ ...) ATTRIBUTE_PRINTF (2, 3);
 
 
 /* Print the hardware tree */
@@ -48,7 +48,7 @@ void sim_hw_abort
 (SIM_DESC sd,
  struct hw *hw,
  const char *fmt,
- ...) __attribute__ ((format (printf, 3, 4), noreturn));
+ ...) ATTRIBUTE_PRINTF (3, 4) ATTRIBUTE_NORETURN;
 
 
 
index ed7baa4b7106e120133fd2766e03d98f3b8c65ab..2750fa93cbc731d4b1c1e1f7ad1dac6b8680f4ac 100644 (file)
 #endif
 
 
-/* Your compiler's no-return reserved word */
-
-#ifndef NORETURN
-#define NORETURN
-#endif
-
-
-
 /* Your compilers's unused reserved word */
 
 #if !defined (UNUSED)
-#if (!defined (__GNUC__) \
-     || (__GNUC__ < 2) \
-     || (__GNUC__ == 2 && __GNUC_MINOR__ < 7))
-#define UNUSED
-#else
-#define UNUSED __attribute__((__unused__))
-#endif
+#define UNUSED ATTRIBUTE_UNUSED
 #endif
 
 
index 33dfa78ef0982892e4f172f1b1f6c4dd22ee418b..f018538ce469689f445f52b6135993f78a999bc4 100644 (file)
@@ -63,21 +63,21 @@ int sim_io_close (SIM_DESC sd, int);
 
 void sim_io_printf (SIM_DESC sd,
                    const char *fmt,
-                   ...) __attribute__ ((format (printf, 2, 3)));
+                   ...) ATTRIBUTE_PRINTF (2, 3);
 
 void sim_io_vprintf (SIM_DESC sd, const char *fmt, va_list ap);
 
 void sim_io_eprintf (SIM_DESC sd,
                     const char *fmt,
-                    ...) __attribute__ ((format (printf, 2, 3)));
+                    ...) ATTRIBUTE_PRINTF (2, 3);
 
 void sim_io_evprintf (SIM_DESC sd, const char *fmt, va_list ap);
 
 void sim_io_error (SIM_DESC sd,
                   const char *fmt,
                   ...)
-  __attribute__ ((format (printf, 2, 3)))
-  __attribute__ ((__noreturn__));
+  ATTRIBUTE_PRINTF (2, 3)
+  ATTRIBUTE_NORETURN;
 
 void sim_io_poll_quit (SIM_DESC sd);
 
index 5508f0f516d6dfe9e7126baa1234729d32d98bd0..75bdc70298ccd649bc02fb1c84a62828fb2f24af 100644 (file)
@@ -466,7 +466,7 @@ profile_vprintf (SIM_DESC sd, sim_cpu *cpu, const char *fmt, va_list ap)
     sim_io_evprintf (sd, fmt, ap);
 }
 
-__attribute__ ((format (printf, 3, 4)))
+ATTRIBUTE_PRINTF (3, 4)
 static void
 profile_printf (SIM_DESC sd, sim_cpu *cpu, const char *fmt, ...)
 {
index e96e68479565a58f19016e9e3ed11575b2d54464..7ff7b021b3372dcf3e04b1c8fb4f4b03d334d423 100644 (file)
@@ -333,8 +333,7 @@ extern void trace_prefix (SIM_DESC sd,
                          const char *file_name,
                          int line_nr,
                          const char *fmt,
-                         ...)
-       __attribute__((format (printf, 8, 9)));
+                         ...) ATTRIBUTE_PRINTF (8, 9);
 
 /* Generic trace print, assumes trace_prefix() has been called */
 
@@ -342,8 +341,7 @@ extern void trace_generic (SIM_DESC sd,
                           sim_cpu *cpu,
                           int trace_idx,
                           const char *fmt,
-                          ...)
-     __attribute__((format (printf, 4, 5)));
+                          ...) ATTRIBUTE_PRINTF (4, 5);
 
 /* Disassemble the specified address.  */
 
@@ -655,7 +653,7 @@ do { \
 
 \f
 extern void trace_printf (SIM_DESC, sim_cpu *, const char *, ...)
-     __attribute__((format (printf, 3, 4)));
+     ATTRIBUTE_PRINTF (3, 4);
 
 extern void trace_vprintf (SIM_DESC, sim_cpu *, const char *, va_list);
 
@@ -676,6 +674,6 @@ int trace_load_symbols (SIM_DESC);
 bfd_vma trace_sym_value (SIM_DESC, const char *name);
 
 extern void sim_debug_printf (sim_cpu *, const char *, ...)
-     __attribute__((format (printf, 2, 3)));
+    ATTRIBUTE_PRINTF (2, 3);
 
 #endif /* SIM_TRACE_H */
index a8eeddab6330db935cf5d9b06e07e213c121794d..84b9e67058d2a599eca39f36495911b8c8ef28ce 100644 (file)
@@ -1,3 +1,8 @@
+2021-05-02  Mike Frysinger  <vapier@gentoo.org>
+
+       * lf.h: Include ansidecl.h.
+       (lf_printf): Change __attribute__((printf)) to ATTRIBUTE_PRINTF.
+
 2021-04-02  Mike Frysinger  <vapier@gentoo.org>
 
        * local.mk: New file.
index c6185dbab861befd64360c081b0e2b28ff793191..5a6d5a7b8f2f12f67d0dc039979f24811a75bb2a 100644 (file)
@@ -19,7 +19,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-
+#include "ansidecl.h"
 
 /* LF: Line Numbered Output Stream */
 
@@ -72,7 +72,7 @@ extern int lf_putint (lf *file, int decimal);
 extern int lf_putbin (lf *file, int decimal, int width);
 
 extern int lf_printf
-  (lf *file, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
+  (lf *file, const char *fmt, ...) ATTRIBUTE_PRINTF (2, 3);
 
 
 /* Indentation control.
index b2a02a6c45c8ad8374447cf575c39144601936db..e3393c9be662958ddd0edc59a5a69048c96dadd0 100644 (file)
@@ -1,3 +1,11 @@
+2021-05-02  Mike Frysinger  <vapier@gentoo.org>
+
+       * m32c.opc: Include ansidecl.h.
+       (AU): Delete.
+       * opc2c.c (dump_lines): Change AU to ATTRIBUTE_UNUSED.
+       * r8c.opc: Include ansidecl.h.
+       (AU): Delete.
+
 2021-05-01  Mike Frysinger  <vapier@gentoo.org>
 
        * config.in, configure: Regenerate.
index feee1e933971ed12d5e35adefbca6c2c00012a31..efe049568bdd55e279ca0a152aabb8de6af23aaa 100644 (file)
@@ -22,13 +22,12 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "ansidecl.h"
 #include "cpu.h"
 #include "mem.h"
 #include "misc.h"
 #include "int.h"
 
-#define AU  __attribute__((unused))
-
 #define tprintf if (trace) printf
 
 static unsigned char
index 3d8f2c1bac8f5c3ec52864ba2bedf090373ccfc2..64874279179aca76576fa18722e134cb5c0a3d03 100644 (file)
@@ -249,13 +249,14 @@ dump_lines (opcode * op, int level, Indirect * ind)
              errors++;
            }
          else if (shift && (mask != 0xff))
-           printf ("%*s  int %s AU = (op[%d] >> %d) & 0x%02x;\n",
+           printf ("%*s  int %s ATTRIBUTE_UNUSED = (op[%d] >> %d) & 0x%02x;\n",
                    level, "", name, byte, shift, mask);
          else if (mask != 0xff)
-           printf ("%*s  int %s AU = op[%d] & 0x%02x;\n",
+           printf ("%*s  int %s ATTRIBUTE_UNUSED = op[%d] & 0x%02x;\n",
                    level, "", name, byte, mask);
          else
-           printf ("%*s  int %s AU = op[%d];\n", level, "", name, byte);
+           printf ("%*s  int %s ATTRIBUTE_UNUSED = op[%d];\n", level, "", name,
+                   byte);
        }
       else
        i++;
index aba2679c19ed04519fcab0d43784f75ea78a4913..dc447b5b391a07ea4a81729ae86e4a72c5514223 100644 (file)
@@ -22,13 +22,12 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "ansidecl.h"
 #include "cpu.h"
 #include "mem.h"
 #include "misc.h"
 #include "int.h"
 
-#define AU  __attribute__((unused))
-
 #define tprintf if (trace) printf
 
 static unsigned char