summaryrefslogtreecommitdiff
path: root/gcc/pretty-print.h
diff options
context:
space:
mode:
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2014-12-11 15:13:33 +0000
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2014-12-11 15:13:33 +0000
commit716da296ca061b7eae92924e6cec959133ce9b67 (patch)
tree6688e37de9262fa9b6efc826ef89c8b02ae776ba /gcc/pretty-print.h
parent85c1abe4be1cb2609b34e07158109d60e94b9803 (diff)
downloadgcc-716da296ca061b7eae92924e6cec959133ce9b67.tar.gz
gcc/ChangeLog:
2014-12-11 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * diagnostic.c (diagnostic_action_after_output): Make it extern. Take diagnostic_t argument instead of diagnostic_info. Count also DK_WERROR towards max_errors. (diagnostic_report_diagnostic): Update call according to the above. (error_recursion): Likewise. * diagnostic.h (diagnostic_action_after_output): Declare. * pretty-print.c (pp_formatted_text_data): Delete. (pp_append_r): Call output_buffer_append_r. (pp_formatted_text): Call output_buffer_formatted_text. (pp_last_position_in_text): Call output_buffer_last_position_in_text. * pretty-print.h (output_buffer_formatted_text): New. (output_buffer_append_r): New. (output_buffer_last_position_in_text): New. gcc/testsuite/ChangeLog: 2014-12-11 Manuel López-Ibáñez <manu@gcc.gnu.org> * gfortran.dg/do_iterator.f90: Remove bogus dg-warning. gcc/fortran/ChangeLog: 2014-12-11 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * error.c (pp_error_buffer): New static variable. (pp_warning_buffer): Make it a pointer. (gfc_output_buffer_empty_p): New. (gfc_error_init_1): Call gfc_buffer_error. (gfc_buffer_error): Do not use pp_warning_buffer.flush_p as the buffered_p flag. (gfc_clear_warning): Likewise. (gfc_warning_check): Call gfc_clear_warning. Only check the new pp_warning_buffer if the old warning_buffer was empty. Call diagnostic_action_after_output. (gfc_error_1): Renamed from gfc_error. (gfc_error): New. (gfc_clear_error): Clear also pp_error_buffer. (gfc_error_flag_test): Check also pp_error_buffer. (gfc_error_check): Likewise. Only check the new pp_error_buffer if the old error_buffer was empty. (gfc_move_output_buffer_from_to): New. (gfc_push_error): Use it here. Take also an output_buffer as argument. (gfc_pop_error): Likewise. (gfc_free_error): Likewise. (gfc_diagnostics_init): Use XNEW and placement-new to init pp_error_buffer and pp_warning_buffer. Set flush_p to false for both pp_warning_buffer and pp_error_buffer. * Update gfc_push_error, gfc_pop_error and gfc_free_error calls according to the above changes. * Use gfc_error_1 for all gfc_error calls that use multiple locations. * Use %qs instead of '%s' for many gfc_error calls. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218627 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/pretty-print.h')
-rw-r--r--gcc/pretty-print.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h
index d9e49be9928..3b72d597ec8 100644
--- a/gcc/pretty-print.h
+++ b/gcc/pretty-print.h
@@ -107,6 +107,38 @@ struct output_buffer
bool flush_p;
};
+/* Finishes constructing a NULL-terminated character string representing
+ the buffered text. */
+static inline const char *
+output_buffer_formatted_text (output_buffer *buff)
+{
+ obstack_1grow (buff->obstack, '\0');
+ return (const char *) obstack_base (buff->obstack);
+}
+
+/* Append to the output buffer a string specified by its
+ STARTing character and LENGTH. */
+static inline void
+output_buffer_append_r (output_buffer *buff, const char *start, int length)
+{
+ obstack_grow (buff->obstack, start, length);
+ buff->line_length += length;
+}
+
+/* Return a pointer to the last character emitted in the
+ output_buffer. A NULL pointer means no character available. */
+static inline const char *
+output_buffer_last_position_in_text (const output_buffer *buff)
+{
+ const char *p = NULL;
+ struct obstack *text = buff->obstack;
+
+ if (obstack_base (text) != obstack_next_free (text))
+ p = ((const char *) obstack_next_free (text)) - 1;
+ return p;
+}
+
+
/* The type of pretty-printer flags passed to clients. */
typedef unsigned int pp_flags;