Blame SOURCES/gdb-rhbz1964167-fortran-range_type-to-range_flag.patch

405ea9
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
405ea9
From: Kevin Buettner <kevinb@redhat.com>
405ea9
Date: Mon, 24 May 2021 17:15:27 -0700
405ea9
Subject: gdb-rhbz1964167-fortran-range_type-to-range_flag.patch
405ea9
405ea9
;; [fortran] Backport Andrew Burgess's commit which renames enum
405ea9
;; range_type to enum range_flag.
405ea9
405ea9
gdb: rename 'enum range_type' to 'enum range_flag'
405ea9
405ea9
To avoid confusion with other parts of GDB relating to types and
405ea9
ranges, rename this enum to make it clearer that it is a set of
405ea9
individual flags rather than an enumeration of different types of
405ea9
range.
405ea9
405ea9
There should be no user visible changes after this commit.
405ea9
405ea9
gdb/ChangeLog:
405ea9
405ea9
	* expprint.c (print_subexp_standard): Change enum range_type to
405ea9
	range_flag and rename variables to match.
405ea9
	(dump_subexp_body_standard): Likewise.
405ea9
	* expression.h (enum range_type): Rename to...
405ea9
	(enum range_flag): ...this.
405ea9
	(range_types): Rename to...
405ea9
	(range_flags): ...this.
405ea9
	* f-lang.c (value_f90_subarray): Change enum range_type to
405ea9
	range_flag and rename variables to match.
405ea9
	* parse.c (operator_length_standard): Likewise.
405ea9
	* rust-exp.y (rust_parser::convert_ast_to_expression): Change enum
405ea9
	range_type to range_flag.
405ea9
	* rust-lang.c (rust_evaluate_funcall): Likewise.
405ea9
	(rust_range): Likewise.
405ea9
	(rust_compute_range): Likewise.
405ea9
	(rust_subscript): Likewise.
