aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-09-14 11:08:00 -0400
committerSimon Marchi <simon.marchi@efficios.com>2020-09-14 11:08:00 -0400
commit27e69b7aedcfee8af8fc6ee4f2e99aca2d41daca (patch)
treed092d44a3e9cba662112047179bb295e5c5b3154 /gdb
parentd21839680655c071a811de1d7b41f8d7de4fc462 (diff)
downloadgdb-27e69b7aedcfee8af8fc6ee4f2e99aca2d41daca.zip
gdb-27e69b7aedcfee8af8fc6ee4f2e99aca2d41daca.tar.gz
gdb-27e69b7aedcfee8af8fc6ee4f2e99aca2d41daca.tar.bz2
gdb: add type::is_prototyped / type::set_is_prototyped
Add the `is_prototyped` and `set_is_prototyped` methods on `struct type`, in order to remove the `TYPE_PROTOTYPED` macro. In this patch, the macro is changed to use the getter, so all the call sites of the macro that are used as a setter are changed to use the setter method directly. The next patch will remove the macro completely. gdb/ChangeLog: * gdbtypes.h (struct type) <is_prototyped, set_is_prototyped>: New methods. (TYPE_PROTOTYPED): Use type::is_prototyped, change all write call sites to use type::set_is_prototyped. Change-Id: I6ba285250fae413f7c1bf2ffcb5a2cedc8e743da
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/dwarf2/read.c2
-rw-r--r--gdb/eval.c2
-rw-r--r--gdb/gdbtypes.c4
-rw-r--r--gdb/gdbtypes.h14
-rw-r--r--gdb/mdebugread.c2
-rw-r--r--gdb/stabsread.c6
7 files changed, 27 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 376bb9d..05cb60a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
+ * gdbtypes.h (struct type) <is_prototyped, set_is_prototyped>:
+ New methods.
+ (TYPE_PROTOTYPED): Use type::is_prototyped, change all write
+ call sites to use type::set_is_prototyped.
+
+2020-09-14 Simon Marchi <simon.marchi@efficios.com>
+
* gdbtypes.h (TYPE_TARGET_STUB): Remove, replace all
uses with type::target_is_stub.
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 5f02acc..f4f3a02 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -17665,7 +17665,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
ftype = lookup_function_type (type);
if (prototyped_function_p (die, cu))
- TYPE_PROTOTYPED (ftype) = 1;
+ ftype->set_is_prototyped (true);
/* Store the calling convention in the type if it's available in
the subroutine die. Otherwise set the calling convention to
diff --git a/gdb/eval.c b/gdb/eval.c
index 3587dfe..7f9515b 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -673,7 +673,7 @@ fake_method::fake_method (type_instance_flags flags,
--num_types;
/* Caller should have ensured this. */
gdb_assert (num_types == 0);
- TYPE_PROTOTYPED (type) = 1;
+ type->set_is_prototyped (true);
}
}
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 91f3ed8..0753630 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -560,10 +560,10 @@ lookup_function_type_with_arguments (struct type *type,
--nparams;
/* Caller should have ensured this. */
gdb_assert (nparams == 0);
- TYPE_PROTOTYPED (fn) = 1;
+ fn->set_is_prototyped (true);
}
else
- TYPE_PROTOTYPED (fn) = 1;
+ fn->set_is_prototyped (true);
}
fn->set_num_fields (nparams);
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index e03564c..b41e91f 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -221,7 +221,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
to coerce the args, or to just do the standard conversions. This
is used with a short field. */
-#define TYPE_PROTOTYPED(t) (TYPE_MAIN_TYPE (t)->flag_prototyped)
+#define TYPE_PROTOTYPED(t) ((t)->is_prototyped ())
/* * FIXME drow/2002-06-03: Only used for methods, but applies as well
to functions. */
@@ -834,7 +834,7 @@ struct main_type
unsigned int m_flag_nosign : 1;
unsigned int m_flag_stub : 1;
unsigned int m_flag_target_stub : 1;
- unsigned int flag_prototyped : 1;
+ unsigned int m_flag_prototyped : 1;
unsigned int flag_varargs : 1;
unsigned int flag_vector : 1;
unsigned int flag_stub_supported : 1;
@@ -1100,6 +1100,16 @@ struct type
this->main_type->m_flag_target_stub = target_is_stub;
}
+ bool is_prototyped () const
+ {
+ return this->main_type->m_flag_prototyped;
+ }
+
+ void set_is_prototyped (bool is_prototyped)
+ {
+ this->main_type->m_flag_prototyped = is_prototyped;
+ }
+
/* * Return the dynamic property of the requested KIND from this type's
list of dynamic properties. */
dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index f68f4ef..480b67b 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -786,7 +786,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
/* All functions in C++ have prototypes. For C we don't have enough
information in the debug info. */
if (s->language () == language_cplus)
- TYPE_PROTOTYPED (SYMBOL_TYPE (s)) = 1;
+ SYMBOL_TYPE (s)->set_is_prototyped (true);
/* Create and enter a new lexical context. */
b = new_block (FUNCTION_BLOCK, s->language ());
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 752612f..2f9458c 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -958,7 +958,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
than the "declared-as" type for unprototyped functions, so
we treat all functions as if they were prototyped. This is used
primarily for promotion when calling the function from GDB. */
- TYPE_PROTOTYPED (SYMBOL_TYPE (sym)) = 1;
+ SYMBOL_TYPE (sym)->set_is_prototyped (true);
/* fall into process_prototype_types. */
@@ -1005,7 +1005,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
TYPE_FIELD_ARTIFICIAL (ftype, nparams++) = 0;
}
ftype->set_num_fields (nparams);
- TYPE_PROTOTYPED (ftype) = 1;
+ ftype->set_is_prototyped (true);
}
break;
@@ -1813,7 +1813,7 @@ again:
func_type->field (i).set_type (t->type);
}
func_type->set_num_fields (num_args);
- TYPE_PROTOTYPED (func_type) = 1;
+ func_type->set_is_prototyped (true);
type = func_type;
break;