From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by sourceware.org (Postfix) with ESMTPS id 4984638582AB for ; Thu, 4 May 2023 14:21:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4984638582AB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-io1-xd2c.google.com with SMTP id ca18e2360f4ac-76983b8a1f5so35909939f.0 for ; Thu, 04 May 2023 07:21:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1683210086; x=1685802086; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=kdh7BcZwye8efjubBbzbl2qzKbHNOF7CoKYw6HQxhRU=; b=VG64/Lbrvpp+rLOlh0BabBV/EqaxLbPA3H28YoN2cRj4KgR86zVn4oq2ycV09Dj65B covPhxfKgpLdfRMUjRyz3dMmBMrHCKb7JMa+o+ktz6FjgKm3o257p6DfWf3uQIjevLoW d97cWD8VtfHcaaR1Ks5crbxyinMSAPwnDQyJYZkGm2Sxc8aGScXlz+sfYADZXuQAmXUQ wS5My8LlWwgiFhT5Ljr9691t5KtAVyqnQ4SIY25UgvC5ry0K5OFTjC8SE9MHVPz5KZhV NTpOWIb+F2N75h8Oha02yA299Ou1FJ5Ms/6BUGN7tZpD3Si1Ny3pcAXF84B1TCs+tcYO s6Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683210086; x=1685802086; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kdh7BcZwye8efjubBbzbl2qzKbHNOF7CoKYw6HQxhRU=; b=HvlXVYD98zO+nRQvrdDB8PR71aClRYiyElZNlP42caio/hiaj6brNMc8c6Qro5Tf+R PAmS8Q6pi68J/DvOq4MZFJxk4jri4cdJmd/IOu2yFQtlSXBvQ7uP2XYi0+RjKmjVxu32 R3wdqDxBm2SoCqxaQAX4It+AshovtrpN4BIUIf+n6LMw+v8N4tuVPiCwedfYgV3RWzSB qCC1+BDKxgVQ5Aifjx6FtHcauIMjSJ1b28zJKm/niSNLnCufIcHDHW12fUmzNUHBOWks X36sFgQQ3Z2AP7fLeuYGyMAaLMcJYVlNXAQ4RXXOZapFLyXUti4FXUJPNcg4bNKpntZb XG6A== X-Gm-Message-State: AC+VfDyVEcMEicmzGykNfjud9G10cf7YJhDfF3XDeWYhYNRdDHUrqfdY Oe8uxy1qN0bqOQVqxjW6Dq326IJ1cT4kVgawc+Wh5Q== X-Google-Smtp-Source: ACHHUZ5RhGrPsYvHsONPtYSU0TRVDvhS0z4xlhmQs0Y8sYOBQtOqA3Qprw09oNI4BB8+2y3aKcK9AQ== X-Received: by 2002:a05:6602:25d2:b0:760:b45d:7d54 with SMTP id d18-20020a05660225d200b00760b45d7d54mr17069729iop.13.1683210086542; Thu, 04 May 2023 07:21:26 -0700 (PDT) Received: from localhost.localdomain (71-211-191-82.hlrn.qwest.net. [71.211.191.82]) by smtp.gmail.com with ESMTPSA id r16-20020a6b4410000000b00760a07e4e09sm9983384ioa.5.2023.05.04.07.21.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 May 2023 07:21:26 -0700 (PDT) From: Tom Tromey Date: Thu, 04 May 2023 08:21:25 -0600 Subject: [PATCH 04/11] Simplify parser_state constructor MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230504-frameless-v1-4-4191201740b0@adacore.com> References: <20230504-frameless-v1-0-4191201740b0@adacore.com> In-Reply-To: <20230504-frameless-v1-0-4191201740b0@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This simplifies the parser_state constructor by having it accept a parser_flags parameter. --- gdb/parse.c | 7 ++----- gdb/parser-defs.h | 9 ++++----- gdb/rust-parse.c | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/gdb/parse.c b/gdb/parse.c index ed0d0b8a880..2f014dd2172 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -398,11 +398,8 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc, to the value matching SELECTED_FRAME as set by get_current_arch. */ parser_state ps (lang, get_current_arch (), expression_context_block, - expression_context_pc, - (flags & PARSER_COMMA_TERMINATES) != 0, - *stringptr, - completer != nullptr, tracker, - (flags & PARSER_VOID_CONTEXT) != 0); + expression_context_pc, flags, *stringptr, + completer != nullptr, tracker); scoped_restore_current_language lang_saver; set_language (lang->la_language); diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h index 5c6bc222b6b..2a246ff38f0 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h @@ -146,19 +146,18 @@ struct parser_state : public expr_builder struct gdbarch *gdbarch, const struct block *context_block, CORE_ADDR context_pc, - int comma, + parser_flags flags, const char *input, bool completion, - innermost_block_tracker *tracker, - bool void_p) + innermost_block_tracker *tracker) : expr_builder (lang, gdbarch), expression_context_block (context_block), expression_context_pc (context_pc), - comma_terminates (comma), + comma_terminates ((flags & PARSER_COMMA_TERMINATES) != 0), lexptr (input), parse_completion (completion), block_tracker (tracker), - void_context_p (void_p) + void_context_p ((flags & PARSER_VOID_CONTEXT) != 0) { } diff --git a/gdb/rust-parse.c b/gdb/rust-parse.c index 648e48dda40..6ba959065c9 100644 --- a/gdb/rust-parse.c +++ b/gdb/rust-parse.c @@ -2300,7 +2300,7 @@ rust_lex_tests (void) { /* Set up dummy "parser", so that rust_type works. */ struct parser_state ps (language_def (language_rust), target_gdbarch (), - nullptr, 0, 0, nullptr, 0, nullptr, false); + nullptr, 0, 0, nullptr, 0, nullptr); rust_parser parser (&ps); rust_lex_test_one (&parser, "", 0); -- 2.39.1