public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] gen-pass-instances.awk: Make print command clearer in handle_line
@ 2015-11-12  8:37 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2015-11-12  8:37 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 258 bytes --]

Hi,

this patch modifies the prefix and postfix expressions in handle_line 
gen-pass-instances.awk, such that the printf command now lists all the 
NEXT_PASS call arguments, and surrounds them with parentheses.

Committed to trunk as trivial.

Thanks,
- Tom

[-- Attachment #2: 0009-gen-pass-instances.awk-Make-print-command-clearer-in-handle_line.patch --]
[-- Type: text/x-patch, Size: 1663 bytes --]

gen-pass-instances.awk: Make print command clearer in handle_line

2015-11-11  Tom de Vries  <tom@codesourcery.com>

	* gen-pass-instances.awk (handle_line): Print parentheses and pass_name
	explicitly.

---
 gcc/gen-pass-instances.awk | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/gcc/gen-pass-instances.awk b/gcc/gen-pass-instances.awk
index 1aced74..b10c26a 100644
--- a/gcc/gen-pass-instances.awk
+++ b/gcc/gen-pass-instances.awk
@@ -54,6 +54,7 @@ function handle_line()
 	len_of_call = RLENGTH;
 
 	len_of_start = length("NEXT_PASS (");
+	len_of_open = length("(");
 	len_of_close = length(")");
 
 	# Find pass_name argument
@@ -61,11 +62,13 @@ function handle_line()
 	pass_starts_at = where + len_of_start;
 	pass_name = substr(line, pass_starts_at, len_of_pass_name);
 
-	# Find prefix (until and including pass_name)
-	prefix = substr(line, 1, pass_starts_at + len_of_pass_name - 1)
+	# Find call expression prefix (until and including called function)
+	prefix_len = pass_starts_at - 1 - len_of_open;
+	prefix = substr(line, 1, prefix_len);
 
-	# Find postfix (after pass_name)
-	postfix = substr(line, pass_starts_at + len_of_pass_name)
+	# Find call expression postfix
+	postfix_starts_at = pass_starts_at + len_of_pass_name + len_of_close;
+	postfix = substr(line, postfix_starts_at);
 
 	# Set pass_counts
 	if (pass_name in pass_counts)
@@ -76,7 +79,7 @@ function handle_line()
 	pass_num = pass_counts[pass_name];
 
 	# Print call expression with extra pass_num argument
-	printf "%s, %s%s\n", prefix, pass_num, postfix;
+	printf "%s(%s, %s)%s\n", prefix, pass_name, pass_num, postfix;
 }
 
 { handle_line() }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-12  8:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-12  8:37 [committed] gen-pass-instances.awk: Make print command clearer in handle_line Tom de Vries

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).