public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [obvious fix] fix off-by-one error when printing the caret character
@ 2015-05-20 16:08 Manuel López-Ibáñez
  2015-05-21  8:38 ` Dodji Seketeli
  0 siblings, 1 reply; 2+ messages in thread
From: Manuel López-Ibáñez @ 2015-05-20 16:08 UTC (permalink / raw)
  To: Gcc Patch List, Dodji Seketeli

It seems I made an off-by-one error in my last patch for multiple
locations. This only affected the position of the caret character,
which we don't test (since the testsuite uses
-fno-diagnostics-show-caret). Fixed thusly and added a comment to
remind me and others that locations start at 1, but we still want to
start at 0 (but not start at 0 and add an extra space like I did
before).

Cheers,

Manuel.

Index: ChangeLog
===================================================================
--- ChangeLog   (revision 223445)
+++ ChangeLog   (working copy)
@@ -1,3 +1,8 @@
+2015-05-20  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+
+       * diagnostic.c (diagnostic_print_caret_line): Fix off-by-one error
+       when printing the caret character.
+
 2015-05-20  Marek Polacek  <polacek@redhat.com>

        * cfgexpand.c (expand_debug_expr): Use UNARY_CLASS_P.
Index: diagnostic.c
===================================================================
--- diagnostic.c        (revision 223445)
+++ diagnostic.c        (working copy)
@@ -420,7 +420,8 @@
   int caret_min = cmin == xloc1.column ? caret1 : caret2;
   int caret_max = cmin == xloc1.column ? caret2 : caret1;

-  pp_space (context->printer);
+  /* cmin is >= 1, but we indent with an extra space at the start like
+     we did above.  */
   int i;
   for (i = 0; i < cmin; i++)
     pp_space (context->printer);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [obvious fix] fix off-by-one error when printing the caret character
  2015-05-20 16:08 [obvious fix] fix off-by-one error when printing the caret character Manuel López-Ibáñez
@ 2015-05-21  8:38 ` Dodji Seketeli
  0 siblings, 0 replies; 2+ messages in thread
From: Dodji Seketeli @ 2015-05-21  8:38 UTC (permalink / raw)
  To: Manuel López-Ibáñez; +Cc: Gcc Patch List

Manuel López-Ibáñez <lopezibanez@gmail.com> writes:


> Index: ChangeLog
> ===================================================================
> --- ChangeLog   (revision 223445)
> +++ ChangeLog   (working copy)
> @@ -1,3 +1,8 @@
> +2015-05-20  Manuel López-Ibáñez  <manu@gcc.gnu.org>
> +
> +       * diagnostic.c (diagnostic_print_caret_line): Fix off-by-one error
> +       when printing the caret character.
> +

This is OK, thanks!

Cheers,

-- 
		Dodji

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-21  8:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-20 16:08 [obvious fix] fix off-by-one error when printing the caret character Manuel López-Ibáñez
2015-05-21  8:38 ` Dodji Seketeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).