Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: RFC: merge std-operator.def and ada-operator.def?
Date: Fri, 16 Mar 2012 23:21:00 -0000	[thread overview]
Message-ID: <1331940061-10739-1-git-send-email-brobecker@adacore.com> (raw)

Hello,

This is something I noticed while investigating something else: There
is no public function that prints a string image of an exp_opcode
enum. Digging deeper, I found "op_name", and eventually made it non-
static. I also found op_name_standard, but it only handled "standard"
opcodes, which, in pratice, means everything-but-Ada.

Thinking about all this, and knowing the fact that std-operator actually
also contains some language-specific operators as well (Eg Fortran's
OP_F90_RANGE), it seemed to me that this separation was causing some
unnecessary complexity in our code. The basic observation is that, to
print an opcode, you had to go through the language vector.

This patch mini-series simplifies all this.  Two steps:
  1. Merge std-operator.def and ada-operator.def into one "operator.def";
  2. Delete the "op_name" language-specific callback in struct
     struct exp_descriptor, and make some simplications that this
     change enables.

I would be tempted to add a third pass, which would rename "op_name"
into something a little more meaningful, such as "opcode_img", or
"opcode_image" or "opcode2str", so as not to confuse it with
expprint.c:op_string which does something entirely different
(ie converts BINOP_LOGICAL_OR into "||", for instance), and may
in fact return NULL even for valid opcodes.  This third step would
not be a very large patch, since the number of callers is very small.

The patch series was tested on x86_64-linux, no regression.
Thoughts?



             reply	other threads:[~2012-03-16 23:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-16 23:21 Joel Brobecker [this message]
2012-03-16 23:21 ` [RFC 2/2] Remove op_name callback in struct exp_descriptor Joel Brobecker
2012-03-16 23:21 ` [RFC 1/2] merge std-operator.def & ada-operator.def into one file Joel Brobecker
2012-03-16 23:29 ` RFC: merge std-operator.def and ada-operator.def? Joel Brobecker
2012-03-19  8:46 ` Jan Kratochvil
2012-03-19 15:34   ` Joel Brobecker
2012-03-19 15:40     ` Jan Kratochvil
2012-03-19 15:50       ` Joel Brobecker
2012-03-19 15:58         ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1331940061-10739-1-git-send-email-brobecker@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox