Message ID | 05db5eb8-6467-4d91-bd9a-0315859ae494@suse.com |
---|---|
State | New |
Headers |
Return-Path: <binutils-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2FCD83857C6C for <patchwork@sourceware.org>; Mon, 27 Jan 2025 16:18:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2FCD83857C6C Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=As3Nlf0i X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by sourceware.org (Postfix) with ESMTPS id 1FB673858290 for <binutils@sourceware.org>; Mon, 27 Jan 2025 16:08:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1FB673858290 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1FB673858290 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::636 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1737994101; cv=none; b=tFmxovUbDAibQ7cxjOpVI/vJ14sCd+XvPBoaFzRXrb4GM2B1wH+iG1toerxYS9vKjxZ7ObmX8VsBPmazT6UvQoK+F9kzUlQqiCPl33YsAep4kHQcQfCMgHyB0b07XWuMSc3E3YlnsDju8JG2Sz1Er2ZfHne7OjEe4VLcyEww+Yc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1737994101; c=relaxed/simple; bh=7JgSnIg89NEFC8TmEqEzAf7HNh38aJFopubn3qtCthQ=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=vRHrq1Mm+mpiG4srlIa7+6lnnd/V7hqQ1npgpNcDKQrnM1AA+GKq1VSGHrQMDzsIygjaIrsFC1r+6FV0XUrweWJz8w+Q/jsKU7O2bGDz4Yzv6bogCatK5krVbkWVAOWnTmZwJYqDQWgbcmSRmT3zHIF155vak66TfUh1Ah4n2S8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1FB673858290 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-aaee0b309adso643481566b.3 for <binutils@sourceware.org>; Mon, 27 Jan 2025 08:08:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1737994100; x=1738598900; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:cc:content-language :references:to:from:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=+UrmoBMiqcBbH13nDnKbyTMbKWxt7BUhE8Vnld0+5Wc=; b=As3Nlf0iXVMI8kd32HgYp2BtPfehRWOzOaXoU40ryuLcvbVPE0gh0qkJnK9AGiY887 g4kfCmBLYI80rVwZkCQFSqNbyf3yxaS/xVH6HltU76T2AmC616zBGJSzdA2QWiPaQRkJ B5N+xQejxnQFUktlxPvaNC+XW0ycjv6BviaKNOVmzrcTmXC7ACztgCnBFbgttFa9XgwV i7oiS7JeM5iGB7Af7Q+kmpvoR3UZ8//R07dWCoipT/balOWWwE2rED7dfYb4w98bLMuo B7TXk4NiSm8kcufn5076gaWYI2qzTs7JRZIsghCMOJneBIK5qvqugnkWhNyXgMNFbp2+ vQZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737994100; x=1738598900; h=content-transfer-encoding:in-reply-to:autocrypt:cc:content-language :references:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+UrmoBMiqcBbH13nDnKbyTMbKWxt7BUhE8Vnld0+5Wc=; b=hEK1WnhRdqJsd+GXfIxrN1cq4dNtAmR1cTE/WVUNgzcXd6pyQ0m3Dc+yUJwP0vRdNN QNcwgCUvRu51cvCpMo9ZL7PuiqalmkKkHMMX3Zgty671/4SZiQxlHHIV5/DalydpzsaT pFOu9QqOmI5GRyvo7GiK6WmdxcO9benz6CAOMAP7hdsL/AITNO1/hCdaISHVamDxosCJ /G8PANjlXqDr6W+lEO7Tcgk33HkCEhPQtF4+EVxiArIdYQjeDq4ccAuyRSiQypGKx4+q Eo+yYd6aUcf9duAPWEJQN2sJF23Cp9bzUUBkUt4pAwj1Xn6RRwtQa0y3iCqKiEYhd1vs y2hA== X-Gm-Message-State: AOJu0Yz2Hes/wmVbOJv2IngiwtkSJI9lm1+x6aiA09qxZGbfBe6fbylr BuI3Gh2zAGYHxhJ0QXkmug7uSE8XYef2GDZEYy/REmgoY95B9BtDDXFRtphC07fbtIxan968nvw = X-Gm-Gg: ASbGncuZxgLX5T15JQfZI8J7x1hKvUTkVo4vIedJ3J5My2zi801X84/JymAYxWDTjCR dFhG7Xsg1qzGwvEbF1n6pW/Qoz/y0YrxIz+m6p6Li39I0RkxKwJokdKna+3P/K9v8wEgBvGopKq iqye39Oz4A30wqhTJ6gByNvqMqSWG4g3zcAONPHkID3HN9/yhT3+depRH6aA95gIj+9LI9Gy3lT 2NlqUyOpP1wb/nWDLg45ieYxe7pxNpwqZGwZqQChZitDfTiDU4kQVHaoEaTAEYiZQjvsXNMnWXW +sGPrYAmTOV5NfQL/YV4+jzZg8Ziag1BTOJy20/dBTSJQXUb2mhCYhZcSNVO6HX0LQ== X-Google-Smtp-Source: AGHT+IERRjVGkO6pSzJfMM/uz7JlnJsSD5bVR9OTDdIOaPQwXe1+Vcd5XslJ4OU4hm4s7JZdwhwK0Q== X-Received: by 2002:a17:907:7eaa:b0:ab3:398c:c989 with SMTP id a640c23a62f3a-ab38ada1546mr4437509966b.0.1737994099668; Mon, 27 Jan 2025 08:08:19 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab69f1381cdsm253112366b.124.2025.01.27.08.08.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Jan 2025 08:08:19 -0800 (PST) Message-ID: <05db5eb8-6467-4d91-bd9a-0315859ae494@suse.com> Date: Mon, 27 Jan 2025 17:08:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v2 09/65] bpf: use is_whitespace() From: Jan Beulich <jbeulich@suse.com> To: Binutils <binutils@sourceware.org> References: <2316ac5c-7870-4b46-9c80-eaecaef93a31@suse.com> Content-Language: en-US Cc: Jose Marchesi <jose.marchesi@oracle.com> Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <2316ac5c-7870-4b46-9c80-eaecaef93a31@suse.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3022.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, 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 X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org |
Series |
gas: whitespace handling
|
|
Commit Message
Jan Beulich
Jan. 27, 2025, 4:08 p.m. UTC
Wherever blanks are permissible in input, tabs ought to be permissible, too. This is particularly relevant when -f is passed to gas (alongside appropriate input). At the same time use is_end_of_stmt() instead of open-coded nul char checks. --- v2: New.
Comments
On Mon, Jan 27, 2025 at 05:08:18PM +0100, Jan Beulich wrote: > Wherever blanks are permissible in input, tabs ought to be permissible, > too. This is particularly relevant when -f is passed to gas (alongside > appropriate input). At the same time use is_end_of_stmt() instead of > open-coded nul char checks. > --- > v2: New. > > --- a/gas/config/tc-bpf.c > +++ b/gas/config/tc-bpf.c > @@ -1274,7 +1274,7 @@ parse_expression (char *s, expressionS * > these whitespaces. */ > { > char *p; > - for (p = s - 1; p >= saved_s && *p == ' '; --p) > + for (p = s - 1; p >= saved_s && is_whitespace (*p); --p) > --s; > } > > @@ -1501,7 +1501,7 @@ md_assemble (char *str ATTRIBUTE_UNUSED) > if (*p == ' ') > { > /* Expect zero or more spaces. */ > - while (*s != '\0' && (*s == ' ' || *s == '\t')) > + while (!is_end_of_stmt (*s) && is_whitespace (*s)) Just is_whitespace here. > s += 1; > p += 1; > } > @@ -1520,20 +1520,20 @@ md_assemble (char *str ATTRIBUTE_UNUSED) > else if (*(p + 1) == 'w') > { > /* Expect zero or more spaces. */ > - while (*s != '\0' && (*s == ' ' || *s == '\t')) > + while (!is_end_of_stmt (*s) && is_whitespace (*s)) Same. > s += 1; > p += 2; > } > else if (*(p + 1) == 'W') > { > /* Expect one or more spaces. */ > - if (*s != ' ' && *s != '\t') > + if (!is_whitespace (*s)) > { > PARSE_ERROR ("expected white space, got '%s'", > s); > break; > } > - while (*s != '\0' && (*s == ' ' || *s == '\t')) > + while (!is_end_of_stmt (*s) && is_whitespace (*s)) Same. > s += 1; > p += 2; > } > @@ -1620,7 +1620,7 @@ md_assemble (char *str ATTRIBUTE_UNUSED) > > if (p[1] == 'I') > { > - while (*s == ' ' || *s == '\t') > + while (is_whitespace (*s)) > s += 1; > if (*s != '+' && *s != '-') > { > @@ -1643,7 +1643,7 @@ md_assemble (char *str ATTRIBUTE_UNUSED) > { > char *exp = NULL; > > - while (*s == ' ' || *s == '\t') > + while (is_whitespace (*s)) > s += 1; > if (*s != '+' && *s != '-') > { > @@ -1735,9 +1735,9 @@ md_assemble (char *str ATTRIBUTE_UNUSED) > if (*p == '\0') > { > /* Allow white spaces at the end of the line. */ > - while (*s != '\0' && (*s == ' ' || *s == '\t')) > + while (!is_end_of_stmt (*s) && is_whitespace (*s)) Again. > s += 1; > - if (*s == '\0') > + if (is_end_of_stmt (*s)) > /* We parsed an instruction successfully. */ > break; > PARSE_ERROR ("extra junk at end of line");
On 28.01.2025 10:21, Alan Modra wrote: > On Mon, Jan 27, 2025 at 05:08:18PM +0100, Jan Beulich wrote: >> Wherever blanks are permissible in input, tabs ought to be permissible, >> too. This is particularly relevant when -f is passed to gas (alongside >> appropriate input). At the same time use is_end_of_stmt() instead of >> open-coded nul char checks. >> --- >> v2: New. >> >> --- a/gas/config/tc-bpf.c >> +++ b/gas/config/tc-bpf.c >> @@ -1274,7 +1274,7 @@ parse_expression (char *s, expressionS * >> these whitespaces. */ >> { >> char *p; >> - for (p = s - 1; p >= saved_s && *p == ' '; --p) >> + for (p = s - 1; p >= saved_s && is_whitespace (*p); --p) >> --s; >> } >> >> @@ -1501,7 +1501,7 @@ md_assemble (char *str ATTRIBUTE_UNUSED) >> if (*p == ' ') >> { >> /* Expect zero or more spaces. */ >> - while (*s != '\0' && (*s == ' ' || *s == '\t')) >> + while (!is_end_of_stmt (*s) && is_whitespace (*s)) > > Just is_whitespace here. Oh, yes. In later patches I did that, but then forgot to check back in earlier ones. Thanks for noticing. Jan
--- a/gas/config/tc-bpf.c +++ b/gas/config/tc-bpf.c @@ -1274,7 +1274,7 @@ parse_expression (char *s, expressionS * these whitespaces. */ { char *p; - for (p = s - 1; p >= saved_s && *p == ' '; --p) + for (p = s - 1; p >= saved_s && is_whitespace (*p); --p) --s; } @@ -1501,7 +1501,7 @@ md_assemble (char *str ATTRIBUTE_UNUSED) if (*p == ' ') { /* Expect zero or more spaces. */ - while (*s != '\0' && (*s == ' ' || *s == '\t')) + while (!is_end_of_stmt (*s) && is_whitespace (*s)) s += 1; p += 1; } @@ -1520,20 +1520,20 @@ md_assemble (char *str ATTRIBUTE_UNUSED) else if (*(p + 1) == 'w') { /* Expect zero or more spaces. */ - while (*s != '\0' && (*s == ' ' || *s == '\t')) + while (!is_end_of_stmt (*s) && is_whitespace (*s)) s += 1; p += 2; } else if (*(p + 1) == 'W') { /* Expect one or more spaces. */ - if (*s != ' ' && *s != '\t') + if (!is_whitespace (*s)) { PARSE_ERROR ("expected white space, got '%s'", s); break; } - while (*s != '\0' && (*s == ' ' || *s == '\t')) + while (!is_end_of_stmt (*s) && is_whitespace (*s)) s += 1; p += 2; } @@ -1620,7 +1620,7 @@ md_assemble (char *str ATTRIBUTE_UNUSED) if (p[1] == 'I') { - while (*s == ' ' || *s == '\t') + while (is_whitespace (*s)) s += 1; if (*s != '+' && *s != '-') { @@ -1643,7 +1643,7 @@ md_assemble (char *str ATTRIBUTE_UNUSED) { char *exp = NULL; - while (*s == ' ' || *s == '\t') + while (is_whitespace (*s)) s += 1; if (*s != '+' && *s != '-') { @@ -1735,9 +1735,9 @@ md_assemble (char *str ATTRIBUTE_UNUSED) if (*p == '\0') { /* Allow white spaces at the end of the line. */ - while (*s != '\0' && (*s == ' ' || *s == '\t')) + while (!is_end_of_stmt (*s) && is_whitespace (*s)) s += 1; - if (*s == '\0') + if (is_end_of_stmt (*s)) /* We parsed an instruction successfully. */ break; PARSE_ERROR ("extra junk at end of line");