compiler: avoid GCC middle-end control warnings
authorIan Lance Taylor <iant@golang.org>
Sat, 2 Dec 2017 00:38:54 +0000 (00:38 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Sat, 2 Dec 2017 00:38:54 +0000 (00:38 +0000)
commit9638589faff5b5ec33afba0b5a4560a3f0b5aaa6
tree8d0aee02a39a2db4df11c4755923b7677cdae58a
parentd7d5f241f08bfbe5c888b24b380220851816387e
compiler: avoid GCC middle-end control warnings

    GCC has started emitting "control reaches end of non-void function"
    warnings. Avoid them for Go by 1) marking the builtin function panic
    and the compiler-generated function __go_runtime_error as not
    returning and 2) adding a default case to the switch used for select
    statements that simply calls __builtin_unreachable.

    Fixes golang/go#22767

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

* go-gcc.cc (Gcc_backend::Gcc_backend): Define
__builtin_unreachable.
(Gcc_backend::function): Add does_not_return parameter.

From-SVN: r255346
gcc/go/ChangeLog
gcc/go/go-gcc.cc
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/backend.h
gcc/go/gofrontend/gogo.cc
gcc/go/gofrontend/runtime.def
gcc/go/gofrontend/statements.cc