From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gMk9LbavcV+bHgAAWB0awg (envelope-from ) for ; Mon, 28 Sep 2020 05:41:10 -0400 Received: by simark.ca (Postfix, from userid 112) id B2CE71E590; Mon, 28 Sep 2020 05:41:10 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED, MAILING_LIST_MULTI,T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id B68F51E58F for ; Mon, 28 Sep 2020 05:41:03 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 61D113941C27; Mon, 28 Sep 2020 09:41:03 +0000 (GMT) Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by sourceware.org (Postfix) with ESMTPS id 3C57D386184C for ; Mon, 28 Sep 2020 09:41:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3C57D386184C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wr1-x442.google.com with SMTP id t10so545218wrv.1 for ; Mon, 28 Sep 2020 02:41:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rphiS2paUOJsn85Eqfj3m6KGDs+d4d4IQ+6KEV3syjA=; b=Xe8WNWZDD0ZFP9dcviNXyBi/4gh42OlPUQWHFyOqJbvFt52SQ/4Nij/hvn6Z4GUs++ EseCNXfvTSuR4/IEGeh4yJTxdR6I+OYlL8Q6vQ0QkYP/3v+kmKtGbW4LLrFlQfMBFUKh AwWkdMj+6iFuaW59prhdc9S3IVKKyf+4O2O5Bhg1796eCnFQCEfZPFZz3Q8KKIQeLOtu cHHzF7fqVIBCV8aUevMCi0l5Y/cVj7gU1CGB819Qvo40687K5ysh7D9Jdwu4DenN09yS prEurmiFXOWxBygnGlaSxCyY6GduQtnzOiZsmc8qnqnwncbtrj07UWjNjy4EkU9s3G5g ipBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rphiS2paUOJsn85Eqfj3m6KGDs+d4d4IQ+6KEV3syjA=; b=BU9FMZdrNZcN/RlWF02J/W9hJilMjS9Tm7/2zKI10inQhJvN9u6jE/i+z5FPB1j02a rAr/D8/rVyZmfj6SyOqwM257Zb2glsc/yltExGBufusX7qXZ3TM88qC/S71NUFlzwYRO nMyBdyTPSQaH9HHq0E//69p6PnkVVaIJZIaZbetXtALvTPSxRR1NOQlr1Bc9C/EcFq1v VW1hCOg/jSRz/Mond+d4oSxlOjFaQJQQ4mrNUOsFZVsNqFqJ2CGcy5zNj2pwtmnU+n0Y XvYp3wWQr84rdTJ5L3u5s8ApkcO/m9qMcIQE4Ul/PWgG83TqqJlBjADxjNOUF5fLMam0 akYg== X-Gm-Message-State: AOAM530gDzD18AkebXT1b7c5TopKD1mL0ZM7moMLA7JwYl/mATGJFkYa BwWjVZf+eWTjSbMxVbgxlRHN6SiSuo1cTA== X-Google-Smtp-Source: ABdhPJzV+V6MsbUcv9OrxbH5Fyrc46cF0bHX/oJVsfAZjfRmxguZ4Yf3oyFp+utI00smt/6X6AtXLw== X-Received: by 2002:a5d:5583:: with SMTP id i3mr665748wrv.119.1601286060136; Mon, 28 Sep 2020 02:41:00 -0700 (PDT) Received: from localhost (host109-151-23-62.range109-151.btcentralplus.com. [109.151.23.62]) by smtp.gmail.com with ESMTPSA id w7sm641492wrm.92.2020.09.28.02.40.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 02:40:59 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Subject: [PATCHv4 2/3] gdb: rename 'enum range_type' to 'enum range_flag' Date: Mon, 28 Sep 2020 10:40:48 +0100 Message-Id: <86c580e0f6809f2b7bae26b94eee50d35b85396d.1601285823.git.andrew.burgess@embecosm.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" To avoid confusion with other parts of GDB relating to types and ranges, rename this enum to make it clearer that it is a set of individual flags rather than an enumeration of different types of range. There should be no user visible changes after this commit. gdb/ChangeLog: * expprint.c (print_subexp_standard): Change enum range_type to range_flag and rename variables to match. (dump_subexp_body_standard): Likewise. * expression.h (enum range_type): Rename to... (enum range_flag): ...this. (range_types): Rename to... (range_flags): ...this. * f-lang.c (value_f90_subarray): Change enum range_type to range_flag and rename variables to match. * parse.c (operator_length_standard): Likewise. * rust-exp.y (rust_parser::convert_ast_to_expression): Change enum range_type to range_flag. * rust-lang.c (rust_evaluate_funcall): Likewise. (rust_range): Likewise. (rust_compute_range): Likewise. (rust_subscript): Likewise. --- gdb/ChangeLog | 19 +++++++++++++++++++ gdb/expprint.c | 24 ++++++++++++------------ gdb/expression.h | 4 ++-- gdb/f-lang.c | 8 ++++---- gdb/parse.c | 8 ++++---- gdb/rust-exp.y | 2 +- gdb/rust-lang.c | 8 ++++---- 7 files changed, 46 insertions(+), 27 deletions(-) diff --git a/gdb/expprint.c b/gdb/expprint.c index bdb69a92f75..2dee2bb1932 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -579,19 +579,19 @@ print_subexp_standard (struct expression *exp, int *pos, case OP_RANGE: { - enum range_type range_type; + enum range_flag range_flag; - range_type = (enum range_type) + range_flag = (enum range_flag) longest_to_int (exp->elts[pc + 1].longconst); *pos += 2; - if (range_type & RANGE_HIGH_BOUND_EXCLUSIVE) + if (range_flag & RANGE_HIGH_BOUND_EXCLUSIVE) fputs_filtered ("EXCLUSIVE_", stream); fputs_filtered ("RANGE(", stream); - if (!(range_type & RANGE_LOW_BOUND_DEFAULT)) + if (!(range_flag & RANGE_LOW_BOUND_DEFAULT)) print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); fputs_filtered ("..", stream); - if (!(range_type & RANGE_HIGH_BOUND_DEFAULT)) + if (!(range_flag & RANGE_HIGH_BOUND_DEFAULT)) print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); fputs_filtered (")", stream); return; @@ -1106,25 +1106,25 @@ dump_subexp_body_standard (struct expression *exp, break; case OP_RANGE: { - enum range_type range_type; + enum range_flag range_flag; - range_type = (enum range_type) + range_flag = (enum range_flag) longest_to_int (exp->elts[elt].longconst); elt += 2; - if (range_type & RANGE_HIGH_BOUND_EXCLUSIVE) + if (range_flag & RANGE_HIGH_BOUND_EXCLUSIVE) fputs_filtered ("Exclusive", stream); fputs_filtered ("Range '", stream); - if (!(range_type & RANGE_LOW_BOUND_DEFAULT)) + if (!(range_flag & RANGE_LOW_BOUND_DEFAULT)) fputs_filtered ("EXP", stream); fputs_filtered ("..", stream); - if (!(range_type & RANGE_HIGH_BOUND_DEFAULT)) + if (!(range_flag & RANGE_HIGH_BOUND_DEFAULT)) fputs_filtered ("EXP", stream); fputs_filtered ("'", stream); - if (!(range_type & RANGE_LOW_BOUND_DEFAULT)) + if (!(range_flag & RANGE_LOW_BOUND_DEFAULT)) elt = dump_subexp (exp, stream, elt); - if (!(range_type & RANGE_HIGH_BOUND_DEFAULT)) + if (!(range_flag & RANGE_HIGH_BOUND_DEFAULT)) elt = dump_subexp (exp, stream, elt); } break; diff --git a/gdb/expression.h b/gdb/expression.h index 6bd3fc0c3c5..fd483e5f277 100644 --- a/gdb/expression.h +++ b/gdb/expression.h @@ -185,7 +185,7 @@ extern void dump_prefix_expression (struct expression *, struct ui_file *); or inclusive. So we have six sorts of subrange. This enumeration type is to identify this. */ -enum range_type : unsigned +enum range_flag : unsigned { /* This is a standard range. Both the lower and upper bounds are defined, and the bounds are inclusive. */ @@ -201,6 +201,6 @@ enum range_type : unsigned RANGE_HIGH_BOUND_EXCLUSIVE = 1 << 2, }; -DEF_ENUM_FLAGS_TYPE (enum range_type, range_types); +DEF_ENUM_FLAGS_TYPE (enum range_flag, range_flags); #endif /* !defined (EXPRESSION_H) */ diff --git a/gdb/f-lang.c b/gdb/f-lang.c index fcab973f874..37d05b27653 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -126,17 +126,17 @@ value_f90_subarray (struct value *array, int pc = (*pos) + 1; LONGEST low_bound, high_bound; struct type *range = check_typedef (value_type (array)->index_type ()); - enum range_type range_type - = (enum range_type) longest_to_int (exp->elts[pc].longconst); + enum range_flag range_flag + = (enum range_flag) longest_to_int (exp->elts[pc].longconst); *pos += 3; - if (range_type & RANGE_LOW_BOUND_DEFAULT) + if (range_flag & RANGE_LOW_BOUND_DEFAULT) low_bound = range->bounds ()->low.const_val (); else low_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside)); - if (range_type & RANGE_HIGH_BOUND_DEFAULT) + if (range_flag & RANGE_HIGH_BOUND_DEFAULT) high_bound = range->bounds ()->high.const_val (); else high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside)); diff --git a/gdb/parse.c b/gdb/parse.c index 6661fba81d7..4a15de8a499 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -774,7 +774,7 @@ operator_length_standard (const struct expression *expr, int endpos, { int oplen = 1; int args = 0; - enum range_type range_type; + enum range_flag range_flag; int i; if (endpos < 1) @@ -918,15 +918,15 @@ operator_length_standard (const struct expression *expr, int endpos, case OP_RANGE: oplen = 3; - range_type = (enum range_type) + range_flag = (enum range_flag) longest_to_int (expr->elts[endpos - 2].longconst); /* Assume the range has 2 arguments (low bound and high bound), then reduce the argument count if any bounds are set to default. */ args = 2; - if (range_type & RANGE_LOW_BOUND_DEFAULT) + if (range_flag & RANGE_LOW_BOUND_DEFAULT) --args; - if (range_type & RANGE_HIGH_BOUND_DEFAULT) + if (range_flag & RANGE_HIGH_BOUND_DEFAULT) --args; break; diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y index ea9fbdc25fb..802ccc0a7f6 100644 --- a/gdb/rust-exp.y +++ b/gdb/rust-exp.y @@ -2492,7 +2492,7 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation, case OP_RANGE: { - enum range_type kind = (RANGE_HIGH_BOUND_DEFAULT + enum range_flag kind = (RANGE_HIGH_BOUND_DEFAULT | RANGE_LOW_BOUND_DEFAULT); if (operation->left.op != NULL) diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 820ebb92c43..86e7289c5e6 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -1065,7 +1065,6 @@ rust_evaluate_funcall (struct expression *exp, int *pos, enum noside noside) static struct value * rust_range (struct expression *exp, int *pos, enum noside noside) { - enum range_type kind; struct value *low = NULL, *high = NULL; struct value *addrval, *result; CORE_ADDR addr; @@ -1074,7 +1073,8 @@ rust_range (struct expression *exp, int *pos, enum noside noside) struct type *temp_type; const char *name; - kind = (enum range_type) longest_to_int (exp->elts[*pos + 1].longconst); + auto kind + = (enum range_flag) longest_to_int (exp->elts[*pos + 1].longconst); *pos += 3; if (!(kind & RANGE_LOW_BOUND_DEFAULT)) @@ -1164,7 +1164,7 @@ rust_range (struct expression *exp, int *pos, enum noside noside) static void rust_compute_range (struct type *type, struct value *range, LONGEST *low, LONGEST *high, - range_types *kind) + range_flags *kind) { int i; @@ -1204,7 +1204,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, struct type *rhstype; LONGEST low, high_bound; /* Initialized to appease the compiler. */ - range_types kind = RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT; + range_flags kind = RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT; LONGEST high = 0; int want_slice = 0; -- 2.25.4