aboutsummaryrefslogtreecommitdiff
path: root/libcpp/files.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2018-11-13 20:05:03 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2018-11-13 20:05:03 +0000
commit620e594be58d2f933902a6619fd20aa618070b4b (patch)
tree18b833ac960291d05524d5994ae4292048632226 /libcpp/files.c
parentf9731de3db4c59ff0a241ce2c3d6f80aca5b5c28 (diff)
downloadgcc-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 'libcpp/files.c')
-rw-r--r--libcpp/files.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/libcpp/files.c b/libcpp/files.c
index 0f0cc7b..3771fad 100644
--- a/libcpp/files.c
+++ b/libcpp/files.c
@@ -144,7 +144,7 @@ struct cpp_file_hash_entry
{
struct cpp_file_hash_entry *next;
cpp_dir *start_dir;
- source_location location;
+ location_t location;
union
{
_cpp_file *file;
@@ -171,18 +171,18 @@ static bool open_file (_cpp_file *file);
static bool pch_open_file (cpp_reader *pfile, _cpp_file *file,
bool *invalid_pch);
static bool find_file_in_dir (cpp_reader *pfile, _cpp_file *file,
- bool *invalid_pch, source_location loc);
+ bool *invalid_pch, location_t loc);
static bool read_file_guts (cpp_reader *pfile, _cpp_file *file,
- source_location loc);
+ location_t loc);
static bool read_file (cpp_reader *pfile, _cpp_file *file,
- source_location loc);
+ location_t loc);
static bool should_stack_file (cpp_reader *, _cpp_file *file, bool import,
- source_location loc);
+ location_t loc);
static struct cpp_dir *search_path_head (cpp_reader *, const char *fname,
int angle_brackets, enum include_type);
static const char *dir_name_of_file (_cpp_file *file);
static void open_file_failed (cpp_reader *pfile, _cpp_file *file, int,
- source_location);
+ location_t);
static struct cpp_file_hash_entry *search_cache (struct cpp_file_hash_entry *head,
const cpp_dir *start_dir);
static _cpp_file *make_cpp_file (cpp_reader *, cpp_dir *, const char *fname);
@@ -377,7 +377,7 @@ maybe_shorter_path (const char * file)
static bool
find_file_in_dir (cpp_reader *pfile, _cpp_file *file, bool *invalid_pch,
- source_location loc)
+ location_t loc)
{
char *path;
@@ -507,7 +507,7 @@ _cpp_find_failed (_cpp_file *file)
_cpp_file *
_cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir,
bool fake, int angle_brackets, bool implicit_preinclude,
- source_location loc)
+ location_t loc)
{
struct cpp_file_hash_entry *entry;
void **hash_slot;
@@ -671,7 +671,7 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir,
FIXME: Flush file cache and try again if we run out of memory. */
static bool
-read_file_guts (cpp_reader *pfile, _cpp_file *file, source_location loc)
+read_file_guts (cpp_reader *pfile, _cpp_file *file, location_t loc)
{
ssize_t size, total, count;
uchar *buf;
@@ -755,7 +755,7 @@ read_file_guts (cpp_reader *pfile, _cpp_file *file, source_location loc)
have been passed through find_file() at some stage. Use LOC for
any diagnostics. */
static bool
-read_file (cpp_reader *pfile, _cpp_file *file, source_location loc)
+read_file (cpp_reader *pfile, _cpp_file *file, location_t loc)
{
/* If we already have its contents in memory, succeed immediately. */
if (file->buffer_valid)
@@ -783,7 +783,7 @@ read_file (cpp_reader *pfile, _cpp_file *file, source_location loc)
Use LOC for any diagnostics. */
static bool
should_stack_file (cpp_reader *pfile, _cpp_file *file, bool import,
- source_location loc)
+ location_t loc)
{
_cpp_file *f;
@@ -892,7 +892,7 @@ should_stack_file (cpp_reader *pfile, _cpp_file *file, bool import,
stacked. Use LOC for any diagnostics. */
bool
_cpp_stack_file (cpp_reader *pfile, _cpp_file *file, bool import,
- source_location loc)
+ location_t loc)
{
cpp_buffer *buffer;
int sysp;
@@ -1007,7 +1007,7 @@ dir_name_of_file (_cpp_file *file)
Returns true if a buffer was stacked. */
bool
_cpp_stack_include (cpp_reader *pfile, const char *fname, int angle_brackets,
- enum include_type type, source_location loc)
+ enum include_type type, location_t loc)
{
struct cpp_dir *dir;
_cpp_file *file;
@@ -1037,7 +1037,7 @@ _cpp_stack_include (cpp_reader *pfile, const char *fname, int angle_brackets,
/* Compensate for the increment in linemap_add that occurs if
_cpp_stack_file actually stacks the file. In the case of a
normal #include, we're currently at the start of the line
- *following* the #include. A separate source_location for this
+ *following* the #include. A separate location_t for this
location makes no sense (until we do the LC_LEAVE), and
complicates LAST_SOURCE_LINE_LOCATION. This does not apply if we
found a PCH file (in which case linemap_add is not called) or we
@@ -1059,7 +1059,7 @@ _cpp_stack_include (cpp_reader *pfile, const char *fname, int angle_brackets,
/* Could not open FILE. The complication is dependency output. */
static void
open_file_failed (cpp_reader *pfile, _cpp_file *file, int angle_brackets,
- source_location loc)
+ location_t loc)
{
int sysp = pfile->line_table->highest_line > 1 && pfile->buffer ? pfile->buffer->sysp : 0;
bool print_dep = CPP_OPTION (pfile, deps.style) > (angle_brackets || !!sysp);
@@ -1247,7 +1247,7 @@ cpp_included (cpp_reader *pfile, const char *fname)
filenames aliased by links or redundant . or .. traversals etc. */
bool
cpp_included_before (cpp_reader *pfile, const char *fname,
- source_location location)
+ location_t location)
{
struct cpp_file_hash_entry *entry
= (struct cpp_file_hash_entry *)