Fix some value comments

Message ID 20230301213009.4030832-1-tromey@adacore.com
State Committed
Commit 2641391a87d5e6029cb1f083fd42926f668094eb
Headers
Series Fix some value comments |

Commit Message

Tom Tromey March 1, 2023, 9:30 p.m. UTC
  I noticed a very stale comment in valarith.c.  This patch fixes a few
comments in this area.
---
 gdb/valarith.c | 6 +++++-
 gdb/value.h    | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)
  

Comments

Andrew Burgess March 2, 2023, 9:29 a.m. UTC | #1
Tom Tromey via Gdb-patches <gdb-patches@sourceware.org> writes:

> I noticed a very stale comment in valarith.c.  This patch fixes a few
> comments in this area.

LGTM.

Reviewed-By: Andrew Burgess <aburgess@redhat.com>

Thanks,
Andrew


> ---
>  gdb/valarith.c | 6 +++++-
>  gdb/value.h    | 5 +++++
>  2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/gdb/valarith.c b/gdb/valarith.c
> index 6ea0cd9e8d1..4c2b44360bb 100644
> --- a/gdb/valarith.c
> +++ b/gdb/valarith.c
> @@ -1884,7 +1884,7 @@ value_less (struct value *arg1, struct value *arg2)
>      }
>  }
>  
> -/* The unary operators +, - and ~.  They free the argument ARG1.  */
> +/* See value.h.  */
>  
>  struct value *
>  value_pos (struct value *arg1)
> @@ -1902,6 +1902,8 @@ value_pos (struct value *arg1)
>      error (_("Argument to positive operation not a number."));
>  }
>  
> +/* See value.h.  */
> +
>  struct value *
>  value_neg (struct value *arg1)
>  {
> @@ -1948,6 +1950,8 @@ value_neg (struct value *arg1)
>      error (_("Argument to negate operation not a number."));
>  }
>  
> +/* See value.h.  */
> +
>  struct value *
>  value_complement (struct value *arg1)
>  {
> diff --git a/gdb/value.h b/gdb/value.h
> index c3eb96bf143..d83c4ab3674 100644
> --- a/gdb/value.h
> +++ b/gdb/value.h
> @@ -1206,10 +1206,15 @@ extern struct value *value_ref (struct value *arg1, enum type_code refcode);
>  extern struct value *value_assign (struct value *toval,
>  				   struct value *fromval);
>  
> +/* The unary + operation.  */
>  extern struct value *value_pos (struct value *arg1);
>  
> +/* The unary - operation.  */
>  extern struct value *value_neg (struct value *arg1);
>  
> +/* The unary ~ operation -- but note that it also implements the GCC
> +   extension, where ~ of a complex number is the complex
> +   conjugate.  */
>  extern struct value *value_complement (struct value *arg1);
>  
>  extern struct value *value_struct_elt (struct value **argp,
> -- 
> 2.39.1
  

Patch

diff --git a/gdb/valarith.c b/gdb/valarith.c
index 6ea0cd9e8d1..4c2b44360bb 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -1884,7 +1884,7 @@  value_less (struct value *arg1, struct value *arg2)
     }
 }
 
-/* The unary operators +, - and ~.  They free the argument ARG1.  */
+/* See value.h.  */
 
 struct value *
 value_pos (struct value *arg1)
@@ -1902,6 +1902,8 @@  value_pos (struct value *arg1)
     error (_("Argument to positive operation not a number."));
 }
 
+/* See value.h.  */
+
 struct value *
 value_neg (struct value *arg1)
 {
@@ -1948,6 +1950,8 @@  value_neg (struct value *arg1)
     error (_("Argument to negate operation not a number."));
 }
 
+/* See value.h.  */
+
 struct value *
 value_complement (struct value *arg1)
 {
diff --git a/gdb/value.h b/gdb/value.h
index c3eb96bf143..d83c4ab3674 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -1206,10 +1206,15 @@  extern struct value *value_ref (struct value *arg1, enum type_code refcode);
 extern struct value *value_assign (struct value *toval,
 				   struct value *fromval);
 
+/* The unary + operation.  */
 extern struct value *value_pos (struct value *arg1);
 
+/* The unary - operation.  */
 extern struct value *value_neg (struct value *arg1);
 
+/* The unary ~ operation -- but note that it also implements the GCC
+   extension, where ~ of a complex number is the complex
+   conjugate.  */
 extern struct value *value_complement (struct value *arg1);
 
 extern struct value *value_struct_elt (struct value **argp,