From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28422 invoked by alias); 16 Mar 2012 23:21:32 -0000 Received: (qmail 28399 invoked by uid 22791); 16 Mar 2012 23:21:31 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 16 Mar 2012 23:21:16 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id DA6961C67EF for ; Fri, 16 Mar 2012 19:21:15 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id bplxQom8jLUT for ; Fri, 16 Mar 2012 19:21:15 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id A70771C67E4 for ; Fri, 16 Mar 2012 19:21:15 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 8F580145615; Fri, 16 Mar 2012 16:21:03 -0700 (PDT) From: Joel Brobecker To: gdb-patches@sourceware.org Subject: RFC: merge std-operator.def and ada-operator.def? Date: Fri, 16 Mar 2012 23:21:00 -0000 Message-Id: <1331940061-10739-1-git-send-email-brobecker@adacore.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-03/txt/msg00641.txt.bz2 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?