X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=opcodes%2Frl78-decode.opc;h=2a3aa55185299cdf2c843afed547de136c87ec5b;hb=7ca9b62a2b63ae04d554053c2a2053d13a9d8c92;hp=57e79ed1de48ea5d16a1160126d0123711efd526;hpb=4d82fe66e8d38b20ad429cb99a99ed8741336d72;p=deliverable%2Fbinutils-gdb.git diff --git a/opcodes/rl78-decode.opc b/opcodes/rl78-decode.opc index 57e79ed1de..2a3aa55185 100644 --- a/opcodes/rl78-decode.opc +++ b/opcodes/rl78-decode.opc @@ -1,5 +1,5 @@ /* -*- c -*- */ -/* Copyright (C) 2012-2016 Free Software Foundation, Inc. +/* Copyright (C) 2012-2020 Free Software Foundation, Inc. Contributed by Red Hat. Written by DJ Delorie. @@ -24,7 +24,8 @@ #include #include #include -#include "ansidecl.h" +#include "bfd.h" +#include "opintl.h" #include "opcode/rl78.h" static int trace = 0; @@ -50,7 +51,9 @@ typedef struct #define W() rl78->size = RL78_Word #define AU ATTRIBUTE_UNUSED -#define GETBYTE() (ld->op [ld->rl78->n_bytes++] = ld->getbyte (ld->ptr)) + +#define OP_BUF_LEN 20 +#define GETBYTE() (ld->rl78->n_bytes < (OP_BUF_LEN - 1) ? ld->op [ld->rl78->n_bytes++] = ld->getbyte (ld->ptr): 0) #define B ((unsigned long) GETBYTE()) #define SYNTAX(x) rl78->syntax = x @@ -98,7 +101,10 @@ immediate (int bytes, int sign_extend, LocalData * ld) i -= 0x1000000; break; default: - fprintf (stderr, "Programmer error: immediate() called with invalid byte count %d\n", bytes); + opcodes_error_handler + /* xgettext:c-format */ + (_("internal error: immediate() called with invalid byte count %d"), + bytes); abort(); } return i; @@ -168,7 +174,7 @@ rl78_decode_opcode (unsigned long pc AU, RL78_Dis_Isa isa) { LocalData lds, * ld = &lds; - unsigned char op_buf[20] = {0}; + unsigned char op_buf[OP_BUF_LEN] = {0}; unsigned char *op = op_buf; int op0, op1;