}
}
+/* Format EXPR if nonnull and return the formatted string. If EXPR is
+ null return DFLT. */
+
+static inline const char*
+expr_to_str (pretty_printer &pp, tree expr, const char *dflt)
+{
+ if (!expr)
+ return dflt;
+
+ dump_generic_node (&pp, expr, 0, TDF_VOPS | TDF_MEMSYMS, false);
+ return pp_formatted_text (&pp);
+}
+
/* Detect and diagnose a mismatch between an attribute access specification
on the original declaration of FNDECL and that on the parameters NEWPARMS
from its refeclaration. ORIGLOC is the location of the first declaration
the same. */
continue;
- const char* const newbndstr =
- newbnd ? print_generic_expr_to_str (newbnd) : "*";
- const char* const curbndstr =
- curbnd ? print_generic_expr_to_str (curbnd) : "*";
+ pretty_printer pp1, pp2;
+ const char* const newbndstr = expr_to_str (pp1, newbnd, "*");
+ const char* const curbndstr = expr_to_str (pp2, curbnd, "*");
if (!newpos != !curpos
|| (newpos && !tree_int_cst_equal (newpos, curpos)))
pp_flush (tree_pp);
}
-/* Print a single expression T to string, and return it. */
+/* Print a single expression T to string, and return it. The caller
+ must free the returned memory. */
char *
print_generic_expr_to_str (tree t)