xref: /dflybsd-src/contrib/gcc-4.7/gcc/input.h (revision 04febcfb30580676d3e95f58a16c5137ee478b32)
1*e4b17023SJohn Marino /* Declarations for variables relating to reading the source file.
2*e4b17023SJohn Marino    Used by parsers, lexical analyzers, and error message routines.
3*e4b17023SJohn Marino    Copyright (C) 1993, 1997, 1998, 2000, 2003, 2004, 2007, 2008, 2009, 2010
4*e4b17023SJohn Marino    Free Software Foundation, Inc.
5*e4b17023SJohn Marino 
6*e4b17023SJohn Marino This file is part of GCC.
7*e4b17023SJohn Marino 
8*e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify it under
9*e4b17023SJohn Marino the terms of the GNU General Public License as published by the Free
10*e4b17023SJohn Marino Software Foundation; either version 3, or (at your option) any later
11*e4b17023SJohn Marino version.
12*e4b17023SJohn Marino 
13*e4b17023SJohn Marino GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14*e4b17023SJohn Marino WARRANTY; without even the implied warranty of MERCHANTABILITY or
15*e4b17023SJohn Marino FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16*e4b17023SJohn Marino for more details.
17*e4b17023SJohn Marino 
18*e4b17023SJohn Marino You should have received a copy of the GNU General Public License
19*e4b17023SJohn Marino along with GCC; see the file COPYING3.  If not see
20*e4b17023SJohn Marino <http://www.gnu.org/licenses/>.  */
21*e4b17023SJohn Marino 
22*e4b17023SJohn Marino #ifndef GCC_INPUT_H
23*e4b17023SJohn Marino #define GCC_INPUT_H
24*e4b17023SJohn Marino 
25*e4b17023SJohn Marino #include "line-map.h"
26*e4b17023SJohn Marino 
27*e4b17023SJohn Marino extern GTY(()) struct line_maps *line_table;
28*e4b17023SJohn Marino 
29*e4b17023SJohn Marino /* A value which will never be used to represent a real location.  */
30*e4b17023SJohn Marino #define UNKNOWN_LOCATION ((source_location) 0)
31*e4b17023SJohn Marino 
32*e4b17023SJohn Marino /* The location for declarations in "<built-in>" */
33*e4b17023SJohn Marino #define BUILTINS_LOCATION ((source_location) 1)
34*e4b17023SJohn Marino 
35*e4b17023SJohn Marino /* line-map.c reserves RESERVED_LOCATION_COUNT to the user.  Ensure
36*e4b17023SJohn Marino    both UNKNOWN_LOCATION and BUILTINS_LOCATION fit into that.  */
37*e4b17023SJohn Marino extern char builtins_location_check[(BUILTINS_LOCATION
38*e4b17023SJohn Marino 				     < RESERVED_LOCATION_COUNT) ? 1 : -1];
39*e4b17023SJohn Marino 
40*e4b17023SJohn Marino extern expanded_location expand_location (source_location);
41*e4b17023SJohn Marino 
42*e4b17023SJohn Marino /* Historically GCC used location_t, while cpp used source_location.
43*e4b17023SJohn Marino    This could be removed but it hardly seems worth the effort.  */
44*e4b17023SJohn Marino typedef source_location location_t;
45*e4b17023SJohn Marino 
46*e4b17023SJohn Marino extern location_t input_location;
47*e4b17023SJohn Marino 
48*e4b17023SJohn Marino #define LOCATION_FILE(LOC) ((expand_location (LOC)).file)
49*e4b17023SJohn Marino #define LOCATION_LINE(LOC) ((expand_location (LOC)).line)
50*e4b17023SJohn Marino #define LOCATION_COLUMN(LOC)((expand_location (LOC)).column)
51*e4b17023SJohn Marino 
52*e4b17023SJohn Marino #define input_line LOCATION_LINE (input_location)
53*e4b17023SJohn Marino #define input_filename LOCATION_FILE (input_location)
54*e4b17023SJohn Marino #define in_system_header_at(LOC) \
55*e4b17023SJohn Marino   ((linemap_location_in_system_header_p (line_table, LOC)))
56*e4b17023SJohn Marino #define in_system_header (in_system_header_at (input_location))
57*e4b17023SJohn Marino 
58*e4b17023SJohn Marino void dump_line_table_statistics (void);
59*e4b17023SJohn Marino 
60*e4b17023SJohn Marino #endif
61