diff options
author | gdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-09-06 18:43:35 +0000 |
---|---|---|
committer | gdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-09-06 18:43:35 +0000 |
commit | 08b0e1fc2e7facbe104bef054f4d1fb5b613cc20 (patch) | |
tree | 16f3efac73c54ac9d4bfcc86c3e390ff99b00405 | |
parent | d4edf2cf934bf787fca0ca200143a1a64b92b732 (diff) | |
download | gcc-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
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/diagnostic.c | 22 | ||||
-rw-r--r-- | gcc/diagnostic.h | 5 | ||||
-rw-r--r-- | gcc/toplev.c | 2 |
4 files changed, 37 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 953922e1dbb..bb11b06d0d7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2000-09-06 Gabriel Dos Reis <gdr@codesourcery.com> + + * 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. + 2000-09-06 DJ Delorie <dj@redhat.com> * Makefile.in (stage_*): add more dependencies to ensure parallel 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 diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 39f650e10f5..f3ebcf86a64 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -51,6 +51,10 @@ typedef struct /* The ideal upper bound of number of characters per line, as suggested by front-end. */ int ideal_maximum_length; + + /* Indentation count. */ + int indent_skip; + /* Nonzero if current PREFIX was emitted at least once. */ int emitted_prefix_p; @@ -88,6 +92,7 @@ struct output_buffer #define output_buffer_format_args(BUFFER) *((BUFFER)->state.format_args) #define output_needs_newline(BUFFER) (BUFFER)->state.need_newline_p #define output_buffer_state(BUFFER) (BUFFER)->state +#define output_indentation(BUFFER) (BUFFER)->state.indent_skip /* This data structure bundles altogether any information relevent to the context of a diagnostic message. */ diff --git a/gcc/toplev.c b/gcc/toplev.c index 20c6385edcf..d657d49ba48 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -3774,7 +3774,7 @@ display_help () printf (_(" -fcall-saved-<register> Mark <register> as being preserved across functions\n")); printf (_(" -finline-limit=<number> Limits the size of inlined functions to <number>\n")); printf (_(" -fmessage-length=<number> Limits diagnostics messages lengths to <number> characters per line. 0 suppresses line-wrapping\n")); - printf (_(" -fdiagnostics-show-location=[once | never] Indicates how often source location information should be emitted, as prefix, at the beginning of diagnostics when line-wrapping\n")); + printf (_(" -fdiagnostics-show-location=[once | every-line] Indicates how often source location information should be emitted, as prefix, at the beginning of diagnostics when line-wrapping\n")); for (i = ARRAY_SIZE (f_options); i--;) { |