Commit 2a7108b9 by Martin Liska Committed by Martin Liska

Fix multiple values for -fdbg-cnt.

2019-03-29  Martin Liska  <mliska@suse.cz>

	* dbgcnt.c (dbg_cnt_process_single_pair): Fix GNU coding style.
	(dbg_cnt_process_opt): Parse first tokens aas
	dbg_cnt_process_single_pair is also using strtok.

From-SVN: r270014
parent a6240447
2019-03-29 Martin Liska <mliska@suse.cz>
* dbgcnt.c (dbg_cnt_process_single_pair): Fix GNU coding style.
(dbg_cnt_process_opt): Parse first tokens aas
dbg_cnt_process_single_pair is also using strtok.
2019-03-29 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/87485
......
......@@ -151,30 +151,35 @@ dbg_cnt_process_single_pair (const char *arg)
high = strtol (value2, NULL, 10);
}
return dbg_cnt_set_limit_by_name (name, low, high);
return dbg_cnt_set_limit_by_name (name, low, high);
}
void
dbg_cnt_process_opt (const char *arg)
{
char *str = xstrdup (arg);
const char *next = strtok (str, ",");
unsigned int start = 0;
do {
if (!dbg_cnt_process_single_pair (arg))
auto_vec<const char *> tokens;
for (const char *next = strtok (str, ","); next != NULL;
next = strtok (NULL, ","))
tokens.safe_push (next);
unsigned i;
for (i = 0; i < tokens.length (); i++)
{
if (!dbg_cnt_process_single_pair (tokens[i]))
break;
start += strlen (arg) + 1;
next = strtok (NULL, ",");
} while (next != NULL);
start += strlen (tokens[i]) + 1;
}
if (next != NULL)
if (i != tokens.length ())
{
char *buffer = XALLOCAVEC (char, start + 2);
sprintf (buffer, "%*c", start + 1, '^');
error ("cannot find a valid counter:value pair:");
error ("%<-fdbg-cnt=%s%>", next);
error (" %s", buffer);
error ("%<-fdbg-cnt=%s%>", arg);
error (" %s", buffer);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment