From 620e594be58d2f933902a6619fd20aa618070b4b Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 13 Nov 2018 20:05:03 +0000 Subject: 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 --- gcc/c-family/c-ppoutput.c | 50 +++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'gcc/c-family/c-ppoutput.c') diff --git a/gcc/c-family/c-ppoutput.c b/gcc/c-family/c-ppoutput.c index 2e5a44e..bb5d996 100644 --- a/gcc/c-family/c-ppoutput.c +++ b/gcc/c-family/c-ppoutput.c @@ -59,24 +59,24 @@ static void account_for_newlines (const unsigned char *, size_t); static int dump_macro (cpp_reader *, cpp_hashnode *, void *); static void dump_queued_macros (cpp_reader *); -static bool print_line_1 (source_location, const char*, FILE *); -static bool print_line (source_location, const char *); -static bool maybe_print_line_1 (source_location, FILE *); -static bool maybe_print_line (source_location); +static bool print_line_1 (location_t, const char*, FILE *); +static bool print_line (location_t, const char *); +static bool maybe_print_line_1 (location_t, FILE *); +static bool maybe_print_line (location_t); static bool do_line_change (cpp_reader *, const cpp_token *, - source_location, int); + location_t, int); /* Callback routines for the parser. Most of these are active only in specific modes. */ static void cb_line_change (cpp_reader *, const cpp_token *, int); -static void cb_define (cpp_reader *, source_location, cpp_hashnode *); -static void cb_undef (cpp_reader *, source_location, cpp_hashnode *); -static void cb_used_define (cpp_reader *, source_location, cpp_hashnode *); -static void cb_used_undef (cpp_reader *, source_location, cpp_hashnode *); -static void cb_include (cpp_reader *, source_location, const unsigned char *, +static void cb_define (cpp_reader *, location_t, cpp_hashnode *); +static void cb_undef (cpp_reader *, location_t, cpp_hashnode *); +static void cb_used_define (cpp_reader *, location_t, cpp_hashnode *); +static void cb_used_undef (cpp_reader *, location_t, cpp_hashnode *); +static void cb_include (cpp_reader *, location_t, const unsigned char *, const char *, int, const cpp_token **); -static void cb_ident (cpp_reader *, source_location, const cpp_string *); -static void cb_def_pragma (cpp_reader *, source_location); +static void cb_ident (cpp_reader *, location_t, const cpp_string *); +static void cb_def_pragma (cpp_reader *, location_t); static void cb_read_pch (cpp_reader *pfile, const char *name, int fd, const char *orig_name); @@ -179,7 +179,7 @@ scan_translation_unit (cpp_reader *pfile) print.source = NULL; for (;;) { - source_location loc; + location_t loc; const cpp_token *token = cpp_get_token_with_location (pfile, &loc); if (token->type == CPP_PADDING) @@ -336,7 +336,7 @@ scan_translation_unit_trad (cpp_reader *pfile) return FALSE. */ static bool -maybe_print_line_1 (source_location src_loc, FILE *stream) +maybe_print_line_1 (location_t src_loc, FILE *stream) { bool emitted_line_marker = false; int src_line = LOCATION_LINE (src_loc); @@ -373,7 +373,7 @@ maybe_print_line_1 (source_location src_loc, FILE *stream) return FALSE. */ static bool -maybe_print_line (source_location src_loc) +maybe_print_line (location_t src_loc) { if (cpp_get_options (parse_in)->debug) linemap_dump_location (line_table, src_loc, @@ -386,7 +386,7 @@ maybe_print_line (source_location src_loc) was effectively emitted, return TRUE otherwise return FALSE. */ static bool -print_line_1 (source_location src_loc, const char *special_flags, FILE *stream) +print_line_1 (location_t src_loc, const char *special_flags, FILE *stream) { bool emitted_line_marker = false; @@ -435,7 +435,7 @@ print_line_1 (source_location src_loc, const char *special_flags, FILE *stream) line marker was effectively emitted, FALSE otherwise. */ static bool -print_line (source_location src_loc, const char *special_flags) +print_line (location_t src_loc, const char *special_flags) { if (cpp_get_options (parse_in)->debug) linemap_dump_location (line_table, src_loc, @@ -447,7 +447,7 @@ print_line (source_location src_loc, const char *special_flags) Return TRUE if a line marker is emitted, FALSE otherwise. */ static bool do_line_change (cpp_reader *pfile, const cpp_token *token, - source_location src_loc, int parsing_args) + location_t src_loc, int parsing_args) { bool emitted_line_marker = false; if (define_queue || undef_queue) @@ -487,7 +487,7 @@ cb_line_change (cpp_reader *pfile, const cpp_token *token, } static void -cb_ident (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line, +cb_ident (cpp_reader *pfile ATTRIBUTE_UNUSED, location_t line, const cpp_string *str) { maybe_print_line (line); @@ -496,7 +496,7 @@ cb_ident (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line, } static void -cb_define (cpp_reader *pfile, source_location line, cpp_hashnode *node) +cb_define (cpp_reader *pfile, location_t line, cpp_hashnode *node) { const line_map_ordinary *map; @@ -520,7 +520,7 @@ cb_define (cpp_reader *pfile, source_location line, cpp_hashnode *node) } static void -cb_undef (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line, +cb_undef (cpp_reader *pfile ATTRIBUTE_UNUSED, location_t line, cpp_hashnode *node) { maybe_print_line (line); @@ -529,7 +529,7 @@ cb_undef (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line, } static void -cb_used_define (cpp_reader *pfile, source_location line ATTRIBUTE_UNUSED, +cb_used_define (cpp_reader *pfile, location_t line ATTRIBUTE_UNUSED, cpp_hashnode *node) { if (cpp_user_macro_p (node)) @@ -544,7 +544,7 @@ cb_used_define (cpp_reader *pfile, source_location line ATTRIBUTE_UNUSED, static void cb_used_undef (cpp_reader *pfile ATTRIBUTE_UNUSED, - source_location line ATTRIBUTE_UNUSED, + location_t line ATTRIBUTE_UNUSED, cpp_hashnode *node) { macro_queue *q; @@ -595,7 +595,7 @@ dump_queued_macros (cpp_reader *pfile ATTRIBUTE_UNUSED) } static void -cb_include (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line, +cb_include (cpp_reader *pfile ATTRIBUTE_UNUSED, location_t line, const unsigned char *dir, const char *header, int angle_brackets, const cpp_token **comments) { @@ -676,7 +676,7 @@ pp_file_change (const line_map_ordinary *map) /* Copy a #pragma directive to the preprocessed output. */ static void -cb_def_pragma (cpp_reader *pfile, source_location line) +cb_def_pragma (cpp_reader *pfile, location_t line) { maybe_print_line (line); fputs ("#pragma ", print.outf); -- cgit v1.1