* [PATCH] constify value_aggregate_elt
@ 2014-03-27 20:11 Tom Tromey
2014-03-28 13:20 ` Joel Brobecker
2014-04-14 18:07 ` Tom Tromey
0 siblings, 2 replies; 4+ messages in thread
From: Tom Tromey @ 2014-03-27 20:11 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
While working on another patch I realized that value_aggregate_elt's
"name" parameter ought to be const. This patch implements this.
2014-03-27 Tom Tromey <tromey@redhat.com>
* valops.c (value_aggregate_elt, value_struct_elt_for_reference)
(value_namespace_elt, value_maybe_namespace_elt): Make "name"
const.
* value.h (value_aggregate_elt): Update.
---
gdb/ChangeLog | 7 +++++++
gdb/valops.c | 14 +++++++-------
gdb/value.h | 2 +-
3 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/gdb/valops.c b/gdb/valops.c
index cf195a3..a10dbd6 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -83,15 +83,15 @@ oload_classification classify_oload_match (struct badness_vector *,
static struct value *value_struct_elt_for_reference (struct type *,
int, struct type *,
- char *,
+ const char *,
struct type *,
int, enum noside);
static struct value *value_namespace_elt (const struct type *,
- char *, int , enum noside);
+ const char *, int , enum noside);
static struct value *value_maybe_namespace_elt (const struct type *,
- char *, int,
+ const char *, int,
enum noside);
static CORE_ADDR allocate_space_in_inferior (int);
@@ -3014,7 +3014,7 @@ destructor_name_p (const char *name, struct type *type)
the comment before value_struct_elt_for_reference. */
struct value *
-value_aggregate_elt (struct type *curtype, char *name,
+value_aggregate_elt (struct type *curtype, const char *name,
struct type *expect_type, int want_address,
enum noside noside)
{
@@ -3095,7 +3095,7 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial)
static struct value *
value_struct_elt_for_reference (struct type *domain, int offset,
- struct type *curtype, char *name,
+ struct type *curtype, const char *name,
struct type *intype,
int want_address,
enum noside noside)
@@ -3324,7 +3324,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
static struct value *
value_namespace_elt (const struct type *curtype,
- char *name, int want_address,
+ const char *name, int want_address,
enum noside noside)
{
struct value *retval = value_maybe_namespace_elt (curtype, name,
@@ -3346,7 +3346,7 @@ value_namespace_elt (const struct type *curtype,
static struct value *
value_maybe_namespace_elt (const struct type *curtype,
- char *name, int want_address,
+ const char *name, int want_address,
enum noside noside)
{
const char *namespace_name = TYPE_TAG_NAME (curtype);
diff --git a/gdb/value.h b/gdb/value.h
index f846669..9425a0e 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -676,7 +676,7 @@ extern struct value *value_struct_elt_bitpos (struct value **argp,
const char *err);
extern struct value *value_aggregate_elt (struct type *curtype,
- char *name,
+ const char *name,
struct type *expect_type,
int want_address,
enum noside noside);
--
1.8.5.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] constify value_aggregate_elt
2014-03-27 20:11 [PATCH] constify value_aggregate_elt Tom Tromey
@ 2014-03-28 13:20 ` Joel Brobecker
2014-03-31 17:26 ` Tom Tromey
2014-04-14 18:07 ` Tom Tromey
1 sibling, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2014-03-28 13:20 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
Hey Tom,
On Thu, Mar 27, 2014 at 02:11:40PM -0600, Tom Tromey wrote:
> While working on another patch I realized that value_aggregate_elt's
> "name" parameter ought to be const. This patch implements this.
>
> 2014-03-27 Tom Tromey <tromey@redhat.com>
>
> * valops.c (value_aggregate_elt, value_struct_elt_for_reference)
> (value_namespace_elt, value_maybe_namespace_elt): Make "name"
> const.
> * value.h (value_aggregate_elt): Update.
Any reason for delaying the push on these types of patches?
I think constifications are geneally a good thing and that
there is no real incentive into holding them before pushing...
Thanks!
> ---
> gdb/ChangeLog | 7 +++++++
> gdb/valops.c | 14 +++++++-------
> gdb/value.h | 2 +-
> 3 files changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/gdb/valops.c b/gdb/valops.c
> index cf195a3..a10dbd6 100644
> --- a/gdb/valops.c
> +++ b/gdb/valops.c
> @@ -83,15 +83,15 @@ oload_classification classify_oload_match (struct badness_vector *,
>
> static struct value *value_struct_elt_for_reference (struct type *,
> int, struct type *,
> - char *,
> + const char *,
> struct type *,
> int, enum noside);
>
> static struct value *value_namespace_elt (const struct type *,
> - char *, int , enum noside);
> + const char *, int , enum noside);
>
> static struct value *value_maybe_namespace_elt (const struct type *,
> - char *, int,
> + const char *, int,
> enum noside);
>
> static CORE_ADDR allocate_space_in_inferior (int);
> @@ -3014,7 +3014,7 @@ destructor_name_p (const char *name, struct type *type)
> the comment before value_struct_elt_for_reference. */
>
> struct value *
> -value_aggregate_elt (struct type *curtype, char *name,
> +value_aggregate_elt (struct type *curtype, const char *name,
> struct type *expect_type, int want_address,
> enum noside noside)
> {
> @@ -3095,7 +3095,7 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial)
>
> static struct value *
> value_struct_elt_for_reference (struct type *domain, int offset,
> - struct type *curtype, char *name,
> + struct type *curtype, const char *name,
> struct type *intype,
> int want_address,
> enum noside noside)
> @@ -3324,7 +3324,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
>
> static struct value *
> value_namespace_elt (const struct type *curtype,
> - char *name, int want_address,
> + const char *name, int want_address,
> enum noside noside)
> {
> struct value *retval = value_maybe_namespace_elt (curtype, name,
> @@ -3346,7 +3346,7 @@ value_namespace_elt (const struct type *curtype,
>
> static struct value *
> value_maybe_namespace_elt (const struct type *curtype,
> - char *name, int want_address,
> + const char *name, int want_address,
> enum noside noside)
> {
> const char *namespace_name = TYPE_TAG_NAME (curtype);
> diff --git a/gdb/value.h b/gdb/value.h
> index f846669..9425a0e 100644
> --- a/gdb/value.h
> +++ b/gdb/value.h
> @@ -676,7 +676,7 @@ extern struct value *value_struct_elt_bitpos (struct value **argp,
> const char *err);
>
> extern struct value *value_aggregate_elt (struct type *curtype,
> - char *name,
> + const char *name,
> struct type *expect_type,
> int want_address,
> enum noside noside);
> --
> 1.8.5.3
--
Joel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] constify value_aggregate_elt
2014-03-28 13:20 ` Joel Brobecker
@ 2014-03-31 17:26 ` Tom Tromey
0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2014-03-31 17:26 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
>> * valops.c (value_aggregate_elt, value_struct_elt_for_reference)
>> (value_namespace_elt, value_maybe_namespace_elt): Make "name"
>> const.
>> * value.h (value_aggregate_elt): Update.
Joel> Any reason for delaying the push on these types of patches?
A while ago I was asked not to commit things without a waiting period.
So I wait at least a week unless I think it is truly obvious and
controversy-free; or if someone asks for the patch earlier.
My belief is that constification has not been without its battles, hence
the wait.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] constify value_aggregate_elt
2014-03-27 20:11 [PATCH] constify value_aggregate_elt Tom Tromey
2014-03-28 13:20 ` Joel Brobecker
@ 2014-04-14 18:07 ` Tom Tromey
1 sibling, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2014-04-14 18:07 UTC (permalink / raw)
To: gdb-patches
Tom> 2014-03-27 Tom Tromey <tromey@redhat.com>
Tom> * valops.c (value_aggregate_elt, value_struct_elt_for_reference)
Tom> (value_namespace_elt, value_maybe_namespace_elt): Make "name"
Tom> const.
Tom> * value.h (value_aggregate_elt): Update.
I'm checking this in now.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-04-14 18:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-27 20:11 [PATCH] constify value_aggregate_elt Tom Tromey
2014-03-28 13:20 ` Joel Brobecker
2014-03-31 17:26 ` Tom Tromey
2014-04-14 18:07 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).