405ea9
405ea9
diff --git a/gdb/expprint.c b/gdb/expprint.c
405ea9
--- a/gdb/expprint.c
405ea9
+++ b/gdb/expprint.c
405ea9
@@ -578,19 +578,19 @@ print_subexp_standard (struct expression *exp, int *pos,
405ea9
 
405ea9
     case OP_RANGE:
405ea9
       {
405ea9
-	enum range_type range_type;
405ea9
+	enum range_flag range_flag;
405ea9
 
405ea9
-	range_type = (enum range_type)
405ea9
+	range_flag = (enum range_flag)
405ea9
 	  longest_to_int (exp->elts[pc + 1].longconst);
405ea9
 	*pos += 2;
405ea9
 
405ea9
-	if (range_type & RANGE_HIGH_BOUND_EXCLUSIVE)
405ea9
+	if (range_flag & RANGE_HIGH_BOUND_EXCLUSIVE)
405ea9
 	  fputs_filtered ("EXCLUSIVE_", stream);
405ea9
 	fputs_filtered ("RANGE(", stream);
405ea9
-	if (!(range_type & RANGE_LOW_BOUND_DEFAULT))
405ea9
+	if (!(range_flag & RANGE_LOW_BOUND_DEFAULT))
405ea9
 	  print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
405ea9
 	fputs_filtered ("..", stream);
405ea9
-	if (!(range_type & RANGE_HIGH_BOUND_DEFAULT))
405ea9
+	if (!(range_flag & RANGE_HIGH_BOUND_DEFAULT))
405ea9
 	  print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
405ea9
 	fputs_filtered (")", stream);
405ea9
 	return;
405ea9
@@ -1104,25 +1104,25 @@ dump_subexp_body_standard (struct expression *exp,
405ea9
       break;
405ea9
     case OP_RANGE:
405ea9
       {
405ea9
-	enum range_type range_type;
405ea9
+	enum range_flag range_flag;
405ea9
 
405ea9
-	range_type = (enum range_type)
405ea9
+	range_flag = (enum range_flag)
405ea9
 	  longest_to_int (exp->elts[elt].longconst);
405ea9
 	elt += 2;
405ea9
 
405ea9
-	if (range_type & RANGE_HIGH_BOUND_EXCLUSIVE)
405ea9
+	if (range_flag & RANGE_HIGH_BOUND_EXCLUSIVE)
405ea9
 	  fputs_filtered ("Exclusive", stream);
405ea9
 	fputs_filtered ("Range '", stream);
405ea9
-	if (!(range_type & RANGE_LOW_BOUND_DEFAULT))
405ea9
+	if (!(range_flag & RANGE_LOW_BOUND_DEFAULT))
405ea9
 	  fputs_filtered ("EXP", stream);
405ea9
 	fputs_filtered ("..", stream);
405ea9
-	if (!(range_type & RANGE_HIGH_BOUND_DEFAULT))
405ea9
+	if (!(range_flag & RANGE_HIGH_BOUND_DEFAULT))
405ea9
 	  fputs_filtered ("EXP", stream);
405ea9
 	fputs_filtered ("'", stream);
405ea9
 
405ea9
-	if (!(range_type & RANGE_LOW_BOUND_DEFAULT))
405ea9
+	if (!(range_flag & RANGE_LOW_BOUND_DEFAULT))
405ea9
 	  elt = dump_subexp (exp, stream, elt);
405ea9
-	if (!(range_type & RANGE_HIGH_BOUND_DEFAULT))
405ea9
+	if (!(range_flag & RANGE_HIGH_BOUND_DEFAULT))
405ea9
 	  elt = dump_subexp (exp, stream, elt);
405ea9
       }
405ea9
       break;
405ea9
diff --git a/gdb/expression.h b/gdb/expression.h
405ea9
--- a/gdb/expression.h
405ea9
+++ b/gdb/expression.h
405ea9
@@ -185,7 +185,7 @@ extern void dump_prefix_expression (struct expression *, struct ui_file *);
405ea9
    or inclusive.  So we have six sorts of subrange.  This enumeration
405ea9
    type is to identify this.  */
405ea9
 
405ea9
-enum range_type : unsigned
405ea9
+enum range_flag : unsigned
405ea9
 {
405ea9
   /* This is a standard range.  Both the lower and upper bounds are
405ea9
      defined, and the bounds are inclusive.  */
405ea9
@@ -201,6 +201,6 @@ enum range_type : unsigned
405ea9
   RANGE_HIGH_BOUND_EXCLUSIVE = 1 << 2,
405ea9
 };
405ea9
 
405ea9
-DEF_ENUM_FLAGS_TYPE (enum range_type, range_types);
405ea9
+DEF_ENUM_FLAGS_TYPE (enum range_flag, range_flags);
405ea9
 
405ea9
 #endif /* !defined (EXPRESSION_H) */
405ea9
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
405ea9
--- a/gdb/f-lang.c
405ea9
+++ b/gdb/f-lang.c
405ea9
@@ -126,17 +126,17 @@ value_f90_subarray (struct value *array,
405ea9
   int pc = (*pos) + 1;
405ea9
   LONGEST low_bound, high_bound;
405ea9
   struct type *range = check_typedef (value_type (array)->index_type ());
405ea9
-  enum range_type range_type
405ea9
-    = (enum range_type) longest_to_int (exp->elts[pc].longconst);
405ea9
+  enum range_flag range_flag
405ea9
+    = (enum range_flag) longest_to_int (exp->elts[pc].longconst);
405ea9
 
405ea9
   *pos += 3;
405ea9
 
405ea9
-  if (range_type & RANGE_LOW_BOUND_DEFAULT)
405ea9
+  if (range_flag & RANGE_LOW_BOUND_DEFAULT)
405ea9
     low_bound = range->bounds ()->low.const_val ();
405ea9
   else
405ea9
     low_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
405ea9
 
405ea9
-  if (range_type & RANGE_HIGH_BOUND_DEFAULT)
405ea9
+  if (range_flag & RANGE_HIGH_BOUND_DEFAULT)
405ea9
     high_bound = range->bounds ()->high.const_val ();
405ea9
   else
405ea9
     high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
405ea9
diff --git a/gdb/parse.c b/gdb/parse.c
405ea9
--- a/gdb/parse.c
405ea9
+++ b/gdb/parse.c
405ea9
@@ -774,7 +774,7 @@ operator_length_standard (const struct expression *expr, int endpos,
405ea9
 {
405ea9
   int oplen = 1;
405ea9
   int args = 0;
405ea9
-  enum range_type range_type;
405ea9
+  enum range_flag range_flag;
405ea9
   int i;
405ea9
 
405ea9
   if (endpos < 1)
405ea9
@@ -918,15 +918,15 @@ operator_length_standard (const struct expression *expr, int endpos,
405ea9
 
405ea9
     case OP_RANGE:
405ea9
       oplen = 3;
405ea9
-      range_type = (enum range_type)
405ea9
+      range_flag = (enum range_flag)
405ea9
 	longest_to_int (expr->elts[endpos - 2].longconst);
405ea9
 
405ea9
       /* Assume the range has 2 arguments (low bound and high bound), then
405ea9
 	 reduce the argument count if any bounds are set to default.  */
405ea9
       args = 2;
405ea9
-      if (range_type & RANGE_LOW_BOUND_DEFAULT)
405ea9
+      if (range_flag & RANGE_LOW_BOUND_DEFAULT)
405ea9
 	--args;
405ea9
-      if (range_type & RANGE_HIGH_BOUND_DEFAULT)
405ea9
+      if (range_flag & RANGE_HIGH_BOUND_DEFAULT)
405ea9
 	--args;
405ea9
 
405ea9
       break;
405ea9
diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y
405ea9
--- a/gdb/rust-exp.y
405ea9
+++ b/gdb/rust-exp.y
405ea9
@@ -2492,7 +2492,7 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation,
405ea9
 
405ea9
     case OP_RANGE:
405ea9
       {
405ea9
-	enum range_type kind = (RANGE_HIGH_BOUND_DEFAULT
405ea9
+	unsigned int kind = (RANGE_HIGH_BOUND_DEFAULT
405ea9
 				| RANGE_LOW_BOUND_DEFAULT);
405ea9
 
405ea9
 	if (operation->left.op != NULL)
405ea9
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
405ea9
--- a/gdb/rust-lang.c
405ea9
+++ b/gdb/rust-lang.c
405ea9
@@ -1070,7 +1070,6 @@ rust_evaluate_funcall (struct expression *exp, int *pos, enum noside noside)
405ea9
 static struct value *
405ea9
 rust_range (struct expression *exp, int *pos, enum noside noside)
405ea9
 {
405ea9
-  enum range_type kind;
405ea9
   struct value *low = NULL, *high = NULL;
405ea9
   struct value *addrval, *result;
405ea9
   CORE_ADDR addr;
405ea9
@@ -1079,7 +1078,8 @@ rust_range (struct expression *exp, int *pos, enum noside noside)
405ea9
   struct type *temp_type;
405ea9
   const char *name;
405ea9
 
405ea9
-  kind = (enum range_type) longest_to_int (exp->elts[*pos + 1].longconst);
405ea9
+  auto kind
405ea9
+    = (enum range_flag) longest_to_int (exp->elts[*pos + 1].longconst);
405ea9
   *pos += 3;
405ea9
 
405ea9
   if (!(kind & RANGE_LOW_BOUND_DEFAULT))
405ea9
@@ -1169,7 +1169,7 @@ rust_range (struct expression *exp, int *pos, enum noside noside)
405ea9
 static void
405ea9
 rust_compute_range (struct type *type, struct value *range,
405ea9
 		    LONGEST *low, LONGEST *high,
405ea9
-		    range_types *kind)
405ea9
+		    range_flags *kind)
405ea9
 {
405ea9
   int i;
405ea9
 
405ea9
@@ -1209,7 +1209,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
405ea9
   struct type *rhstype;
405ea9
   LONGEST low, high_bound;
405ea9
   /* Initialized to appease the compiler.  */
405ea9
-  range_types kind = RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT;
405ea9
+  range_flags kind = RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT;
405ea9
   LONGEST high = 0;
405ea9
   int want_slice = 0;
405ea9