aboutsummaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authorGabriel Dos Reis <gdr@codesourcery.com>2000-09-25 21:20:19 +0000
committerGabriel Dos Reis <gdr@gcc.gnu.org>2000-09-25 21:20:19 +0000
commit4b40f7588eaf7b4f323d812ebe612f951822d0ee (patch)
treef128e42344fe386dab97b5430694219834c7bcd5 /gcc/diagnostic.c
parent0f2907682ea0bc5a977d66aa110fe3b30119d4bb (diff)
downloadgcc-4b40f7588eaf7b4f323d812ebe612f951822d0ee.zip
gcc-4b40f7588eaf7b4f323d812ebe612f951822d0ee.tar.gz
gcc-4b40f7588eaf7b4f323d812ebe612f951822d0ee.tar.bz2
diagnostic.c (output_last_position): Define.
* diagnostic.c (output_last_position): Define. (set_real_maximum_length): Tweek. * diagnostic.h (output_last_position): Declare. From-SVN: r36629
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index afb25c1..56ed957 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -230,8 +230,12 @@ static void
set_real_maximum_length (buffer)
output_buffer *buffer;
{
- /* If we're told not to wrap lines then do the obvious thing. */
- if (! output_is_line_wrapping (buffer))
+ /* If we're told not to wrap lines then do the obvious thing. In case
+ we'll emit prefix only once per diagnostic message, it is appropriate
+ not to increase unncessarily the line-length cut-off. */
+ if (! output_is_line_wrapping (buffer)
+ || prefixing_policy (buffer) == DIAGNOSTICS_SHOW_PREFIX_ONCE
+ || prefixing_policy (buffer) == DIAGNOSTICS_SHOW_PREFIX_NEVER)
line_wrap_cutoff (buffer) = ideal_line_wrap_cutoff (buffer);
else
{
@@ -271,6 +275,19 @@ output_set_prefix (buffer, prefix)
output_indentation (buffer) = 0;
}
+/* Return a pointer to the last character emitted in the output
+ BUFFER area. A NULL pointer means no character available. */
+const char *
+output_last_position (buffer)
+ const output_buffer *buffer;
+{
+ const char *p = NULL;
+
+ if (obstack_base (&buffer->obstack) != obstack_next_free (&buffer->obstack))
+ p = ((const char *) obstack_next_free (&buffer->obstack)) - 1;
+ return p;
+}
+
/* Free BUFFER's prefix, a previously malloc'd string. */
void