From patchwork Fri Jun 28 13:17:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 93015 Return-Path: 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 DB06E3826DD6 for ; Fri, 28 Jun 2024 13:18:26 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id 71F8D3826DCB for ; Fri, 28 Jun 2024 13:17:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 71F8D3826DCB 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 71F8D3826DCB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::329 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719580678; cv=none; b=IWZyQ/ZwijmN61FiGn0q1I3UWdHb6twuDj/czGXF8uTyKq9RJTCa1qQ08jIfwNy25CohxBA0qJJ+emJ7NYanU2IkawOWScK+KccQVRjRcsJGIhVfB0KPB1Tif+0xbFT1nNTwWzIoUAIT1AZcS4xlITTRdgUdzUkI/LATxl784LY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719580678; c=relaxed/simple; bh=yG5tY0nNej2azdzmylOXKqnKIZVVYzlZcXzwc/loX/g=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=Fpgw9QMoauRFa9KQaTTtkahz+KxYFTt+rEZ7cwDe7MRDxKWTRJCnf1q4TamxONXf9mckk/cZFFfU5/4Z7NpKsNKRyM3pWaTfMYWB3ibc0Xl8O/ALM6+AXvRLnc4008+XRt/rVYHMs7U04fI4puNeFhK8Vf9F//IsZji5t7ylZFY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-42565697036so10674185e9.1 for ; Fri, 28 Jun 2024 06:17:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1719580675; x=1720185475; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:to:from:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=v3fWSDthqqmubudcwSvSxe/FyqP1P/kEuVAl4U9UNLU=; b=SZdkSzBBpz2yfAZ2Zvo/3l0hT1gxVlcNIJU9mIpfYY9Ss1UMgz/o1NpR3n0j8Wwe+I BlGDhE9MvoYc04h1ha4Vmmq8SknWJE1slfjBc6zXWLGSoRyb9r5mN+NoKhaS5UAo8MZq yyARDu0s91lUxPRaEI8nRZr7E3XdctKM35soALoi4H8r0AExB03Jwirr8BnQOENtyOi1 nBa6qpfLWR8Uv0XoDCmtPG0qzE8nyE/GsqgpW+EwRjTi7HT2lWLT/w3CYVojUkx4hyk+ Dbq/Um7/fffJanPLQRXzp+Tj5X2yypykfLOw1rdJozVZCu/9+2FC/WsJq+yA7FicKaUw DdVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719580675; x=1720185475; h=content-transfer-encoding:in-reply-to:autocrypt: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=v3fWSDthqqmubudcwSvSxe/FyqP1P/kEuVAl4U9UNLU=; b=JBY01ZY2pkG9ztI2yScGci9ptPqIGoA7ojMYeAl5/ALT2300Pqu0JN/6fLzBDlAneR phdZNhSaSzId26ffGYbdfuZBvUJlceh5exmirT5MU5k5zmF+jyx+a+UwvlpqNn3RGpEl 5IzJkrHa8C8W21fLbT+sTIb1VVgoLclyFl5rHvPxYuVty1P+tYAngPvaUiNthFXK6gsx yoqOXwZrho2XGmQ8RBibOvR3KNwAPuA3wrKExp/p4F+BE5x7NgLg5FqF0blPAtbT+Nb+ ApC9WbZlbbOW8QS1lp2bOGi6g2gkKZ5TcnHaNHH57b8LSqWvCyfMHW+US3E4Hs1OH2iJ zKzQ== X-Gm-Message-State: AOJu0YyxgbrXX6kbsrySHtSLSvan57hhvyTMBopXbkXSqycQ1VMtvAbH 6T+5Sl72xsA4Ca9petWzjF+ACDLz7nEW3frqtU1PxZAXXkys/johVpmONFCdetRIUvm6alw6clk = X-Google-Smtp-Source: AGHT+IHPlYsxmWGEn7Aa9zWoZvL/iPrsRDUqrpbkR4p+fT7TbHsfrv2d3MXu7XFqwZ4e21sgNxqWwA== X-Received: by 2002:a5d:64ea:0:b0:366:ea4a:17ec with SMTP id ffacd0b85a97d-3676096eb0emr2086292f8f.2.1719580675056; Fri, 28 Jun 2024 06:17:55 -0700 (PDT) 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 d2e1a72fcca58-70803ecf89dsm1536866b3a.121.2024.06.28.06.17.53 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Jun 2024 06:17:54 -0700 (PDT) Message-ID: <9ade1ea8-3ea5-4015-8efe-192406d30c6b@suse.com> Date: Fri, 28 Jun 2024 15:17:49 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 02/11] gas: drop scrubber state -2 From: Jan Beulich To: Binutils References: Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQ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V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: X-Spam-Status: No, score=-3024.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org Instead re-use code handling LEX_IS_TWOCHAR_COMMENT_1ST, thus ensuring that we wouldn't get bogus state transitions: For example, when we're in states 0 or 1, a comment should be no different from whitespace encountered in those states. Plus for e.g. x86 this results in such comments now truly being converted to a blank, as mandated by documentation. Both aspects apparently were a result of blindly (and wrongly) moving to state 3 _before_ consuming the "ungot" blank. Also amend a related comment elsewhere. In the new testcase the .irp is to make visible in the listing all the whitespace that the scrubber inserts / leaves in place. --- a/gas/app.c +++ b/gas/app.c @@ -172,7 +172,8 @@ do_scrub_begin (int m68k_mri ATTRIBUTE_U lex[(unsigned char) *p] = LEX_IS_PARALLEL_SEPARATOR; #endif - /* Only allow slash-star comments if slash is not in use. + /* Only allow slash-star comments if slash is not in use. Certain + other cases are dealt with in LEX_IS_LINE_COMMENT_START handling. FIXME: This isn't right. We should always permit them. */ if (lex['/'] == 0) lex['/'] = LEX_IS_TWOCHAR_COMMENT_1ST; @@ -435,7 +436,6 @@ do_scrub_chars (size_t (*get) (char *, s 10: After seeing whitespace in state 9 (keep white before symchar) 11: After seeing a symbol character in state 0 (eg a label definition) -1: output string in out_string and go to the state in old_state - -2: flush text until a '*' '/' is seen, then go to state old_state 12: no longer used #ifdef DOUBLEBAR_PARALLEL 13: After seeing a vertical bar, looking for a second @@ -538,43 +538,6 @@ do_scrub_chars (size_t (*get) (char *, s PUT (ch); continue; - case -2: - for (;;) - { - do - { - ch = GET (); - - if (ch == EOF) - { - as_warn (_("end of file in comment")); - goto fromeof; - } - - if (ch == '\n') - PUT ('\n'); - } - while (ch != '*'); - - while ((ch = GET ()) == '*') - ; - - if (ch == EOF) - { - as_warn (_("end of file in comment")); - goto fromeof; - } - - if (ch == '/') - break; - - UNGET (ch); - } - - state = old_state; - UNGET (' '); - continue; - case 4: ch = GET (); if (ch == EOF) @@ -1031,6 +994,7 @@ do_scrub_chars (size_t (*get) (char *, s ch2 = GET (); if (ch2 == '*') { + twochar_comment: for (;;) { do @@ -1245,15 +1209,9 @@ do_scrub_chars (size_t (*get) (char *, s { ch2 = GET (); if (ch2 == '*') - { - old_state = 3; - state = -2; - break; - } - else if (ch2 != EOF) - { - UNGET (ch2); - } + goto twochar_comment; + if (ch2 != EOF) + UNGET (ch2); } if (state == 0 || state == 1) /* Only comment at start of line. */ --- /dev/null +++ b/gas/testsuite/gas/i386/comments.l @@ -0,0 +1,30 @@ +.*: Assembler messages: +.*:6: Error: .* +.*:7: Error: .* +[ ]*[0-9]+[ ]+scrubber: +[ ]*[0-9]+[ ]+\.irp x,"" +[ ]*[0-9]+[ ]* +[ ]*[0-9]+[ ]+/\* \*/vaddps %zmm0, %zmm1, %zmm2 +[ ]*[0-9]+[ ]+vaddps/\*\*/%zmm0, %zmm1, %zmm2 +[ ]*[0-9]+[ ]+vadd/\*\*/ps %zmm0, %zmm1, %zmm2 +[ ]*[0-9]+[ ]+vaddps %zmm/\*\*/0, %zmm1, %zmm2 +[ ]*[0-9]+[ ]* +[ ]*[0-9]+[ ]+vaddps %zmm0, %zmm1, %zmm2# ... +[ ]*[0-9]+[ ]+vaddps %zmm0, %zmm1, %zmm2 # ... +[ ]*[0-9]+[ ]+vaddps %zmm0, %zmm1, %zmm2/\* \*/# ... +[ ]*[0-9]+[ ]* +[ ]*[0-9]+[ ]+\.endr +[ ]*[0-9]+[ ]+> + +[ ]*[0-9]+ \?\?\?\? [0-9A-F]+[ ]+> vaddps %zmm0,%zmm1,%zmm2 +#... +[ ]*[0-9]+ \?\?\?\? [0-9A-F]+[ ]+> vaddps %zmm0,%zmm1,%zmm2 +#... +[ ]*[0-9]+[ ]+> vadd ps %zmm0,%zmm1,%zmm2 +[ ]*[0-9]+[ ]+> vaddps %zmm 0,%zmm1,%zmm2 +[ ]*[0-9]+[ ]+> + +[ ]*[0-9]+ \?\?\?\? [0-9A-F]+[ ]+> vaddps %zmm0,%zmm1,%zmm2 +#... +[ ]*[0-9]+ \?\?\?\? [0-9A-F]+[ ]+> vaddps %zmm0,%zmm1,%zmm2 +#... +[ ]*[0-9]+ \?\?\?\? [0-9A-F]+[ ]+> vaddps %zmm0,%zmm1,%zmm2 +#pass --- /dev/null +++ b/gas/testsuite/gas/i386/comments.s @@ -0,0 +1,13 @@ +scrubber: + .irp x,"" + +/* */vaddps %zmm0, %zmm1, %zmm2 + vaddps/**/%zmm0, %zmm1, %zmm2 + vadd/**/ps %zmm0, %zmm1, %zmm2 + vaddps %zmm/**/0, %zmm1, %zmm2 + + vaddps %zmm0, %zmm1, %zmm2# ... + vaddps %zmm0, %zmm1, %zmm2 # ... + vaddps %zmm0, %zmm1, %zmm2/* */# ... + + .endr --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -105,6 +105,7 @@ if [gas_32_check] then { run_dump_test "equ" run_list_test "equ-2" "-al" run_list_test "equ-bad" + run_list_test "comments" "-almn" run_dump_test "divide" run_dump_test "quoted" run_dump_test "quoted2"