1 // go-gcc-diagnostics.cc -- GCC implementation of go diagnostics interface.
2 // Copyright (C) 2016-2019 Free Software Foundation, Inc.
3 // Contributed by Than McIntosh, Google.
4 
5 // This file is part of GCC.
6 
7 // GCC is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU General Public License as published by the Free
9 // Software Foundation; either version 3, or (at your option) any later
10 // version.
11 
12 // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 // for more details.
16 
17 // You should have received a copy of the GNU General Public License
18 // along with GCC; see the file COPYING3.  If not see
19 // <http://www.gnu.org/licenses/>.
20 
21 #include "go-system.h"
22 #include "go-diagnostics.h"
23 
24 void
go_be_error_at(const Location location,const std::string & errmsg)25 go_be_error_at(const Location location, const std::string& errmsg)
26 {
27   location_t gcc_loc = location.gcc_location();
28   error_at(gcc_loc, "%s", errmsg.c_str());
29 }
30 
31 
32 void
go_be_warning_at(const Location location,int opt,const std::string & warningmsg)33 go_be_warning_at(const Location location,
34                  int opt, const std::string& warningmsg)
35 {
36   location_t gcc_loc = location.gcc_location();
37   warning_at(gcc_loc, opt, "%s", warningmsg.c_str());
38 }
39 
40 void
go_be_fatal_error(const Location location,const std::string & fatalmsg)41 go_be_fatal_error(const Location location,
42                   const std::string& fatalmsg)
43 {
44   location_t gcc_loc = location.gcc_location();
45   fatal_error(gcc_loc, "%s", fatalmsg.c_str());
46 }
47 
48 void
go_be_inform(const Location location,const std::string & infomsg)49 go_be_inform(const Location location,
50              const std::string& infomsg)
51 {
52   location_t gcc_loc = location.gcc_location();
53   inform(gcc_loc, "%s", infomsg.c_str());
54 }
55 
56 void
go_be_get_quotechars(const char ** open_qu,const char ** close_qu)57 go_be_get_quotechars(const char** open_qu, const char** close_qu)
58 {
59   *open_qu = open_quote;
60   *close_qu = close_quote;
61 }
62