https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952

Bernd Edlinger <bernd.edlinger at hotmail dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bernd.edlinger at hotmail dot 
de

--- Comment #46 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
(In reply to David Malcolm from comment #45)
>     trunk/gcc/testsuite/gcc.dg/cpp/pr66415-1.c


David, this test case does fail because the caret is not always shown in
column 71.

I've got it once, but and when I tried to repeat this test alone it works. 

It seems to depend if stderr is a tty (isatty(2) != 0)
I think the problem is in diagnostics.c

diagnostic_set_caret_max_width (diagnostic_context *context, int value)
{
  /* One minus to account for the leading empty space.  */
  value = value ? value - 1
    : (isatty (fileno (pp_buffer (context->printer)->stream))
       ? get_terminal_width () - 1: INT_MAX);

and:

get_terminal_width (void)
{
  const char * s = getenv ("COLUMNS");
  if (s != NULL) {
    int n = atoi (s);
    if (n > 0)
      return n;
  }

#ifdef TIOCGWINSZ
  struct winsize w;
  w.ws_col = 0;
  if (ioctl (0, TIOCGWINSZ, &w) == 0 && w.ws_col > 0)
    return w.ws_col;
#endif

  return INT_MAX;
}

I think it depends on the terminal window, where I start the
make check, it is often a COLUMNS=80 then maybe the test will
fail, because the output is squeezed into 80 column, but
if COLUMNS=120 the test will pass.

What do you think?

Reply via email to