[RFA/commit] Document exp_descriptor.op_name should never return NULL.

Joel Brobecker brobecker@adacore.com
Wed Oct 3 18:40:00 GMT 2012


This documents a constaint that struct exp_descriptor's "op_name"
method implementation should obey.  This might not have been part
of the initial design, but is currently true of all instantiations,
and already assumed by the current users.


        * parser-defs.h (struct exp_descriptor): Document constraint
        on return value for "op_name" callbacks.

This is a patch that I thought I had sent a long time ago, but
apparently didn't. I'll commit in a few days unless someone objects.


 gdb/parser-defs.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index 86f3bdf..c889d56 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -335,7 +335,10 @@ struct exp_descriptor
 						void *data),
 			   void *data);
-    /* Name of this operator for dumping purposes.  */
+    /* Name of this operator for dumping purposes.
+       The returned value should never be NULL, even if EXP_OPCODE is
+       an unknown opcode (a string containing an image of the numeric
+       value of the opcode can be returned, for instance).  */
     char *(*op_name) (enum exp_opcode);
     /* Dump the rest of this (prefix) expression after the operator

More information about the Gdb-patches mailing list