+/* Add functions or file names to a vector of names to exclude from
+ instrumentation. */
+
+static void
+add_instrument_functions_exclude_list (VEC(char_p,heap) **pvec,
+ const char* arg)
+{
+ char *tmp;
+ char *r;
+ char *w;
+ char *token_start;
+
+ /* We never free this string. */
+ tmp = xstrdup (arg);
+
+ r = tmp;
+ w = tmp;
+ token_start = tmp;
+
+ while (*r != '\0')
+ {
+ if (*r == ',')
+ {
+ *w++ = '\0';
+ ++r;
+ VEC_safe_push (char_p, heap, *pvec, token_start);
+ token_start = w;
+ }
+ if (*r == '\\' && r[1] == ',')
+ {
+ *w++ = ',';
+ r += 2;
+ }
+ else
+ *w++ = *r++;
+ }
+ if (*token_start != '\0')
+ VEC_safe_push (char_p, heap, *pvec, token_start);
+}
+
+/* Return whether we should exclude FNDECL from instrumentation. */
+
+bool
+flag_instrument_functions_exclude_p (tree fndecl)
+{
+ if (VEC_length (char_p, flag_instrument_functions_exclude_functions) > 0)
+ {
+ const char *name;
+ int i;
+ char *s;
+
+ name = lang_hooks.decl_printable_name (fndecl, 0);
+ for (i = 0;
+ VEC_iterate (char_p, flag_instrument_functions_exclude_functions,
+ i, s);
+ ++i)
+ {
+ if (strstr (name, s) != NULL)
+ return true;
+ }
+ }
+
+ if (VEC_length (char_p, flag_instrument_functions_exclude_files) > 0)
+ {
+ const char *name;
+ int i;
+ char *s;
+
+ name = DECL_SOURCE_FILE (fndecl);
+ for (i = 0;
+ VEC_iterate (char_p, flag_instrument_functions_exclude_files, i, s);
+ ++i)
+ {
+ if (strstr (name, s) != NULL)
+ return true;
+ }
+ }
+
+ return false;
+}
+