* [PATCH 3/3] remove TYPE_CODE_BITSTRING
2012-08-10 9:13 [RFC 0/3] Remove unused operators OP_BITSTRING TERNOP_SLICE_COUNT and TYPE_CODE_BITSTRING Yao Qi
2012-08-10 9:13 ` [PATCH 2/3] Remove TERNOP_SLICE_COUNT Yao Qi
@ 2012-08-10 9:13 ` Yao Qi
2012-08-10 16:19 ` Tom Tromey
2012-08-10 9:13 ` [PATCH 1/3] Remove OP_BITSTRING Yao Qi
2 siblings, 1 reply; 9+ messages in thread
From: Yao Qi @ 2012-08-10 9:13 UTC (permalink / raw)
To: gdb-patches
gdb:
2012-08-10 Yao Qi <yao@codesourcery.com>
* gdbtypes.h (enum type_code): Remove TYPE_CODE_BITSTRING.
* arm-tdep.c (arm_type_align): Remove code handling TYPE_CODE_BITSTRING.
* c-typeprint.c (c_type_print_varspec_prefix): Likewise.
(c_type_print_varspec_suffix): Likewise.
* eval.c (evaluate_subexp_standard): Likewise.
* f-typeprint.c (f_type_print_varspec_prefix): Likewise.
(f_type_print_varspec_suffix): Likewise.
* gdbtypes.c (is_scalar_type): Likewise.
(recursive_dump_type): Likewise.
* infcall.c (value_arg_coerce): Likewise.
* m2-valprint.c (m2_val_print): Likewise.
* p-typeprint.c (pascal_type_print_varspec_prefix): Likewise.
(pascal_type_print_varspec_suffix): Likewise.
(pascal_type_print_base): Likewise.
* p-valprint.c (pascal_val_print): Likewise.
(pascal_val_print): Likewise.
* python/py-type.c (pyty_codes): Remove ENTRY (TYPE_CODE_BITSTRING).
* valarith.c (value_bitstring_subscript): Remove.
(value_concat): Remove code handling TYPE_CODE_BITSTRING.
* valops.c (value_slice): Likewise.
* valprint.c (scalar_type_p): Likewise.
* stabsread.c (read_type): Don't set TYPE_CODE (type) to
TYPE_CODE_BITSTRING.
---
gdb/arm-tdep.c | 1 -
gdb/c-typeprint.c | 2 -
gdb/eval.c | 6 -----
gdb/f-typeprint.c | 2 -
gdb/gdbtypes.c | 4 ---
gdb/gdbtypes.h | 4 ---
gdb/infcall.c | 1 -
gdb/m2-valprint.c | 16 ++-----------
gdb/p-typeprint.c | 6 -----
gdb/p-valprint.c | 16 ++-----------
gdb/python/py-type.c | 1 -
gdb/stabsread.c | 4 +--
gdb/valarith.c | 55 +++++--------------------------------------------
gdb/valops.c | 34 +------------------------------
gdb/valprint.c | 1 -
15 files changed, 14 insertions(+), 139 deletions(-)
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 568ace5..063c1db 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -3285,7 +3285,6 @@ arm_type_align (struct type *t)
case TYPE_CODE_FLT:
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_REF:
case TYPE_CODE_CHAR:
case TYPE_CODE_BOOL:
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index a5892b5..29b27e9 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -322,7 +322,6 @@ c_type_print_varspec_prefix (struct type *type,
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_NAMESPACE:
case TYPE_CODE_DECFLOAT:
@@ -679,7 +678,6 @@ c_type_print_varspec_suffix (struct type *type,
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_NAMESPACE:
case TYPE_CODE_DECFLOAT:
diff --git a/gdb/eval.c b/gdb/eval.c
index c0d9354..9fe7e38 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -2323,12 +2323,6 @@ evaluate_subexp_standard (struct type *expect_type,
arg1 = value_subscript (arg1, value_as_long (arg2));
break;
- case TYPE_CODE_BITSTRING:
- type = language_bool_type (exp->language_defn, exp->gdbarch);
- arg1 = value_bitstring_subscript (type, arg1,
- value_as_long (arg2));
- break;
-
default:
if (TYPE_NAME (type))
error (_("cannot subscript something of type `%s'"),
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index a95ef84..c59e639 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -131,7 +131,6 @@ f_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_METHOD:
case TYPE_CODE_REF:
case TYPE_CODE_COMPLEX:
@@ -230,7 +229,6 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_METHOD:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_TYPEDEF:
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 0ea4df1..3fa8b30 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -2036,7 +2036,6 @@ is_scalar_type (struct type *type)
case TYPE_CODE_UNION:
case TYPE_CODE_SET:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
return 0;
default:
return 1;
@@ -3075,9 +3074,6 @@ recursive_dump_type (struct type *type, int spaces)
case TYPE_CODE_STRING:
printf_filtered ("(TYPE_CODE_STRING)");
break;
- case TYPE_CODE_BITSTRING:
- printf_filtered ("(TYPE_CODE_BITSTRING)");
- break;
case TYPE_CODE_ERROR:
printf_filtered ("(TYPE_CODE_ERROR)");
break;
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 17bfbc5..253ac42 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -109,10 +109,6 @@ enum type_code
a new type code. */
TYPE_CODE_STRING,
- /* String of bits; like TYPE_CODE_SET but prints differently (at
- least for (the deleted) CHILL). */
- TYPE_CODE_BITSTRING,
-
/* Unknown type. The length field is valid if we were able to
deduce that much about the type, or 0 if we don't even know that. */
TYPE_CODE_ERROR,
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 1b2c3d6..1b92748 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -213,7 +213,6 @@ value_arg_coerce (struct gdbarch *gdbarch, struct value *arg,
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_ERROR:
case TYPE_CODE_MEMBERPTR:
case TYPE_CODE_METHODPTR:
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index e92679f..3d3127e 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -409,7 +409,6 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
options, NULL, 0);
break;
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_SET:
elttype = TYPE_INDEX_TYPE (type);
CHECK_TYPEDEF (elttype);
@@ -424,13 +423,9 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
struct type *range = elttype;
LONGEST low_bound, high_bound;
int i;
- int is_bitstring = TYPE_CODE (type) == TYPE_CODE_BITSTRING;
int need_comma = 0;
- if (is_bitstring)
- fputs_filtered ("B'", stream);
- else
- fputs_filtered ("{", stream);
+ fputs_filtered ("{", stream);
i = get_discrete_bounds (range, &low_bound, &high_bound);
maybe_bad_bstring:
@@ -450,9 +445,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
i = element;
goto maybe_bad_bstring;
}
- if (is_bitstring)
- fprintf_filtered (stream, "%d", element);
- else if (element)
+ if (element)
{
if (need_comma)
fputs_filtered (", ", stream);
@@ -476,10 +469,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
}
}
done:
- if (is_bitstring)
- fputs_filtered ("'", stream);
- else
- fputs_filtered ("}", stream);
+ fputs_filtered ("}", stream);
}
break;
diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c
index a00f5b3..fceb97a 100644
--- a/gdb/p-typeprint.c
+++ b/gdb/p-typeprint.c
@@ -289,7 +289,6 @@ pascal_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_TYPEDEF:
/* These types need no prefix. They are listed here so that
@@ -408,7 +407,6 @@ pascal_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_TYPEDEF:
/* These types do not need a suffix. They are listed so that
@@ -792,10 +790,6 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
show - 1, level);
break;
- case TYPE_CODE_BITSTRING:
- fputs_filtered ("BitString", stream);
- break;
-
case TYPE_CODE_STRING:
fputs_filtered ("String", stream);
break;
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 9f44617..b2287f2 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -334,7 +334,6 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
}
break;
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_SET:
elttype = TYPE_INDEX_TYPE (type);
CHECK_TYPEDEF (elttype);
@@ -349,13 +348,9 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
struct type *range = elttype;
LONGEST low_bound, high_bound;
int i;
- int is_bitstring = TYPE_CODE (type) == TYPE_CODE_BITSTRING;
int need_comma = 0;
- if (is_bitstring)
- fputs_filtered ("B'", stream);
- else
- fputs_filtered ("[", stream);
+ fputs_filtered ("[", stream);
i = get_discrete_bounds (range, &low_bound, &high_bound);
if (low_bound == 0 && high_bound == -1 && TYPE_LENGTH (type) > 0)
@@ -383,9 +378,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
i = element;
goto maybe_bad_bstring;
}
- if (is_bitstring)
- fprintf_filtered (stream, "%d", element);
- else if (element)
+ if (element)
{
if (need_comma)
fputs_filtered (", ", stream);
@@ -409,10 +402,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
}
}
done:
- if (is_bitstring)
- fputs_filtered ("'", stream);
- else
- fputs_filtered ("]", stream);
+ fputs_filtered ("]", stream);
}
break;
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index 98030a6..dc7af9f 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -98,7 +98,6 @@ static struct pyty_code pyty_codes[] =
ENTRY (TYPE_CODE_SET),
ENTRY (TYPE_CODE_RANGE),
ENTRY (TYPE_CODE_STRING),
- ENTRY (TYPE_CODE_BITSTRING),
ENTRY (TYPE_CODE_ERROR),
ENTRY (TYPE_CODE_METHOD),
ENTRY (TYPE_CODE_METHODPTR),
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index eb09c9d..1c288ee 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -2024,11 +2024,9 @@ again:
make_vector_type (type);
break;
- case 'S': /* Set or bitstring type */
+ case 'S': /* Set type */
type1 = read_type (pp, objfile);
type = create_set_type ((struct type *) NULL, type1);
- if (is_string)
- TYPE_CODE (type) = TYPE_CODE_BITSTRING;
if (typenums[0] != -1)
*dbx_lookup_type (typenums, objfile) = type;
break;
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 96d5411..d0f31c4 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -221,46 +221,6 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound)
return v;
}
-/* Return the value of BITSTRING[IDX] as (boolean) type TYPE. */
-
-struct value *
-value_bitstring_subscript (struct type *type,
- struct value *bitstring, LONGEST index)
-{
-
- struct type *bitstring_type, *range_type;
- struct value *v;
- int offset, byte, bit_index;
- LONGEST lowerbound, upperbound;
-
- bitstring_type = check_typedef (value_type (bitstring));
- gdb_assert (TYPE_CODE (bitstring_type) == TYPE_CODE_BITSTRING);
-
- range_type = TYPE_INDEX_TYPE (bitstring_type);
- get_discrete_bounds (range_type, &lowerbound, &upperbound);
- if (index < lowerbound || index > upperbound)
- error (_("bitstring index out of range"));
-
- index -= lowerbound;
- offset = index / TARGET_CHAR_BIT;
- byte = *((char *) value_contents (bitstring) + offset);
-
- bit_index = index % TARGET_CHAR_BIT;
- byte >>= (gdbarch_bits_big_endian (get_type_arch (bitstring_type)) ?
- TARGET_CHAR_BIT - 1 - bit_index : bit_index);
-
- v = value_from_longest (type, byte & 1);
-
- set_value_bitpos (v, bit_index);
- set_value_bitsize (v, 1);
- set_value_component_location (v, bitstring);
- VALUE_FRAME_ID (v) = VALUE_FRAME_ID (bitstring);
-
- set_value_offset (v, offset + value_offset (bitstring));
-
- return v;
-}
-
\f
/* Check to see if either argument is a structure, or a reference to
one. This is called so we know whether to go ahead with the normal
@@ -735,10 +695,9 @@ value_concat (struct value *arg1, struct value *arg2)
}
outval = value_string (ptr, count * inval2len, char_type);
}
- else if (TYPE_CODE (type2) == TYPE_CODE_BITSTRING
- || TYPE_CODE (type2) == TYPE_CODE_BOOL)
+ else if (TYPE_CODE (type2) == TYPE_CODE_BOOL)
{
- error (_("unimplemented support for bitstring/boolean repeats"));
+ error (_("unimplemented support for boolean repeats"));
}
else
{
@@ -780,17 +739,15 @@ value_concat (struct value *arg1, struct value *arg2)
}
outval = value_string (ptr, inval1len + inval2len, char_type);
}
- else if (TYPE_CODE (type1) == TYPE_CODE_BITSTRING
- || TYPE_CODE (type1) == TYPE_CODE_BOOL)
+ else if (TYPE_CODE (type1) == TYPE_CODE_BOOL)
{
/* We have two bitstrings to concatenate. */
- if (TYPE_CODE (type2) != TYPE_CODE_BITSTRING
- && TYPE_CODE (type2) != TYPE_CODE_BOOL)
+ if (TYPE_CODE (type2) != TYPE_CODE_BOOL)
{
- error (_("Bitstrings or booleans can only be concatenated "
+ error (_("Booleans can only be concatenated "
"with other bitstrings or booleans."));
}
- error (_("unimplemented support for bitstring/boolean concatenation."));
+ error (_("unimplemented support for boolean concatenation."));
}
else
{
diff --git a/gdb/valops.c b/gdb/valops.c
index 8167cd4..17696ee 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -3744,8 +3744,7 @@ value_slice (struct value *array, int lowbound, int length)
array_type = check_typedef (value_type (array));
if (TYPE_CODE (array_type) != TYPE_CODE_ARRAY
- && TYPE_CODE (array_type) != TYPE_CODE_STRING
- && TYPE_CODE (array_type) != TYPE_CODE_BITSTRING)
+ && TYPE_CODE (array_type) != TYPE_CODE_STRING)
error (_("cannot take slice of non-array"));
range_type = TYPE_INDEX_TYPE (array_type);
@@ -3762,38 +3761,7 @@ value_slice (struct value *array, int lowbound, int length)
TYPE_TARGET_TYPE (range_type),
lowbound,
lowbound + length - 1);
- if (TYPE_CODE (array_type) == TYPE_CODE_BITSTRING)
- {
- int i;
-
- slice_type = create_set_type ((struct type *) NULL,
- slice_range_type);
- TYPE_CODE (slice_type) = TYPE_CODE_BITSTRING;
- slice = value_zero (slice_type, not_lval);
- for (i = 0; i < length; i++)
- {
- int element = value_bit_index (array_type,
- value_contents (array),
- lowbound + i);
-
- if (element < 0)
- error (_("internal error accessing bitstring"));
- else if (element > 0)
- {
- int j = i % TARGET_CHAR_BIT;
-
- if (gdbarch_bits_big_endian (get_type_arch (array_type)))
- j = TARGET_CHAR_BIT - 1 - j;
- value_contents_raw (slice)[i / TARGET_CHAR_BIT] |= (1 << j);
- }
- }
- /* We should set the address, bitssize, and bitspos, so the
- slice can be used on the LHS, but that may require extensions
- to value_assign. For now, just leave as a non_lval.
- FIXME. */
- }
- else
{
struct type *element_type = TYPE_TARGET_TYPE (array_type);
LONGEST offset =
diff --git a/gdb/valprint.c b/gdb/valprint.c
index fc5942d..6e651f6 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -252,7 +252,6 @@ scalar_type_p (struct type *type)
case TYPE_CODE_UNION:
case TYPE_CODE_SET:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
return 0;
default:
return 1;
--
1.7.7.6
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] Remove OP_BITSTRING
2012-08-10 9:13 [RFC 0/3] Remove unused operators OP_BITSTRING TERNOP_SLICE_COUNT and TYPE_CODE_BITSTRING Yao Qi
2012-08-10 9:13 ` [PATCH 2/3] Remove TERNOP_SLICE_COUNT Yao Qi
2012-08-10 9:13 ` [PATCH 3/3] remove TYPE_CODE_BITSTRING Yao Qi
@ 2012-08-10 9:13 ` Yao Qi
2012-08-10 16:16 ` Tom Tromey
2 siblings, 1 reply; 9+ messages in thread
From: Yao Qi @ 2012-08-10 9:13 UTC (permalink / raw)
To: gdb-patches
gdb:
2012-08-10 Yao Qi <yao@codesourcery.com>
* std-operator.def: Remove OP_BITSTRING.
* breakpoint.c (watchpoint_exp_is_const): Update.
* eval.c (evaluate_subexp_standard): Remove handling to
OP_BITSTRING.
* expprint.c (print_subexp_standard): Likewise.
(dump_subexp_body_standard): Likewise.
* parse.c (operator_length_standard): Likewise.
* valops.c (value_bitstring): Remove.
* value.h: Remove the declaration of 'value_bitstring'.
---
gdb/breakpoint.c | 1 -
gdb/eval.c | 10 ----------
gdb/expprint.c | 8 --------
gdb/parse.c | 6 ------
gdb/std-operator.def | 6 ------
gdb/valops.c | 13 -------------
gdb/value.h | 2 --
7 files changed, 0 insertions(+), 46 deletions(-)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index e38c54a..1ba923f 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -10168,7 +10168,6 @@ watchpoint_exp_is_const (const struct expression *exp)
case OP_LAST:
case OP_COMPLEX:
case OP_STRING:
- case OP_BITSTRING:
case OP_ARRAY:
case OP_TYPE:
case OP_TYPEOF:
diff --git a/gdb/eval.c b/gdb/eval.c
index 4295845..9bf5401 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -970,16 +970,6 @@ evaluate_subexp_standard (struct type *expect_type,
}
return value_nsstring (exp->gdbarch, &exp->elts[pc + 2].string, tem + 1);
- case OP_BITSTRING:
- tem = longest_to_int (exp->elts[pc + 1].longconst);
- (*pos)
- += 3 + BYTES_TO_EXP_ELEM ((tem + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT);
- if (noside == EVAL_SKIP)
- goto nosideret;
- return value_bitstring (&exp->elts[pc + 2].string, tem,
- builtin_type (exp->gdbarch)->builtin_int);
- break;
-
case OP_ARRAY:
(*pos) += 3;
tem2 = longest_to_int (exp->elts[pc + 1].longconst);
diff --git a/gdb/expprint.c b/gdb/expprint.c
index 779368b..c74c564 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -210,13 +210,6 @@ print_subexp_standard (struct expression *exp, int *pos,
}
return;
- case OP_BITSTRING:
- nargs = longest_to_int (exp->elts[pc + 1].longconst);
- (*pos)
- += 3 + BYTES_TO_EXP_ELEM ((nargs + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT);
- fprintf_unfiltered (stream, "B'<unimplemented>'");
- return;
-
case OP_OBJC_NSSTRING: /* Objective-C Foundation Class
NSString constant. */
{
@@ -1037,7 +1030,6 @@ dump_subexp_body_standard (struct expression *exp,
case OP_F77_UNDETERMINED_ARGLIST:
case OP_COMPLEX:
case OP_STRING:
- case OP_BITSTRING:
case OP_BOOL:
case OP_M2_STRING:
case OP_THIS:
diff --git a/gdb/parse.c b/gdb/parse.c
index d1ed4e8..d418aef 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -967,12 +967,6 @@ operator_length_standard (const struct expression *expr, int endpos,
oplen = 4 + BYTES_TO_EXP_ELEM (oplen + 1);
break;
- case OP_BITSTRING:
- oplen = longest_to_int (expr->elts[endpos - 2].longconst);
- oplen = (oplen + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
- oplen = 4 + BYTES_TO_EXP_ELEM (oplen);
- break;
-
case OP_ARRAY:
oplen = 4;
args = longest_to_int (expr->elts[endpos - 2].longconst);
diff --git a/gdb/std-operator.def b/gdb/std-operator.def
index b013687..173dc1d 100644
--- a/gdb/std-operator.def
+++ b/gdb/std-operator.def
@@ -194,12 +194,6 @@ OP (OP_COMPLEX)
is executed. */
OP (OP_STRING)
-/* OP_BITSTRING represents a packed bitstring constant.
- Its format is the same as that of a STRUCTOP, but the bitstring
- data is just made into a bitstring constant when the operation
- is executed. */
-OP (OP_BITSTRING)
-
/* OP_ARRAY creates an array constant out of the following subexpressions.
It is followed by two exp_elements, the first containing an integer
that is the lower bound of the array and the second containing another
diff --git a/gdb/valops.c b/gdb/valops.c
index 934f381..8167cd4 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1875,19 +1875,6 @@ value_string (char *ptr, int len, struct type *char_type)
return val;
}
-struct value *
-value_bitstring (char *ptr, int len, struct type *index_type)
-{
- struct value *val;
- struct type *domain_type
- = create_range_type (NULL, index_type, 0, len - 1);
- struct type *type = create_set_type (NULL, domain_type);
-
- TYPE_CODE (type) = TYPE_CODE_BITSTRING;
- val = allocate_value (type);
- memcpy (value_contents_raw (val), ptr, TYPE_LENGTH (type));
- return val;
-}
\f
/* See if we can pass arguments in T2 to a function which takes
arguments of types T1. T1 is a list of NARGS arguments, and T2 is
diff --git a/gdb/value.h b/gdb/value.h
index d8b157f..cfdf085 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -591,8 +591,6 @@ extern struct value *value_cstring (char *ptr, int len,
struct type *char_type);
extern struct value *value_string (char *ptr, int len,
struct type *char_type);
-extern struct value *value_bitstring (char *ptr, int len,
- struct type *index_type);
extern struct value *value_array (int lowbound, int highbound,
struct value **elemvec);
--
1.7.7.6
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/3] Remove TERNOP_SLICE_COUNT.
2012-08-10 9:13 [RFC 0/3] Remove unused operators OP_BITSTRING TERNOP_SLICE_COUNT and TYPE_CODE_BITSTRING Yao Qi
@ 2012-08-10 9:13 ` Yao Qi
2012-08-10 16:16 ` Tom Tromey
2012-08-10 9:13 ` [PATCH 3/3] remove TYPE_CODE_BITSTRING Yao Qi
2012-08-10 9:13 ` [PATCH 1/3] Remove OP_BITSTRING Yao Qi
2 siblings, 1 reply; 9+ messages in thread
From: Yao Qi @ 2012-08-10 9:13 UTC (permalink / raw)
To: gdb-patches
gdb:
2012-08-10 Yao Qi <yao@codesourcery.com>
* std-operator.def: Remove TERNOP_SLICE_COUNT.
* breakpoint.c (watchpoint_exp_is_const): Remove handling to
TERNOP_SLICE_COUNT.
* eval.c (evaluate_subexp_standard): Likewise.
* expprint.c (print_subexp_standard): Likewise.
(dump_subexp_body_standard): Likewise.
* parse.c (operator_length_standard): Likewise.
---
gdb/breakpoint.c | 1 -
gdb/eval.c | 11 -----------
gdb/expprint.c | 2 --
gdb/parse.c | 1 -
gdb/std-operator.def | 5 -----
5 files changed, 0 insertions(+), 20 deletions(-)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 1ba923f..7ea5ba6 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -10160,7 +10160,6 @@ watchpoint_exp_is_const (const struct expression *exp)
case BINOP_RANGE:
case TERNOP_COND:
case TERNOP_SLICE:
- case TERNOP_SLICE_COUNT:
case OP_LONG:
case OP_DOUBLE:
diff --git a/gdb/eval.c b/gdb/eval.c
index 9bf5401..c0d9354 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1140,17 +1140,6 @@ evaluate_subexp_standard (struct type *expect_type,
return value_slice (array, lowbound, upper - lowbound + 1);
}
- case TERNOP_SLICE_COUNT:
- {
- struct value *array = evaluate_subexp (NULL_TYPE, exp, pos, noside);
- int lowbound
- = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
- int length
- = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
-
- return value_slice (array, lowbound, length);
- }
-
case TERNOP_COND:
/* Skip third and second args to evaluate the first one. */
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
diff --git a/gdb/expprint.c b/gdb/expprint.c
index c74c564..baaa08a 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -360,7 +360,6 @@ print_subexp_standard (struct expression *exp, int *pos,
return;
case TERNOP_SLICE:
- case TERNOP_SLICE_COUNT:
print_subexp (exp, pos, stream, PREC_SUFFIX);
fputs_filtered ("(", stream);
print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
@@ -787,7 +786,6 @@ dump_subexp_body_standard (struct expression *exp,
{
case TERNOP_COND:
case TERNOP_SLICE:
- case TERNOP_SLICE_COUNT:
elt = dump_subexp (exp, stream, elt);
/* FALL THROUGH */
case BINOP_ADD:
diff --git a/gdb/parse.c b/gdb/parse.c
index d418aef..3ec1e25 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -976,7 +976,6 @@ operator_length_standard (const struct expression *expr, int endpos,
case TERNOP_COND:
case TERNOP_SLICE:
- case TERNOP_SLICE_COUNT:
args = 3;
break;
diff --git a/gdb/std-operator.def b/gdb/std-operator.def
index 173dc1d..dcba39f 100644
--- a/gdb/std-operator.def
+++ b/gdb/std-operator.def
@@ -105,11 +105,6 @@ OP (TERNOP_COND) /* ?: */
OP1(OP2:OP3). Return elements OP2 through OP3 of OP1. */
OP (TERNOP_SLICE)
-/* A sub-string/sub-array. (The deleted) Chill syntax: OP1(OP2 UP
- OP3). Return OP3 elements of OP1, starting with element
- OP2. */
-OP (TERNOP_SLICE_COUNT)
-
/* Multidimensional subscript operator, such as Modula-2 x[a,b,...].
The dimensionality is encoded in the operator, like the number of
function arguments in OP_FUNCALL, I.E. <OP><dimension><OP>.
--
1.7.7.6
^ permalink raw reply [flat|nested] 9+ messages in thread
* [RFC 0/3] Remove unused operators OP_BITSTRING TERNOP_SLICE_COUNT and TYPE_CODE_BITSTRING
@ 2012-08-10 9:13 Yao Qi
2012-08-10 9:13 ` [PATCH 2/3] Remove TERNOP_SLICE_COUNT Yao Qi
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Yao Qi @ 2012-08-10 9:13 UTC (permalink / raw)
To: gdb-patches
Hi,
This patch set is a follow-up to my prosal here,
Remove OP_LABELED TERNOP_SLICE_COUNT and OP_BITSTRING?
http://sourceware.org/ml/gdb/2012-08/msg00018.html
However, OP_LABELED is not removed in this patch set, because it is not
obviously correct to do so, and more thoughts are needed. Removal of
TYPE_CODE_BITSTRING is added in this set.
I don't put much words in each patch, because each of them just simply
removes unused bits. Regression tested on x86_64-unknow-linux.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] Remove TERNOP_SLICE_COUNT.
2012-08-10 9:13 ` [PATCH 2/3] Remove TERNOP_SLICE_COUNT Yao Qi
@ 2012-08-10 16:16 ` Tom Tromey
0 siblings, 0 replies; 9+ messages in thread
From: Tom Tromey @ 2012-08-10 16:16 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:
Yao> 2012-08-10 Yao Qi <yao@codesourcery.com>
Yao> * std-operator.def: Remove TERNOP_SLICE_COUNT.
Yao> * breakpoint.c (watchpoint_exp_is_const): Remove handling to
Yao> TERNOP_SLICE_COUNT.
Yao> * eval.c (evaluate_subexp_standard): Likewise.
Yao> * expprint.c (print_subexp_standard): Likewise.
Yao> (dump_subexp_body_standard): Likewise.
Yao> * parse.c (operator_length_standard): Likewise.
Ok.
Tom
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] Remove OP_BITSTRING
2012-08-10 9:13 ` [PATCH 1/3] Remove OP_BITSTRING Yao Qi
@ 2012-08-10 16:16 ` Tom Tromey
0 siblings, 0 replies; 9+ messages in thread
From: Tom Tromey @ 2012-08-10 16:16 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:
Yao> 2012-08-10 Yao Qi <yao@codesourcery.com>
Yao> * std-operator.def: Remove OP_BITSTRING.
Yao> * breakpoint.c (watchpoint_exp_is_const): Update.
Yao> * eval.c (evaluate_subexp_standard): Remove handling to
Yao> OP_BITSTRING.
Yao> * expprint.c (print_subexp_standard): Likewise.
Yao> (dump_subexp_body_standard): Likewise.
Yao> * parse.c (operator_length_standard): Likewise.
Yao> * valops.c (value_bitstring): Remove.
Yao> * value.h: Remove the declaration of 'value_bitstring'.
Ok.
Tom
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] remove TYPE_CODE_BITSTRING
2012-08-10 9:13 ` [PATCH 3/3] remove TYPE_CODE_BITSTRING Yao Qi
@ 2012-08-10 16:19 ` Tom Tromey
2012-08-13 1:13 ` Yao Qi
0 siblings, 1 reply; 9+ messages in thread
From: Tom Tromey @ 2012-08-10 16:19 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:
Yao> 2012-08-10 Yao Qi <yao@codesourcery.com>
Yao> * gdbtypes.h (enum type_code): Remove TYPE_CODE_BITSTRING.
This one needs a little tweak.
Yao> diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
Yao> index 98030a6..dc7af9f 100644
Yao> --- a/gdb/python/py-type.c
Yao> +++ b/gdb/python/py-type.c
Yao> @@ -98,7 +98,6 @@ static struct pyty_code pyty_codes[] =
Yao> ENTRY (TYPE_CODE_SET),
Yao> ENTRY (TYPE_CODE_RANGE),
Yao> ENTRY (TYPE_CODE_STRING),
Yao> - ENTRY (TYPE_CODE_BITSTRING),
This is actually Python API. Search for TYPE_CODE_BITSTRING in the
manual.
I think it is best to keep the name around, in case anything uses it.
But, we don't have to keep the same value. So I would suggest defining
to be -1 and then updating the manual to note that this code is
deprecated -- or even just undocumenting the constant.
The rest is ok though.
Tom
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] remove TYPE_CODE_BITSTRING
2012-08-10 16:19 ` Tom Tromey
@ 2012-08-13 1:13 ` Yao Qi
2012-08-15 19:39 ` Tom Tromey
0 siblings, 1 reply; 9+ messages in thread
From: Yao Qi @ 2012-08-13 1:13 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On 08/11/2012 12:19 AM, Tom Tromey wrote:
> Yao> 2012-08-10 Yao Qi<yao@codesourcery.com>
> Yao> * gdbtypes.h (enum type_code): Remove TYPE_CODE_BITSTRING.
>
> This one needs a little tweak.
>
> Yao> diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
> Yao> index 98030a6..dc7af9f 100644
> Yao> --- a/gdb/python/py-type.c
> Yao> +++ b/gdb/python/py-type.c
> Yao> @@ -98,7 +98,6 @@ static struct pyty_code pyty_codes[] =
> Yao> ENTRY (TYPE_CODE_SET),
> Yao> ENTRY (TYPE_CODE_RANGE),
> Yao> ENTRY (TYPE_CODE_STRING),
> Yao> - ENTRY (TYPE_CODE_BITSTRING),
>
> This is actually Python API. Search for TYPE_CODE_BITSTRING in the
> manual.
>
Oh, right.
> I think it is best to keep the name around, in case anything uses it.
> But, we don't have to keep the same value. So I would suggest defining
> to be -1 and then updating the manual to note that this code is
> deprecated -- or even just undocumenting the constant.
I'll define TYPE_CODE_BITSTRING -1 in 'enum type_code', and document
gdb.TYPE_CODE_BITSTRING is deprecated. Note that the following patch
moves ENTRY (TYPE_CODE_BITSTRING) to slot 0 in array 'pyty_codes', in
order to keep the order identical to 'enum type_code'.
--
Yao
gdb:
2012-08-13 Yao Qi <yao@codesourcery.com>
* gdbtypes.h (enum type_code): Define TYPE_CODE_BITSTRING -1.
* arm-tdep.c (arm_type_align): Remove code handling TYPE_CODE_BITSTRING.
* c-typeprint.c (c_type_print_varspec_prefix): Likewise.
(c_type_print_varspec_suffix): Likewise.
* eval.c (evaluate_subexp_standard): Likewise.
* f-typeprint.c (f_type_print_varspec_prefix): Likewise.
(f_type_print_varspec_suffix): Likewise.
* gdbtypes.c (is_scalar_type): Likewise.
(recursive_dump_type): Likewise.
* infcall.c (value_arg_coerce): Likewise.
* m2-valprint.c (m2_val_print): Likewise.
* p-typeprint.c (pascal_type_print_varspec_prefix): Likewise.
(pascal_type_print_varspec_suffix): Likewise.
(pascal_type_print_base): Likewise.
* p-valprint.c (pascal_val_print): Likewise.
(pascal_val_print): Likewise.
* valops.c (value_slice): Likewise.
* valprint.c (scalar_type_p): Likewise.
* valarith.c (value_bitstring_subscript): Remove.
(value_concat): Remove code handling TYPE_CODE_BITSTRING.
Remove comment on TYPE_CODE_BITSTRING.
* stabsread.c (read_type): Don't set TYPE_CODE (type) to
TYPE_CODE_BITSTRING.
* python/py-type.c (pyty_codes): Move ENTRY (TYPE_CODE_BITSTRING) to
slot 0.
gdb/doc:
2012-08-13 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (Types In Python): Mention gdb.TYPE_CODE_BITSTRING
is deprecated.
---
gdb/arm-tdep.c | 1 -
gdb/c-typeprint.c | 2 -
gdb/doc/gdb.texinfo | 2 +-
gdb/eval.c | 6 -----
gdb/f-typeprint.c | 2 -
gdb/gdbtypes.c | 4 ---
gdb/gdbtypes.h | 7 +----
gdb/infcall.c | 1 -
gdb/m2-valprint.c | 16 ++-----------
gdb/p-typeprint.c | 6 -----
gdb/p-valprint.c | 16 ++-----------
gdb/python/py-type.c | 2 +-
gdb/stabsread.c | 4 +--
gdb/valarith.c | 56 +++++--------------------------------------------
gdb/valops.c | 34 +-----------------------------
gdb/valprint.c | 1 -
16 files changed, 18 insertions(+), 142 deletions(-)
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 568ace5..063c1db 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -3285,7 +3285,6 @@ arm_type_align (struct type *t)
case TYPE_CODE_FLT:
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_REF:
case TYPE_CODE_CHAR:
case TYPE_CODE_BOOL:
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index a5892b5..29b27e9 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -322,7 +322,6 @@ c_type_print_varspec_prefix (struct type *type,
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_NAMESPACE:
case TYPE_CODE_DECFLOAT:
@@ -679,7 +678,6 @@ c_type_print_varspec_suffix (struct type *type,
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_NAMESPACE:
case TYPE_CODE_DECFLOAT:
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index a03532e..5a11c2e 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -23502,7 +23502,7 @@ language-defined string types; C strings are not represented this way.
@findex TYPE_CODE_BITSTRING
@findex gdb.TYPE_CODE_BITSTRING
@item gdb.TYPE_CODE_BITSTRING
-A string of bits.
+A string of bits. It is deprecated.
@findex TYPE_CODE_ERROR
@findex gdb.TYPE_CODE_ERROR
diff --git a/gdb/eval.c b/gdb/eval.c
index c0d9354..9fe7e38 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -2323,12 +2323,6 @@ evaluate_subexp_standard (struct type *expect_type,
arg1 = value_subscript (arg1, value_as_long (arg2));
break;
- case TYPE_CODE_BITSTRING:
- type = language_bool_type (exp->language_defn, exp->gdbarch);
- arg1 = value_bitstring_subscript (type, arg1,
- value_as_long (arg2));
- break;
-
default:
if (TYPE_NAME (type))
error (_("cannot subscript something of type `%s'"),
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index a95ef84..c59e639 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -131,7 +131,6 @@ f_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_METHOD:
case TYPE_CODE_REF:
case TYPE_CODE_COMPLEX:
@@ -230,7 +229,6 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_METHOD:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_TYPEDEF:
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 0ea4df1..3fa8b30 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -2036,7 +2036,6 @@ is_scalar_type (struct type *type)
case TYPE_CODE_UNION:
case TYPE_CODE_SET:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
return 0;
default:
return 1;
@@ -3075,9 +3074,6 @@ recursive_dump_type (struct type *type, int spaces)
case TYPE_CODE_STRING:
printf_filtered ("(TYPE_CODE_STRING)");
break;
- case TYPE_CODE_BITSTRING:
- printf_filtered ("(TYPE_CODE_BITSTRING)");
- break;
case TYPE_CODE_ERROR:
printf_filtered ("(TYPE_CODE_ERROR)");
break;
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 17bfbc5..afe0103 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -58,7 +58,8 @@ typedef struct
enum type_code
{
- TYPE_CODE_UNDEF, /* Not used; catches errors */
+ TYPE_CODE_BITSTRING = -1, /* Deprecated */
+ TYPE_CODE_UNDEF = 0, /* Not used; catches errors */
TYPE_CODE_PTR, /* Pointer type */
/* Array type with lower & upper bounds.
@@ -109,10 +110,6 @@ enum type_code
a new type code. */
TYPE_CODE_STRING,
- /* String of bits; like TYPE_CODE_SET but prints differently (at
- least for (the deleted) CHILL). */
- TYPE_CODE_BITSTRING,
-
/* Unknown type. The length field is valid if we were able to
deduce that much about the type, or 0 if we don't even know that. */
TYPE_CODE_ERROR,
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 1b2c3d6..1b92748 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -213,7 +213,6 @@ value_arg_coerce (struct gdbarch *gdbarch, struct value *arg,
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_ERROR:
case TYPE_CODE_MEMBERPTR:
case TYPE_CODE_METHODPTR:
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index e92679f..3d3127e 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -409,7 +409,6 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
options, NULL, 0);
break;
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_SET:
elttype = TYPE_INDEX_TYPE (type);
CHECK_TYPEDEF (elttype);
@@ -424,13 +423,9 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
struct type *range = elttype;
LONGEST low_bound, high_bound;
int i;
- int is_bitstring = TYPE_CODE (type) == TYPE_CODE_BITSTRING;
int need_comma = 0;
- if (is_bitstring)
- fputs_filtered ("B'", stream);
- else
- fputs_filtered ("{", stream);
+ fputs_filtered ("{", stream);
i = get_discrete_bounds (range, &low_bound, &high_bound);
maybe_bad_bstring:
@@ -450,9 +445,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
i = element;
goto maybe_bad_bstring;
}
- if (is_bitstring)
- fprintf_filtered (stream, "%d", element);
- else if (element)
+ if (element)
{
if (need_comma)
fputs_filtered (", ", stream);
@@ -476,10 +469,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
}
}
done:
- if (is_bitstring)
- fputs_filtered ("'", stream);
- else
- fputs_filtered ("}", stream);
+ fputs_filtered ("}", stream);
}
break;
diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c
index a00f5b3..fceb97a 100644
--- a/gdb/p-typeprint.c
+++ b/gdb/p-typeprint.c
@@ -289,7 +289,6 @@ pascal_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_TYPEDEF:
/* These types need no prefix. They are listed here so that
@@ -408,7 +407,6 @@ pascal_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_TYPEDEF:
/* These types do not need a suffix. They are listed so that
@@ -792,10 +790,6 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
show - 1, level);
break;
- case TYPE_CODE_BITSTRING:
- fputs_filtered ("BitString", stream);
- break;
-
case TYPE_CODE_STRING:
fputs_filtered ("String", stream);
break;
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 9f44617..b2287f2 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -334,7 +334,6 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
}
break;
- case TYPE_CODE_BITSTRING:
case TYPE_CODE_SET:
elttype = TYPE_INDEX_TYPE (type);
CHECK_TYPEDEF (elttype);
@@ -349,13 +348,9 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
struct type *range = elttype;
LONGEST low_bound, high_bound;
int i;
- int is_bitstring = TYPE_CODE (type) == TYPE_CODE_BITSTRING;
int need_comma = 0;
- if (is_bitstring)
- fputs_filtered ("B'", stream);
- else
- fputs_filtered ("[", stream);
+ fputs_filtered ("[", stream);
i = get_discrete_bounds (range, &low_bound, &high_bound);
if (low_bound == 0 && high_bound == -1 && TYPE_LENGTH (type) > 0)
@@ -383,9 +378,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
i = element;
goto maybe_bad_bstring;
}
- if (is_bitstring)
- fprintf_filtered (stream, "%d", element);
- else if (element)
+ if (element)
{
if (need_comma)
fputs_filtered (", ", stream);
@@ -409,10 +402,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
}
}
done:
- if (is_bitstring)
- fputs_filtered ("'", stream);
- else
- fputs_filtered ("]", stream);
+ fputs_filtered ("]", stream);
}
break;
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index 98030a6..3b9f0d8 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -85,6 +85,7 @@ static PyObject *typy_make_iter (PyObject *self, enum gdbpy_iter_kind kind);
static struct pyty_code pyty_codes[] =
{
+ ENTRY (TYPE_CODE_BITSTRING),
ENTRY (TYPE_CODE_PTR),
ENTRY (TYPE_CODE_ARRAY),
ENTRY (TYPE_CODE_STRUCT),
@@ -98,7 +99,6 @@ static struct pyty_code pyty_codes[] =
ENTRY (TYPE_CODE_SET),
ENTRY (TYPE_CODE_RANGE),
ENTRY (TYPE_CODE_STRING),
- ENTRY (TYPE_CODE_BITSTRING),
ENTRY (TYPE_CODE_ERROR),
ENTRY (TYPE_CODE_METHOD),
ENTRY (TYPE_CODE_METHODPTR),
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index eb09c9d..1c288ee 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -2024,11 +2024,9 @@ again:
make_vector_type (type);
break;
- case 'S': /* Set or bitstring type */
+ case 'S': /* Set type */
type1 = read_type (pp, objfile);
type = create_set_type ((struct type *) NULL, type1);
- if (is_string)
- TYPE_CODE (type) = TYPE_CODE_BITSTRING;
if (typenums[0] != -1)
*dbx_lookup_type (typenums, objfile) = type;
break;
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 96d5411..6858d2b 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -139,7 +139,6 @@ value_ptrdiff (struct value *arg1, struct value *arg2)
ARRAY may be of type TYPE_CODE_ARRAY or TYPE_CODE_STRING. If the
current language supports C-style arrays, it may also be TYPE_CODE_PTR.
- To access TYPE_CODE_BITSTRING values, use value_bitstring_subscript.
See comments in value_coerce_array() for rationale for reason for
doing lower bounds adjustment here rather than there.
@@ -221,46 +220,6 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound)
return v;
}
-/* Return the value of BITSTRING[IDX] as (boolean) type TYPE. */
-
-struct value *
-value_bitstring_subscript (struct type *type,
- struct value *bitstring, LONGEST index)
-{
-
- struct type *bitstring_type, *range_type;
- struct value *v;
- int offset, byte, bit_index;
- LONGEST lowerbound, upperbound;
-
- bitstring_type = check_typedef (value_type (bitstring));
- gdb_assert (TYPE_CODE (bitstring_type) == TYPE_CODE_BITSTRING);
-
- range_type = TYPE_INDEX_TYPE (bitstring_type);
- get_discrete_bounds (range_type, &lowerbound, &upperbound);
- if (index < lowerbound || index > upperbound)
- error (_("bitstring index out of range"));
-
- index -= lowerbound;
- offset = index / TARGET_CHAR_BIT;
- byte = *((char *) value_contents (bitstring) + offset);
-
- bit_index = index % TARGET_CHAR_BIT;
- byte >>= (gdbarch_bits_big_endian (get_type_arch (bitstring_type)) ?
- TARGET_CHAR_BIT - 1 - bit_index : bit_index);
-
- v = value_from_longest (type, byte & 1);
-
- set_value_bitpos (v, bit_index);
- set_value_bitsize (v, 1);
- set_value_component_location (v, bitstring);
- VALUE_FRAME_ID (v) = VALUE_FRAME_ID (bitstring);
-
- set_value_offset (v, offset + value_offset (bitstring));
-
- return v;
-}
-
\f
/* Check to see if either argument is a structure, or a reference to
one. This is called so we know whether to go ahead with the normal
@@ -735,10 +694,9 @@ value_concat (struct value *arg1, struct value *arg2)
}
outval = value_string (ptr, count * inval2len, char_type);
}
- else if (TYPE_CODE (type2) == TYPE_CODE_BITSTRING
- || TYPE_CODE (type2) == TYPE_CODE_BOOL)
+ else if (TYPE_CODE (type2) == TYPE_CODE_BOOL)
{
- error (_("unimplemented support for bitstring/boolean repeats"));
+ error (_("unimplemented support for boolean repeats"));
}
else
{
@@ -780,17 +738,15 @@ value_concat (struct value *arg1, struct value *arg2)
}
outval = value_string (ptr, inval1len + inval2len, char_type);
}
- else if (TYPE_CODE (type1) == TYPE_CODE_BITSTRING
- || TYPE_CODE (type1) == TYPE_CODE_BOOL)
+ else if (TYPE_CODE (type1) == TYPE_CODE_BOOL)
{
/* We have two bitstrings to concatenate. */
- if (TYPE_CODE (type2) != TYPE_CODE_BITSTRING
- && TYPE_CODE (type2) != TYPE_CODE_BOOL)
+ if (TYPE_CODE (type2) != TYPE_CODE_BOOL)
{
- error (_("Bitstrings or booleans can only be concatenated "
+ error (_("Booleans can only be concatenated "
"with other bitstrings or booleans."));
}
- error (_("unimplemented support for bitstring/boolean concatenation."));
+ error (_("unimplemented support for boolean concatenation."));
}
else
{
diff --git a/gdb/valops.c b/gdb/valops.c
index 8167cd4..17696ee 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -3744,8 +3744,7 @@ value_slice (struct value *array, int lowbound, int length)
array_type = check_typedef (value_type (array));
if (TYPE_CODE (array_type) != TYPE_CODE_ARRAY
- && TYPE_CODE (array_type) != TYPE_CODE_STRING
- && TYPE_CODE (array_type) != TYPE_CODE_BITSTRING)
+ && TYPE_CODE (array_type) != TYPE_CODE_STRING)
error (_("cannot take slice of non-array"));
range_type = TYPE_INDEX_TYPE (array_type);
@@ -3762,38 +3761,7 @@ value_slice (struct value *array, int lowbound, int length)
TYPE_TARGET_TYPE (range_type),
lowbound,
lowbound + length - 1);
- if (TYPE_CODE (array_type) == TYPE_CODE_BITSTRING)
- {
- int i;
-
- slice_type = create_set_type ((struct type *) NULL,
- slice_range_type);
- TYPE_CODE (slice_type) = TYPE_CODE_BITSTRING;
- slice = value_zero (slice_type, not_lval);
- for (i = 0; i < length; i++)
- {
- int element = value_bit_index (array_type,
- value_contents (array),
- lowbound + i);
-
- if (element < 0)
- error (_("internal error accessing bitstring"));
- else if (element > 0)
- {
- int j = i % TARGET_CHAR_BIT;
-
- if (gdbarch_bits_big_endian (get_type_arch (array_type)))
- j = TARGET_CHAR_BIT - 1 - j;
- value_contents_raw (slice)[i / TARGET_CHAR_BIT] |= (1 << j);
- }
- }
- /* We should set the address, bitssize, and bitspos, so the
- slice can be used on the LHS, but that may require extensions
- to value_assign. For now, just leave as a non_lval.
- FIXME. */
- }
- else
{
struct type *element_type = TYPE_TARGET_TYPE (array_type);
LONGEST offset =
diff --git a/gdb/valprint.c b/gdb/valprint.c
index fc5942d..6e651f6 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -252,7 +252,6 @@ scalar_type_p (struct type *type)
case TYPE_CODE_UNION:
case TYPE_CODE_SET:
case TYPE_CODE_STRING:
- case TYPE_CODE_BITSTRING:
return 0;
default:
return 1;
--
1.7.7.6
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] remove TYPE_CODE_BITSTRING
2012-08-13 1:13 ` Yao Qi
@ 2012-08-15 19:39 ` Tom Tromey
0 siblings, 0 replies; 9+ messages in thread
From: Tom Tromey @ 2012-08-15 19:39 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:
Yao> I'll define TYPE_CODE_BITSTRING -1 in 'enum type_code', and document
Yao> gdb.TYPE_CODE_BITSTRING is deprecated. Note that the following patch
Yao> moves ENTRY (TYPE_CODE_BITSTRING) to slot 0 in array 'pyty_codes', in
Yao> order to keep the order identical to 'enum type_code'.
Thanks. The code bits here are ok.
Tom
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-08-15 19:39 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-10 9:13 [RFC 0/3] Remove unused operators OP_BITSTRING TERNOP_SLICE_COUNT and TYPE_CODE_BITSTRING Yao Qi
2012-08-10 9:13 ` [PATCH 2/3] Remove TERNOP_SLICE_COUNT Yao Qi
2012-08-10 16:16 ` Tom Tromey
2012-08-10 9:13 ` [PATCH 3/3] remove TYPE_CODE_BITSTRING Yao Qi
2012-08-10 16:19 ` Tom Tromey
2012-08-13 1:13 ` Yao Qi
2012-08-15 19:39 ` Tom Tromey
2012-08-10 9:13 ` [PATCH 1/3] Remove OP_BITSTRING Yao Qi
2012-08-10 16:16 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox