public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] testsuite: Handle empty assembly lines in check-function-bodies
@ 2023-04-28 15:58 Hans-Peter Nilsson
  2023-04-28 22:49 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Hans-Peter Nilsson @ 2023-04-28 15:58 UTC (permalink / raw)
  To: gcc-patches

Ok to commit?
-- >8 --
I tried to make use of check-function-bodies for cris-elf and was a
bit surprised to see it failing.  There's a deliberate empty line
after the filled delay slot of the return-function which was
mishandled.  I thought "aha" and tried to add an empty line
(containing just a "**" prefix) to the match, but that didn't help.
While it was added as input from the function's assembly output
to-be-matched like any other line, it couldn't be matched: I had to
use "...", which works but is...distracting.

Some digging shows that an empty assembly line can't be deliberately
matched because all matcher lines (lines starting with the prefix,
the ubiquitous "**") are canonicalized by trimming leading
whitespace (the "string trim" in check-function-bodies) and instead
adding a leading TAB character, thus empty lines end up containing
just a TAB.  For usability it's better to treat empty lines as fluff
than to uglifying the test-case and the code to properly match them.
Double-checking, no test-case tries to match an line containing just
TAB (by providing an a line containing just "**\s*", i.e. zero or
more whitespace characters).

	* lib/scanasm.exp (parse_function_bodies): Set fluff to include
	empty lines (besides optionally leading whitespace).
---
 gcc/testsuite/lib/scanasm.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp
index fb53544d40c7..be2b83a5dd48 100644
--- a/gcc/testsuite/lib/scanasm.exp
+++ b/gcc/testsuite/lib/scanasm.exp
@@ -791,7 +791,7 @@ proc parse_function_bodies { filename result } {
     set terminator {^\s*\.size}
 
     # Regexp for lines that aren't interesting.
-    set fluff {^\s*(?:\.|//|@)}
+    set fluff {^\s*(?:\.|//|@|$)}
 
     set fd [open $filename r]
     set in_function 0
-- 
2.30.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] testsuite: Handle empty assembly lines in check-function-bodies
  2023-04-28 15:58 [PATCH] testsuite: Handle empty assembly lines in check-function-bodies Hans-Peter Nilsson
@ 2023-04-28 22:49 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2023-04-28 22:49 UTC (permalink / raw)
  To: Hans-Peter Nilsson, gcc-patches



On 4/28/23 09:58, Hans-Peter Nilsson via Gcc-patches wrote:
> Ok to commit?
> -- >8 --
> I tried to make use of check-function-bodies for cris-elf and was a
> bit surprised to see it failing.  There's a deliberate empty line
> after the filled delay slot of the return-function which was
> mishandled.  I thought "aha" and tried to add an empty line
> (containing just a "**" prefix) to the match, but that didn't help.
> While it was added as input from the function's assembly output
> to-be-matched like any other line, it couldn't be matched: I had to
> use "...", which works but is...distracting.
> 
> Some digging shows that an empty assembly line can't be deliberately
> matched because all matcher lines (lines starting with the prefix,
> the ubiquitous "**") are canonicalized by trimming leading
> whitespace (the "string trim" in check-function-bodies) and instead
> adding a leading TAB character, thus empty lines end up containing
> just a TAB.  For usability it's better to treat empty lines as fluff
> than to uglifying the test-case and the code to properly match them.
> Double-checking, no test-case tries to match an line containing just
> TAB (by providing an a line containing just "**\s*", i.e. zero or
> more whitespace characters).
> 
> 	* lib/scanasm.exp (parse_function_bodies): Set fluff to include
> 	empty lines (besides optionally leading whitespace).
OK
jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-28 22:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-28 15:58 [PATCH] testsuite: Handle empty assembly lines in check-function-bodies Hans-Peter Nilsson
2023-04-28 22:49 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).