summaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authorgdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-06 18:43:35 +0000
committergdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-06 18:43:35 +0000
commit08b0e1fc2e7facbe104bef054f4d1fb5b613cc20 (patch)
tree16f3efac73c54ac9d4bfcc86c3e390ff99b00405 /gcc/diagnostic.c
parentd4edf2cf934bf787fca0ca200143a1a64b92b732 (diff)
downloadgcc-08b0e1fc2e7facbe104bef054f4d1fb5b613cc20.tar.gz
* toplev.c (display_help): Fix thinko in documentation.
* diagnostic.h (output_buffer::indent_skip): New fields. (output_indentation): New macro. * diagnostic.c (output_indent): New function. (output_set_prefix, clear_diagnostic_info): Use. (output_emit_prefix): Predict future indentation. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36205 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 075f439a0e2..afb25c1ef3b 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -67,6 +67,7 @@ static void output_do_verbatim PARAMS ((output_buffer *,
const char *, va_list *));
static void output_to_stream PARAMS ((output_buffer *, FILE *));
static void output_format PARAMS ((output_buffer *));
+static void output_indent PARAMS ((output_buffer *));
static char *vbuild_message_string PARAMS ((const char *, va_list));
static char *build_message_string PARAMS ((const char *, ...))
@@ -267,6 +268,7 @@ output_set_prefix (buffer, prefix)
output_prefix (buffer) = prefix;
set_real_maximum_length (buffer);
prefix_was_emitted_for (buffer) = 0;
+ output_indentation (buffer) = 0;
}
/* Free BUFFER's prefix, a previously malloc'd string. */
@@ -301,6 +303,7 @@ clear_diagnostic_info (buffer)
output_buffer_text_cursor (buffer) = NULL;
output_buffer_ptr_to_format_args (buffer) = NULL;
prefix_was_emitted_for (buffer) = 0;
+ output_indentation (buffer) = 0;
}
/* Construct an output BUFFER with PREFIX and of MAXIMUM_LENGTH
@@ -395,8 +398,12 @@ output_emit_prefix (buffer)
case DIAGNOSTICS_SHOW_PREFIX_ONCE:
if (prefix_was_emitted_for (buffer))
- break;
- /* Else fall through. */
+ {
+ output_indent (buffer);
+ break;
+ }
+ output_indentation (buffer) += 3;
+ /* Fall through. */
case DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE:
{
@@ -549,6 +556,17 @@ output_append (buffer, start, end)
output_append_r (buffer, start, end - start);
}
+static void
+output_indent (buffer)
+ output_buffer *buffer;
+{
+ int n = output_indentation (buffer);
+ int i;
+
+ for (i = 0; i < n; ++i)
+ output_add_character (buffer, ' ');
+}
+
/* Wrap a text delimited by START and END into BUFFER. */
static void