compiler: add go_debug and use it for debug messages

GCC recently added a new warning -Wformat-diag which does a lot of
rigorous checks on GCC diagnostic messages.  This produces a number of
unnecessary diagnostics on gofrontend diagnostic output, such as

../../trunk/gcc/go/gofrontend/escape.cc: In member function ‘virtual int Escape_analysis_assign::statement(Block*, size_t*, Statement*)’:
../../trunk/gcc/go/gofrontend/escape.cc:1336:33: warning: spurious leading punctuation sequence ‘[’ in format [-Wformat-diag]
 1336 |       go_inform(s->location(), "[%d] %s esc: %s",
      |                                 ^

../../trunk/gcc/go/gofrontend/escape.cc: In member function ‘void Escape_analysis_assign::call(Call_expression*)’:
../../trunk/gcc/go/gofrontend/escape.cc:1964:17: warning: unquoted operator ‘::’ in format [-Wformat-diag]
 1964 |         "esccall:: indirect call <- %s, untracked",
      |                 ^~

../../trunk/gcc/go/gofrontend/escape.cc:1964:34: warning: unbalanced punctuation character ‘<’ in format [-Wformat-diag]
 1964 |         "esccall:: indirect call <- %s, untracked",
      |                                  ^

Avoid these messages by adding a new function go_debug that uses only
printf formatting, not GCC diagnostic formatting, and change all the
optimization debugging messages to use it.  None of the debugging
messages used the GCC diagnostic formatting specifiers anyhow.

Change-Id: I591ee02ef6875fc56bc0f8323c19608acfc2ea10
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/183437
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 files changed