From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by sourceware.org (Postfix) with ESMTPS id D14C23809BE9 for ; Thu, 6 Jun 2024 14:45:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D14C23809BE9 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D14C23809BE9 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::d31 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717685154; cv=none; b=VZUIdDfPhJwEr1upFzjHAO+e1tfYAFbScfRG0EtYiOxi42cW33FnA5Zp2t8pvHeZRvKaeJhD+FMhkYT2vFXzY6FEzBbh7a2zUXzccQr2ijuaRJJ427+2g683CJs3V19YlS4iEYkQgPPMB+Efdpe+DU4DGDwAcv+cdXHxTlLAdqs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717685154; c=relaxed/simple; bh=pw95mklaVRywB06+hllWS1jRbNT41LLmhnJXptSXSt0=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=EfWIgUGUCDy8sASTaY+fI+2WBbq4yJ/OqHlez6ENE+7Q0YA0hzQkInZds0CKqRPPKr/7gPw8o6UOSKAaZ2TAxEM4kxvtqQOqPdnC38rmuxyfyScEGQ93Ib7W2hzVi0fS0dP7iF0dtn8j9a2Tqb5KLL05qZcEIV2FVHphiq+lXH4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-io1-xd31.google.com with SMTP id ca18e2360f4ac-7eb38bc509aso43576739f.3 for ; Thu, 06 Jun 2024 07:45:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1717685149; x=1718289949; darn=sourceware.org; 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=jGUMG+svRNZeOmqwokMWwtmpr5HvzYRgP4drgmGXuks=; b=jSrt2RU8PoPnBzd+Nw7PaaxPGuoFgjJRrgE0rbWzVrWvxEGzCn8xkr4vwFBl05OFb4 D37156lWRtzM5Vl/DSZtzy7++u7Q6apUt7S5hYppcIkouu2JfFxA/xcYDkZxJkhx3mOj JfGQ4v0szXycaVdixocq0VTq61F4nxkyMr/4Uk1NufbotXkBui3nktdppWpaPnXpLEMM 0Fp5Ieq5795EDyPwIorFGHa9dz2+bp4YlHh9GJ/1vvGeW1COKKZyvHny7AO3xLO+FQAX aDnoMIkMs9kFb7WRiIhoEvCEYMbm0U4BX5aiaYBWSlLLCL6qA6/WH8JSgMQdlMnAQ7Q7 9cXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717685149; x=1718289949; 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=jGUMG+svRNZeOmqwokMWwtmpr5HvzYRgP4drgmGXuks=; b=hUwvV23lo1pwks6sczPNttheiLorIU4rUmToy0Pm7dnQxjDcdt0XCxW1sPf0V0mmKf O9eRyeICTYGOPCUPw77NEjYoQkcKL74YzpUbQm5Txu7iW6U5xk/FNZOLwAKx4/GxiPfC YJZJKsd5sgBydlWt2rWgB2P4ubMfj23cnZLOUfTNohiXLF59yP7p+sdSJfR4PU84cRkV gbg1t7+FZ8iQXkeLjZblc2h0tG4AxB5qZoH3bbwnVxe7+IKHVYrz+gwAnwCC0UcNTY9g BZ7tAfCj7v2/H5vIKa0IrKTf28P9ZTGH1I65cXUVpY1G7f+q3vOhk1vPZzdtZZKzioej vBSg== X-Gm-Message-State: AOJu0YyDGfm5qWPZf93gUDTMTRqwbzJDE+2QzLNU6pUWXZxUWOuu5yUX KoAOkMrivPFgsNoMKcx0RLEdrClYKr3hQgpRnFc0Jr9tS6eMklvSA8z3L700VhunoEAJJl2TrhU = X-Google-Smtp-Source: AGHT+IGcYPqfsCycFovYh4WhJTDDzYPfb+Mz+o+oXlGYC07kdGMUeOHhxt+h/DUYolhERDISLqfsPA== X-Received: by 2002:a05:6602:1484:b0:7eb:4ad8:a5af with SMTP id ca18e2360f4ac-7eb4ad8a685mr266286739f.4.1717685148887; Thu, 06 Jun 2024 07:45:48 -0700 (PDT) Received: from localhost.localdomain (75-166-134-4.hlrn.qwest.net. [75.166.134.4]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4b7a2244ea1sm360426173.47.2024.06.06.07.45.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 07:45:48 -0700 (PDT) From: Tom Tromey Date: Thu, 06 Jun 2024 08:45:49 -0600 Subject: [PATCH 6/6] Remove LS_TOKEN_STOKEN macro MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240606-linespec-no-macros-v1-6-a748ab917e12@adacore.com> References: <20240606-linespec-no-macros-v1-0-a748ab917e12@adacore.com> In-Reply-To: <20240606-linespec-no-macros-v1-0-a748ab917e12@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.13.0 X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SOMETLD_ARE_BAD_TLD,PDS_OTHER_BAD_TLD,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 removes the LS_TOKEN_STOKEN macro from linespec.c. --- gdb/linespec.c | 68 ++++++++++++++++++++++++++++------------------------------ 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/gdb/linespec.c b/gdb/linespec.c index 3db00300a58..7a1fbc2ebec 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -275,8 +275,6 @@ struct linespec_token } data; }; -#define LS_TOKEN_STOKEN(TOK) (TOK).data.string - /* An instance of the linespec parser. */ struct linespec_parser @@ -426,19 +424,19 @@ static int linespec_lexer_lex_number (linespec_parser *parser, linespec_token *tokenp) { tokenp->type = LSTOKEN_NUMBER; - LS_TOKEN_STOKEN (*tokenp).length = 0; - LS_TOKEN_STOKEN (*tokenp).ptr = parser->lexer.stream; + tokenp->data.string.length = 0; + tokenp->data.string.ptr = parser->lexer.stream; /* Keep any sign at the start of the stream. */ if (*parser->lexer.stream == '+' || *parser->lexer.stream == '-') { - ++LS_TOKEN_STOKEN (*tokenp).length; + ++tokenp->data.string.length; ++(parser->lexer.stream); } while (isdigit (*parser->lexer.stream)) { - ++LS_TOKEN_STOKEN (*tokenp).length; + ++tokenp->data.string.length; ++(parser->lexer.stream); } @@ -449,7 +447,7 @@ linespec_lexer_lex_number (linespec_parser *parser, linespec_token *tokenp) && *parser->lexer.stream != ':' && !strchr (linespec_quote_characters, *parser->lexer.stream)) { - parser->lexer.stream = LS_TOKEN_STOKEN (*tokenp).ptr; + parser->lexer.stream = tokenp->data.string.ptr; return 0; } @@ -573,8 +571,8 @@ copy_token_string (linespec_token token) if (token.type == LSTOKEN_KEYWORD) return make_unique_xstrdup (token.data.keyword); - str = LS_TOKEN_STOKEN (token).ptr; - s = remove_trailing_whitespace (str, str + LS_TOKEN_STOKEN (token).length); + str = token.data.string.ptr; + s = remove_trailing_whitespace (str, str + token.data.string.length); return gdb::unique_xmalloc_ptr (savestring (str, s - str)); } @@ -681,8 +679,8 @@ linespec_lexer_lex_string (linespec_parser *parser) { /* The input is an Ada operator. Return the quoted string as-is. */ - LS_TOKEN_STOKEN (token).ptr = parser->lexer.stream; - LS_TOKEN_STOKEN (token).length = len; + token.data.string.ptr = parser->lexer.stream; + token.data.string.length = len; parser->lexer.stream += len; return token; } @@ -695,7 +693,7 @@ linespec_lexer_lex_string (linespec_parser *parser) ++(parser->lexer.stream); /* Mark the start of the string. */ - LS_TOKEN_STOKEN (token).ptr = parser->lexer.stream; + token.data.string.ptr = parser->lexer.stream; /* Skip to the ending quote. */ end = skip_quote_char (parser->lexer.stream, quote_char); @@ -717,13 +715,13 @@ linespec_lexer_lex_string (linespec_parser *parser) token.type = LSTOKEN_STRING; while (*parser->lexer.stream != '\0') parser->lexer.stream++; - LS_TOKEN_STOKEN (token).length = parser->lexer.stream - 1 - start; + token.data.string.length = parser->lexer.stream - 1 - start; } else { /* Skip over the ending quote and mark the length of the string. */ parser->lexer.stream = (char *) ++end; - LS_TOKEN_STOKEN (token).length = parser->lexer.stream - 2 - start; + token.data.string.length = parser->lexer.stream - 2 - start; } } else @@ -749,8 +747,8 @@ linespec_lexer_lex_string (linespec_parser *parser) say, a function name. */ if (linespec_lexer_lex_keyword (p) != NULL) { - LS_TOKEN_STOKEN (token).ptr = start; - LS_TOKEN_STOKEN (token).length + token.data.string.ptr = start; + token.data.string.length = parser->lexer.stream - start; return token; } @@ -763,8 +761,8 @@ linespec_lexer_lex_string (linespec_parser *parser) string is complete; return the token. */ if (*parser->lexer.stream == 0) { - LS_TOKEN_STOKEN (token).ptr = start; - LS_TOKEN_STOKEN (token).length = parser->lexer.stream - start; + token.data.string.ptr = start; + token.data.string.length = parser->lexer.stream - start; return token; } else if (parser->lexer.stream[0] == ':') @@ -787,8 +785,8 @@ linespec_lexer_lex_string (linespec_parser *parser) else if ((parser->lexer.stream - start) != 1 || !IS_DIR_SEPARATOR (parser->lexer.stream[1])) { - LS_TOKEN_STOKEN (token).ptr = start; - LS_TOKEN_STOKEN (token).length + token.data.string.ptr = start; + token.data.string.length = parser->lexer.stream - start; return token; } @@ -799,8 +797,8 @@ linespec_lexer_lex_string (linespec_parser *parser) *parser->lexer.stream) && is_closing_quote_enclosed (parser->lexer.stream)) { - LS_TOKEN_STOKEN (token).ptr = start; - LS_TOKEN_STOKEN (token).length = parser->lexer.stream - start; + token.data.string.ptr = start; + token.data.string.length = parser->lexer.stream - start; return token; } /* Because commas may terminate a linespec and appear in @@ -846,8 +844,8 @@ linespec_lexer_lex_string (linespec_parser *parser) function(thread" in completion mode. */ if (*end == '\0') { - LS_TOKEN_STOKEN (token).ptr = start; - LS_TOKEN_STOKEN (token).length + token.data.string.ptr = start; + token.data.string.length = parser->lexer.stream - start; return token; } @@ -873,8 +871,8 @@ linespec_lexer_lex_string (linespec_parser *parser) } /* Comma terminates the string. */ - LS_TOKEN_STOKEN (token).ptr = start; - LS_TOKEN_STOKEN (token).length = parser->lexer.stream - start; + token.data.string.ptr = start; + token.data.string.length = parser->lexer.stream - start; return token; } @@ -953,9 +951,9 @@ linespec_lexer_lex_one (linespec_parser *parser) case ',': parser->lexer.current.type = LSTOKEN_COMMA; - LS_TOKEN_STOKEN (parser->lexer.current).ptr + parser->lexer.current.data.string.ptr = parser->lexer.stream; - LS_TOKEN_STOKEN (parser->lexer.current).length = 1; + parser->lexer.current.data.string.length = 1; ++(parser->lexer.stream); break; @@ -1004,7 +1002,7 @@ linespec_lexer_consume_token (linespec_parser *parser) { /* Advance the completion word past a potential initial quote-char. */ - parser->completion_word = LS_TOKEN_STOKEN (parser->lexer.current).ptr; + parser->completion_word = parser->lexer.current.data.string.ptr; } else if (advance_word) { @@ -1787,7 +1785,7 @@ linespec_parse_basic (linespec_parser *parser) if (tmp_tracker.have_completions ()) { parser->lexer.stream++; - LS_TOKEN_STOKEN (token).length++; + token.data.string.length++; name.reset (savestring (parser->completion_word, (parser->lexer.stream @@ -1829,7 +1827,7 @@ linespec_parse_basic (linespec_parser *parser) parser->result.explicit_loc.label_name = std::move (name); } else if (token.type == LSTOKEN_STRING - && *LS_TOKEN_STOKEN (token).ptr == '$') + && *token.data.string.ptr == '$') { /* User specified a convenience variable or history value. */ parser->result.explicit_loc.line_offset @@ -1899,12 +1897,12 @@ linespec_parse_basic (linespec_parser *parser) garbage. */ if (parser->completion_quote_char == '\0') { - const char *ptr = LS_TOKEN_STOKEN (token).ptr; - for (size_t i = 0; i < LS_TOKEN_STOKEN (token).length; i++) + const char *ptr = token.data.string.ptr; + for (size_t i = 0; i < token.data.string.length; i++) { if (ptr[i] == ' ') { - LS_TOKEN_STOKEN (token).length = i; + token.data.string.length = i; parser->lexer.stream = skip_spaces (ptr + i + 1); break; } @@ -2499,7 +2497,7 @@ parse_linespec (linespec_parser *parser, const char *arg, linespec_token token = linespec_lexer_consume_token (parser); /* It must be either LSTOKEN_STRING or LSTOKEN_NUMBER. */ - if (token.type == LSTOKEN_STRING && *LS_TOKEN_STOKEN (token).ptr == '$') + if (token.type == LSTOKEN_STRING && *token.data.string.ptr == '$') { /* A NULL entry means to use GLOBAL_DEFAULT_SYMTAB. */ if (parser->completion_tracker == NULL) -- 2.44.0