compiler: better abstraction layer for diagnostics

Programming / Compilers / GCC - ian [138bc75d-0d04-0410-961f-82ee72b054a4] - 23 September 2016 14:36 UTC

Introduce an abstraction layer for reporting diagnostics, so as to avoid directly using the native GCC interfaces such as "error_at", "warning_at", "open_quote", "close_quote", etc. The new interfaces have the same look and feel as the GCC equivalents, but make calls into back-end functions to allow the back end to select the proper final reporting routine.

Reviewed-on: https://go-review.googlesource.com/29191

- go-gcc-diagnostics.cc: New file.
- go-location.h (Location): Remove operator source_location. Add operator==.
- go-system.h: #include .
- Make-lang.in (GO_OBJS): Add go/go-diagnostics.o and go/go-gcc-diagnostics.o. (CFLAGS-go/go-gcc-diagnostics.o): New variable.

631d578 compiler: better abstraction layer for diagnostics.
gcc/go/ChangeLog | 10 +
gcc/go/Make-lang.in | 3 +
gcc/go/go-gcc-diagnostics.cc | 61 +++++
gcc/go/go-location.h | 10 +-
gcc/go/go-system.h | 1 +
gcc/go/gofrontend/MERGE | 2 +-
gcc/go/gofrontend/ast-dump.cc | 4 +-
gcc/go/gofrontend/backend.h | 2 +-
gcc/go/gofrontend/escape.cc | 177 +++++++------
gcc/go/gofrontend/expressions.cc | 395 +++++++++++++--------------
gcc/go/gofrontend/go-diagnostics.cc | 177 +++++++++++++
gcc/go/gofrontend/go-diagnostics.h | 64 +++++
gcc/go/gofrontend/go.cc | 11 +-
gcc/go/gofrontend/gogo.cc | 251 +++++++++---------
gcc/go/gofrontend/import-archive.cc | 57 ++--
gcc/go/gofrontend/import.cc | 76 +++---
gcc/go/gofrontend/lex.cc | 78 +++---
gcc/go/gofrontend/parse.cc | 499 ++++++++++++++++++-----------------
gcc/go/gofrontend/parse.h | 3 +-
gcc/go/gofrontend/statements.cc | 52 ++--
gcc/go/gofrontend/statements.h | 4 +-
gcc/go/gofrontend/types.cc | 126 ++++-----
22 files changed, 1217 insertions(+), 846 deletions(-)

Upstream: gcc.gnu.org


  • Share