diff options
author | David Malcolm <dmalcolm@redhat.com> | 2018-11-13 20:05:03 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2018-11-13 20:05:03 +0000 |
commit | 620e594be58d2f933902a6619fd20aa618070b4b (patch) | |
tree | 18b833ac960291d05524d5994ae4292048632226 /gcc/go | |
parent | f9731de3db4c59ff0a241ce2c3d6f80aca5b5c28 (diff) | |
download | gcc-620e594be58d2f933902a6619fd20aa618070b4b.zip gcc-620e594be58d2f933902a6619fd20aa618070b4b.tar.gz gcc-620e594be58d2f933902a6619fd20aa618070b4b.tar.bz2 |
Eliminate source_location in favor of location_t
Historically GCC used location_t, while libcpp used source_location.
This inconsistency has been annoying me for a while, so this patch
removes source_location in favor of location_t throughout
(as the latter is shorter).
gcc/ChangeLog:
* builtins.c: Replace "source_location" with "location_t".
* diagnostic-show-locus.c: Likewise.
* diagnostic.c: Likewise.
* dumpfile.c: Likewise.
* gcc-rich-location.h: Likewise.
* genmatch.c: Likewise.
* gimple.h: Likewise.
* gimplify.c: Likewise.
* input.c: Likewise.
* input.h: Likewise. Eliminate the typedef.
* omp-expand.c: Likewise.
* selftest.h: Likewise.
* substring-locations.h (get_source_location_for_substring):
Rename to..
(get_location_within_string): ...this.
* tree-cfg.c: Replace "source_location" with "location_t".
* tree-cfgcleanup.c: Likewise.
* tree-diagnostic.c: Likewise.
* tree-into-ssa.c: Likewise.
* tree-outof-ssa.c: Likewise.
* tree-parloops.c: Likewise.
* tree-phinodes.c: Likewise.
* tree-phinodes.h: Likewise.
* tree-ssa-loop-ivopts.c: Likewise.
* tree-ssa-loop-manip.c: Likewise.
* tree-ssa-phiopt.c: Likewise.
* tree-ssa-phiprop.c: Likewise.
* tree-ssa-threadupdate.c: Likewise.
* tree-ssa.c: Likewise.
* tree-ssa.h: Likewise.
* tree-vect-loop-manip.c: Likewise.
gcc/c-family/ChangeLog:
* c-common.c (c_get_substring_location): Update for renaming of
get_source_location_for_substring to get_location_within_string.
* c-lex.c: Replace "source_location" with "location_t".
* c-opts.c: Likewise.
* c-ppoutput.c: Likewise.
gcc/c/ChangeLog:
* c-decl.c: Replace "source_location" with "location_t".
* c-tree.h: Likewise.
* c-typeck.c: Likewise.
* gimple-parser.c: Likewise.
gcc/cp/ChangeLog:
* call.c: Replace "source_location" with "location_t".
* cp-tree.h: Likewise.
* cvt.c: Likewise.
* name-lookup.c: Likewise.
* parser.c: Likewise.
* typeck.c: Likewise.
gcc/fortran/ChangeLog:
* cpp.c: Replace "source_location" with "location_t".
* gfortran.h: Likewise.
gcc/go/ChangeLog:
* go-gcc-diagnostics.cc: Replace "source_location" with "location_t".
* go-gcc.cc: Likewise.
* go-linemap.cc: Likewise.
* go-location.h: Likewise.
* gofrontend/README: Likewise.
gcc/jit/ChangeLog:
* jit-playback.c: Replace "source_location" with "location_t".
gcc/testsuite/ChangeLog:
* g++.dg/plugin/comment_plugin.c: Replace "source_location" with
"location_t".
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Likewise.
libcc1/ChangeLog:
* libcc1plugin.cc: Replace "source_location" with "location_t".
(plugin_context::get_source_location): Rename to...
(plugin_context::get_location_t): ...this.
* libcp1plugin.cc: Likewise.
libcpp/ChangeLog:
* charset.c: Replace "source_location" with "location_t".
* directives-only.c: Likewise.
* directives.c: Likewise.
* errors.c: Likewise.
* expr.c: Likewise.
* files.c: Likewise.
* include/cpplib.h: Likewise. Rename MAX_SOURCE_LOCATION to
MAX_LOCATION_T.
* include/line-map.h: Likewise.
* init.c: Likewise.
* internal.h: Likewise.
* lex.c: Likewise.
* line-map.c: Likewise.
* location-example.txt: Likewise.
* macro.c: Likewise.
* pch.c: Likewise.
* traditional.c: Likewise.
From-SVN: r266085
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/go/go-gcc-diagnostics.cc | 8 | ||||
-rw-r--r-- | gcc/go/go-gcc.cc | 8 | ||||
-rw-r--r-- | gcc/go/go-linemap.cc | 2 | ||||
-rw-r--r-- | gcc/go/go-location.h | 6 | ||||
-rw-r--r-- | gcc/go/gofrontend/README | 2 |
6 files changed, 21 insertions, 13 deletions
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index 45871d7..5f18b80 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,11 @@ +2018-11-13 David Malcolm <dmalcolm@redhat.com> + + * go-gcc-diagnostics.cc: Replace "source_location" with "location_t". + * go-gcc.cc: Likewise. + * go-linemap.cc: Likewise. + * go-location.h: Likewise. + * gofrontend/README: Likewise. + 2018-10-31 Ian Lance Taylor <iant@golang.org> * go-gcc.cc (Gcc_backend::write_global_definitions): Don't call diff --git a/gcc/go/go-gcc-diagnostics.cc b/gcc/go/go-gcc-diagnostics.cc index 4d03fa5..6ddf0f4 100644 --- a/gcc/go/go-gcc-diagnostics.cc +++ b/gcc/go/go-gcc-diagnostics.cc @@ -24,7 +24,7 @@ void go_be_error_at(const Location location, const std::string& errmsg) { - source_location gcc_loc = location.gcc_location(); + location_t gcc_loc = location.gcc_location(); error_at(gcc_loc, "%s", errmsg.c_str()); } @@ -33,7 +33,7 @@ void go_be_warning_at(const Location location, int opt, const std::string& warningmsg) { - source_location gcc_loc = location.gcc_location(); + location_t gcc_loc = location.gcc_location(); warning_at(gcc_loc, opt, "%s", warningmsg.c_str()); } @@ -41,7 +41,7 @@ void go_be_fatal_error(const Location location, const std::string& fatalmsg) { - source_location gcc_loc = location.gcc_location(); + location_t gcc_loc = location.gcc_location(); fatal_error(gcc_loc, "%s", fatalmsg.c_str()); } @@ -49,7 +49,7 @@ void go_be_inform(const Location location, const std::string& infomsg) { - source_location gcc_loc = location.gcc_location(); + location_t gcc_loc = location.gcc_location(); inform(gcc_loc, "%s", infomsg.c_str()); } diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index 092d3e4..be23029 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -2243,9 +2243,9 @@ Gcc_backend::switch_statement( { if (pc->empty()) { - source_location loc = (*ps != NULL - ? EXPR_LOCATION((*ps)->get_tree()) - : UNKNOWN_LOCATION); + location_t loc = (*ps != NULL + ? EXPR_LOCATION((*ps)->get_tree()) + : UNKNOWN_LOCATION); tree label = create_artificial_label(loc); tree c = build_case_label(NULL_TREE, NULL_TREE, label); append_to_statement_list(c, &stmt_list); @@ -2259,7 +2259,7 @@ Gcc_backend::switch_statement( tree t = (*pcv)->get_tree(); if (t == error_mark_node) return this->error_statement(); - source_location loc = EXPR_LOCATION(t); + location_t loc = EXPR_LOCATION(t); tree label = create_artificial_label(loc); tree c = build_case_label((*pcv)->get_tree(), NULL_TREE, label); append_to_statement_list(c, &stmt_list); diff --git a/gcc/go/go-linemap.cc b/gcc/go/go-linemap.cc index a4d4b7d..1d72e79 100644 --- a/gcc/go/go-linemap.cc +++ b/gcc/go/go-linemap.cc @@ -77,7 +77,7 @@ std::string Gcc_linemap::to_string(Location location) { const line_map_ordinary *lmo; - source_location resolved_location; + location_t resolved_location; // Screen out unknown and predeclared locations; produce output // only for simple file:line locations. diff --git a/gcc/go/go-location.h b/gcc/go/go-location.h index 90258ea..6637b86 100644 --- a/gcc/go/go-location.h +++ b/gcc/go/go-location.h @@ -18,16 +18,16 @@ class Location : gcc_loc_(UNKNOWN_LOCATION) { } - explicit Location(source_location loc) + explicit Location(location_t loc) : gcc_loc_(loc) { } - source_location + location_t gcc_location() const { return this->gcc_loc_; } private: - source_location gcc_loc_; + location_t gcc_loc_; }; // The Go frontend requires the ability to compare Locations. diff --git a/gcc/go/gofrontend/README b/gcc/go/gofrontend/README index 6d4d0b0..b139194 100644 --- a/gcc/go/gofrontend/README +++ b/gcc/go/gofrontend/README @@ -14,7 +14,7 @@ header files. Issues to be faced in this transition: * Representation of source locations. - + Currently the frontend uses gcc's source_location codes, using the + + Currently the frontend uses gcc's location_t codes, using the interface in libcpp/line-map.h. * Handling of error messages. |