[build2] No compiler output when {}-imbalance detected

Boris Kolpackov boris at codesynthesis.com
Thu Nov 21 09:35:57 UTC 2019


Boris Kolpackov <boris at codesynthesis.com> writes:

> I think the better approach is to improve the diagnostics that we issue;
> there is no reason we cannot make it as good as what's produced by the
> compilers. Let me see what I can do.

Ok, I've looked into this and, actually, the compilers don't do a much
better job at it. However, oftentimes, there are other semantic errors
that provide a better clue. And that we cannot match.

So in 0.12.0 I've changed this error to a warning which means we will
also get the compiler diagnostics. Here is what it looks like now:

neg.cxx:17:1: warning: extraneous '}'
  info: while scanning cxx{neg}
  info: while applying rule cxx.compile to update obje{neg}
  info: while applying rule cxx.link to update exe{balance}
  info: while applying rule alias to update dir{./}
pos.cxx:18:1: warning: missing '}'
  info: while scanning cxx{pos}
  info: while applying rule cxx.compile to update obje{pos}
  info: while applying rule cxx.link to update exe{balance}
  info: while applying rule alias to update dir{./}
c++ cxx{neg}        
c++ cxx{pos}
/tmp/balance/balance/pos.cxx:17:2: error: expected '}'
}
 ^
/tmp/balance/balance/pos.cxx:4:1: note: to match this '{'
{
^
1 error generated.
/tmp/balance/balance/neg.cxx:16:3: error: expected unqualified-id
  return 1;
  ^
/tmp/balance/balance/neg.cxx:17:1: error: extraneous closing brace ('}')
}
^



More information about the users mailing list