]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
pretty-print.h (pp_newline_and_flush): Declare.
authorGabriel Dos Reis <gdr@integrable-solutions.net>
Fri, 23 Aug 2013 10:46:49 +0000 (10:46 +0000)
committerGabriel Dos Reis <gdr@gcc.gnu.org>
Fri, 23 Aug 2013 10:46:49 +0000 (10:46 +0000)
* pretty-print.h (pp_newline_and_flush): Declare.  Remove macro
definition.
(pp_newline_and_indent): Likewise.
(pp_separate_with): Likewise.
* pretty-print.c (pp_newline_and_flush): Define.
(pp_newline_and_indent): Likewise.
(pp_separate_with): Likewise.

From-SVN: r201940

gcc/ChangeLog
gcc/pretty-print.c
gcc/pretty-print.h

index a6624ede668ecb427ec70d4235e3d30808c0d88c..29a30ee2d933efe6f8172bf3901c18719cfd0592 100644 (file)
@@ -1,3 +1,13 @@
+2013-08-23  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+
+       * pretty-print.h (pp_newline_and_flush): Declare.  Remove macro
+       definition.
+       (pp_newline_and_indent): Likewise.
+       (pp_separate_with): Likewise.
+       * pretty-print.c (pp_newline_and_flush): Define.
+       (pp_newline_and_indent): Likewise.
+       (pp_separate_with): Likewise.
+
 2013-08-23  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/58218
index 2d2541048f8ef6956d2966c549cce7ee6d222046..a46545400f8bfe9290b010a05d42dd49ce3c4af4 100644 (file)
@@ -902,6 +902,37 @@ pp_maybe_space (pretty_printer *pp)
       pp->padding = pp_none;
     }
 }
+
+// Add a newline to the pretty printer PP and flush formatted text.
+
+void
+pp_newline_and_flush (pretty_printer *pp)
+{
+  pp_newline (pp);
+  pp_flush (pp);
+  pp_needs_newline (pp) = false;
+}
+
+// Add a newline to the pretty printer PP, followed by indentation.
+
+void
+pp_newline_and_indent (pretty_printer *pp, int n)
+{
+  pp_indentation (pp) += n;
+  pp_newline (pp);
+  pp_indent (pp);
+  pp_needs_newline (pp) = false;
+}
+
+// Add separator C, followed by a single whitespace.
+
+void
+pp_separate_with (pretty_printer *pp, char c)
+{
+  pp_character (pp, c);
+  pp_space (pp);
+}
+
 \f
 /* The string starting at P has LEN (at least 1) bytes left; if they
    start with a valid UTF-8 sequence, return the length of that
index 4c47e2b1a25c554da474c0ff46dfcab2bb160a2c..9b9b2cf29ff471973e6c177f95dbe75dc86bcade 100644 (file)
@@ -246,26 +246,8 @@ pp_get_prefix (const pretty_printer *pp) { return pp->prefix; }
 #define pp_backquote(PP)        pp_character (PP, '`')
 #define pp_doublequote(PP)      pp_character (PP, '"')
 #define pp_underscore(PP)       pp_character (PP, '_')
-#define pp_newline_and_flush(PP)     \
-  do {                               \
-    pp_newline (PP);                 \
-    pp_flush (PP);                   \
-    pp_needs_newline (PP) = false;   \
-  } while (0)
-#define pp_newline_and_indent(PP, N) \
-  do {                               \
-    pp_indentation (PP) += N;        \
-    pp_newline (PP);                 \
-    pp_indent (PP);                  \
-    pp_needs_newline (PP) = false;   \
-  } while (0)
 #define pp_maybe_newline_and_indent(PP, N) \
   if (pp_needs_newline (PP)) pp_newline_and_indent (PP, N)
-#define pp_separate_with(PP, C)     \
-   do {                             \
-     pp_character (PP, C);          \
-     pp_space (PP);                 \
-   } while (0)
 #define pp_scalar(PP, FORMAT, SCALAR)                        \
   do                                                         \
     {                                                        \
@@ -298,6 +280,9 @@ extern const char *pp_formatted_text (pretty_printer *);
 extern const char *pp_last_position_in_text (const pretty_printer *);
 extern void pp_emit_prefix (pretty_printer *);
 extern void pp_append_text (pretty_printer *, const char *, const char *);
+extern void pp_newline_and_flush (pretty_printer *);
+extern void pp_newline_and_indent (pretty_printer *, int);
+extern void pp_separate_with (pretty_printer *, char);
 
 /* If we haven't already defined a front-end-specific diagnostics
    style, use the generic one.  */