annotate gcc/input.h @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* Declarations for variables relating to reading the source file.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 Used by parsers, lexical analyzers, and error message routines.
111
kono
parents: 67
diff changeset
3 Copyright (C) 1993-2017 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 GCC is free software; you can redistribute it and/or modify it under
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 the terms of the GNU General Public License as published by the Free
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 Software Foundation; either version 3, or (at your option) any later
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 #ifndef GCC_INPUT_H
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 #define GCC_INPUT_H
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 #include "line-map.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 extern GTY(()) struct line_maps *line_table;
111
kono
parents: 67
diff changeset
27 extern GTY(()) struct line_maps *saved_line_table;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 /* A value which will never be used to represent a real location. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 #define UNKNOWN_LOCATION ((source_location) 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 /* The location for declarations in "<built-in>" */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
33 #define BUILTINS_LOCATION ((source_location) 1)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
34
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
35 /* line-map.c reserves RESERVED_LOCATION_COUNT to the user. Ensure
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
36 both UNKNOWN_LOCATION and BUILTINS_LOCATION fit into that. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
37 extern char builtins_location_check[(BUILTINS_LOCATION
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
38 < RESERVED_LOCATION_COUNT) ? 1 : -1];
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39
111
kono
parents: 67
diff changeset
40 extern bool is_location_from_builtin_token (source_location);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 extern expanded_location expand_location (source_location);
111
kono
parents: 67
diff changeset
42 extern const char *location_get_source_line (const char *file_path, int line,
kono
parents: 67
diff changeset
43 int *line_size);
kono
parents: 67
diff changeset
44 extern bool location_missing_trailing_newline (const char *file_path);
kono
parents: 67
diff changeset
45 extern expanded_location expand_location_to_spelling_point (source_location);
kono
parents: 67
diff changeset
46 extern source_location expansion_point_location_if_in_system_header (source_location);
kono
parents: 67
diff changeset
47 extern source_location expansion_point_location (source_location);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 /* Historically GCC used location_t, while cpp used source_location.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 This could be removed but it hardly seems worth the effort. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 typedef source_location location_t;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 extern location_t input_location;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 #define LOCATION_FILE(LOC) ((expand_location (LOC)).file)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 #define LOCATION_LINE(LOC) ((expand_location (LOC)).line)
111
kono
parents: 67
diff changeset
57 #define LOCATION_COLUMN(LOC)((expand_location (LOC)).column)
kono
parents: 67
diff changeset
58 #define LOCATION_LOCUS(LOC) \
kono
parents: 67
diff changeset
59 ((IS_ADHOC_LOC (LOC)) ? get_location_from_adhoc_loc (line_table, LOC) \
kono
parents: 67
diff changeset
60 : (LOC))
kono
parents: 67
diff changeset
61 #define LOCATION_BLOCK(LOC) \
kono
parents: 67
diff changeset
62 ((tree) ((IS_ADHOC_LOC (LOC)) ? get_data_from_adhoc_loc (line_table, (LOC)) \
kono
parents: 67
diff changeset
63 : NULL))
kono
parents: 67
diff changeset
64 #define RESERVED_LOCATION_P(LOC) \
kono
parents: 67
diff changeset
65 (LOCATION_LOCUS (LOC) < RESERVED_LOCATION_COUNT)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66
111
kono
parents: 67
diff changeset
67 /* Return a positive value if LOCATION is the locus of a token that is
kono
parents: 67
diff changeset
68 located in a system header, O otherwise. It returns 1 if LOCATION
kono
parents: 67
diff changeset
69 is the locus of a token that is located in a system header, and 2
kono
parents: 67
diff changeset
70 if LOCATION is the locus of a token located in a C system header
kono
parents: 67
diff changeset
71 that therefore needs to be extern "C" protected in C++.
kono
parents: 67
diff changeset
72
kono
parents: 67
diff changeset
73 Note that this function returns 1 if LOCATION belongs to a token
kono
parents: 67
diff changeset
74 that is part of a macro replacement-list defined in a system
kono
parents: 67
diff changeset
75 header, but expanded in a non-system file. */
kono
parents: 67
diff changeset
76 #define in_system_header_at(LOC) \
kono
parents: 67
diff changeset
77 (linemap_location_in_system_header_p (line_table, LOC))
kono
parents: 67
diff changeset
78 /* Return a positive value if LOCATION is the locus of a token that
kono
parents: 67
diff changeset
79 comes from a macro expansion, O otherwise. */
kono
parents: 67
diff changeset
80 #define from_macro_expansion_at(LOC) \
kono
parents: 67
diff changeset
81 ((linemap_location_from_macro_expansion_p (line_table, LOC)))
kono
parents: 67
diff changeset
82 /* Return a positive value if LOCATION is the locus of a token that comes from
kono
parents: 67
diff changeset
83 a macro definition, O otherwise. This differs from from_macro_expansion_at
kono
parents: 67
diff changeset
84 in its treatment of macro arguments, for which this returns false. */
kono
parents: 67
diff changeset
85 #define from_macro_definition_at(LOC) \
kono
parents: 67
diff changeset
86 ((linemap_location_from_macro_definition_p (line_table, LOC)))
kono
parents: 67
diff changeset
87
kono
parents: 67
diff changeset
88 static inline location_t
kono
parents: 67
diff changeset
89 get_pure_location (location_t loc)
kono
parents: 67
diff changeset
90 {
kono
parents: 67
diff changeset
91 return get_pure_location (line_table, loc);
kono
parents: 67
diff changeset
92 }
kono
parents: 67
diff changeset
93
kono
parents: 67
diff changeset
94 /* Get the start of any range encoded within location LOC. */
kono
parents: 67
diff changeset
95
kono
parents: 67
diff changeset
96 static inline location_t
kono
parents: 67
diff changeset
97 get_start (location_t loc)
kono
parents: 67
diff changeset
98 {
kono
parents: 67
diff changeset
99 return get_range_from_loc (line_table, loc).m_start;
kono
parents: 67
diff changeset
100 }
kono
parents: 67
diff changeset
101
kono
parents: 67
diff changeset
102 /* Get the endpoint of any range encoded within location LOC. */
kono
parents: 67
diff changeset
103
kono
parents: 67
diff changeset
104 static inline location_t
kono
parents: 67
diff changeset
105 get_finish (location_t loc)
kono
parents: 67
diff changeset
106 {
kono
parents: 67
diff changeset
107 return get_range_from_loc (line_table, loc).m_finish;
kono
parents: 67
diff changeset
108 }
kono
parents: 67
diff changeset
109
kono
parents: 67
diff changeset
110 extern location_t make_location (location_t caret,
kono
parents: 67
diff changeset
111 location_t start, location_t finish);
kono
parents: 67
diff changeset
112 extern location_t make_location (location_t caret, source_range src_range);
kono
parents: 67
diff changeset
113
kono
parents: 67
diff changeset
114 void dump_line_table_statistics (void);
kono
parents: 67
diff changeset
115
kono
parents: 67
diff changeset
116 void dump_location_info (FILE *stream);
kono
parents: 67
diff changeset
117
kono
parents: 67
diff changeset
118 void diagnostics_file_cache_fini (void);
kono
parents: 67
diff changeset
119
kono
parents: 67
diff changeset
120 void diagnostics_file_cache_forcibly_evict_file (const char *file_path);
kono
parents: 67
diff changeset
121
kono
parents: 67
diff changeset
122 struct GTY(()) string_concat
kono
parents: 67
diff changeset
123 {
kono
parents: 67
diff changeset
124 string_concat (int num, location_t *locs);
kono
parents: 67
diff changeset
125
kono
parents: 67
diff changeset
126 int m_num;
kono
parents: 67
diff changeset
127 location_t * GTY ((atomic)) m_locs;
kono
parents: 67
diff changeset
128 };
kono
parents: 67
diff changeset
129
kono
parents: 67
diff changeset
130 struct location_hash : int_hash <location_t, UNKNOWN_LOCATION> { };
kono
parents: 67
diff changeset
131
kono
parents: 67
diff changeset
132 class GTY(()) string_concat_db
kono
parents: 67
diff changeset
133 {
kono
parents: 67
diff changeset
134 public:
kono
parents: 67
diff changeset
135 string_concat_db ();
kono
parents: 67
diff changeset
136 void record_string_concatenation (int num, location_t *locs);
kono
parents: 67
diff changeset
137
kono
parents: 67
diff changeset
138 bool get_string_concatenation (location_t loc,
kono
parents: 67
diff changeset
139 int *out_num,
kono
parents: 67
diff changeset
140 location_t **out_locs);
kono
parents: 67
diff changeset
141
kono
parents: 67
diff changeset
142 private:
kono
parents: 67
diff changeset
143 static location_t get_key_loc (location_t loc);
kono
parents: 67
diff changeset
144
kono
parents: 67
diff changeset
145 /* For the fields to be private, we must grant access to the
kono
parents: 67
diff changeset
146 generated code in gtype-desc.c. */
kono
parents: 67
diff changeset
147
kono
parents: 67
diff changeset
148 friend void ::gt_ggc_mx_string_concat_db (void *x_p);
kono
parents: 67
diff changeset
149 friend void ::gt_pch_nx_string_concat_db (void *x_p);
kono
parents: 67
diff changeset
150 friend void ::gt_pch_p_16string_concat_db (void *this_obj, void *x_p,
kono
parents: 67
diff changeset
151 gt_pointer_operator op,
kono
parents: 67
diff changeset
152 void *cookie);
kono
parents: 67
diff changeset
153
kono
parents: 67
diff changeset
154 hash_map <location_hash, string_concat *> *m_table;
kono
parents: 67
diff changeset
155 };
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 #endif