Update comments to operator_check

Message ID 1406288349-17116-1-git-send-email-yao@codesourcery.com
State Committed
Headers

Commit Message

Yao Qi July 25, 2014, 11:39 a.m. UTC
  Hello,
I happen to read the code and find the comments to operator_check are
incorrect.  This patch is to fix the comments per my understanding.
The comments and field operator_check was added by this patch

  https://sourceware.org/ml/gdb-patches/2010-04/msg00556.html

but the inconsistency between code and comments wasn't pointed out during
the review.

gdb:

2014-07-25  Yao Qi  <yao@codesourcery.com>

	* parser-defs.h (struct exp_descriptor) <operator_check>: Update
	comments.
	* parse.c (exp_iterate): Update comments.
---
 gdb/parse.c       | 12 ++++++------
 gdb/parser-defs.h | 16 ++++++++--------
 2 files changed, 14 insertions(+), 14 deletions(-)
  

Comments

Pedro Alves July 29, 2014, 12:18 p.m. UTC | #1
On 07/25/2014 12:39 PM, Yao Qi wrote:
> Hello,
> I happen to read the code and find the comments to operator_check are
> incorrect.  This patch is to fix the comments per my understanding.
> The comments and field operator_check was added by this patch
> 
>   https://sourceware.org/ml/gdb-patches/2010-04/msg00556.html
> 
> but the inconsistency between code and comments wasn't pointed out during
> the review.

Yeah, IIUC, that code was originally based on:

 https://sourceware.org/ml/gdb-patches/2009-07/msg00054.html

> 
> gdb:
> 
> 2014-07-25  Yao Qi  <yao@codesourcery.com>
> 
> 	* parser-defs.h (struct exp_descriptor) <operator_check>: Update
> 	comments.
> 	* parse.c (exp_iterate): Update comments.

OK.
  
Yao Qi July 30, 2014, 9:40 a.m. UTC | #2
On 07/29/2014 08:18 PM, Pedro Alves wrote:
>> > gdb:
>> > 
>> > 2014-07-25  Yao Qi  <yao@codesourcery.com>
>> > 
>> > 	* parser-defs.h (struct exp_descriptor) <operator_check>: Update
>> > 	comments.
>> > 	* parse.c (exp_iterate): Update comments.
> OK.

Patch is pushed in.
  

Patch

diff --git a/gdb/parse.c b/gdb/parse.c
index 105d0cd..47533bb 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1835,12 +1835,12 @@  operator_check_standard (struct expression *exp, int pos,
   return 0;
 }
 
-/* Call OBJFILE_FUNC for any TYPE and OBJFILE found being referenced by EXP.
-   The functions are never called with NULL OBJFILE.  Functions get passed an
-   arbitrary caller supplied DATA pointer.  If any of the functions returns
-   non-zero value then (any other) non-zero value is immediately returned to
-   the caller.  Otherwise zero is returned after iterating through whole EXP.
-   */
+/* Call OBJFILE_FUNC for any objfile found being referenced by EXP.
+   OBJFILE_FUNC is never called with NULL OBJFILE.  OBJFILE_FUNC get
+   passed an arbitrary caller supplied DATA pointer.  If OBJFILE_FUNC
+   returns non-zero value then (any other) non-zero value is immediately
+   returned to the caller.  Otherwise zero is returned after iterating
+   through whole EXP.  */
 
 static int
 exp_iterate (struct expression *exp,
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index 97c53b9..e43b1ae 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -341,14 +341,14 @@  struct exp_descriptor
        the number of subexpressions it takes.  */
     void (*operator_length) (const struct expression*, int, int*, int *);
 
-    /* Call TYPE_FUNC and OBJFILE_FUNC for any TYPE and OBJFILE found being
-       referenced by the single operator of EXP at position POS.  Operator
-       parameters are located at positive (POS + number) offsets in EXP.
-       The functions should never be called with NULL TYPE or NULL OBJFILE.
-       Functions should get passed an arbitrary caller supplied DATA pointer.
-       If any of the functions returns non-zero value then (any other) non-zero
-       value should be immediately returned to the caller.  Otherwise zero
-       should be returned.  */
+    /* Call OBJFILE_FUNC for any objfile found being referenced by the
+       single operator of EXP at position POS.  Operator parameters are
+       located at positive (POS + number) offsets in EXP.  OBJFILE_FUNC
+       should never be called with NULL OBJFILE.  OBJFILE_FUNC should
+       get passed an arbitrary caller supplied DATA pointer.  If it
+       returns non-zero value then (any other) non-zero value should be
+       immediately returned to the caller.  Otherwise zero should be
+       returned.  */
     int (*operator_check) (struct expression *exp, int pos,
 			   int (*objfile_func) (struct objfile *objfile,
 						void *data),