ChangeLog/libgcc
[official-gcc.git] / gcc / input.h
blobefdfbd33854bcd50ef10ad9aab086332acd45471
1 /* Declarations for variables relating to reading the source file.
2 Used by parsers, lexical analyzers, and error message routines.
3 Copyright (C) 1993, 1997, 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
20 02110-1301, USA. */
22 #ifndef GCC_INPUT_H
23 #define GCC_INPUT_H
25 #include "line-map.h"
26 extern struct line_maps line_table;
28 /* The location for declarations in "<built-in>" */
29 #define BUILTINS_LOCATION ((source_location) 2)
31 /* Note: if any of the types defined inside this #ifdef are changed,
32 gengtype.c:define_location_structures must be updated to match. */
34 #ifdef USE_MAPPED_LOCATION
36 typedef struct
38 /* The name of the source file involved. */
39 const char *file;
41 /* The line-location in the source file. */
42 int line;
44 int column;
45 } expanded_location;
47 extern expanded_location expand_location (source_location);
49 #define UNKNOWN_LOCATION ((source_location) 0)
50 typedef source_location location_t; /* deprecated typedef */
51 typedef source_location source_locus; /* to be removed */
53 #else /* ! USE_MAPPED_LOCATION */
55 struct location_s GTY(())
57 /* The name of the source file involved. */
58 const char *file;
60 /* The line-location in the source file. */
61 int line;
64 typedef struct location_s expanded_location;
65 typedef struct location_s location_t;
66 typedef location_t *source_locus;
68 #define expand_location(FILELINE) (FILELINE)
69 extern location_t unknown_location;
70 #define UNKNOWN_LOCATION unknown_location
72 #endif /* ! USE_MAPPED_LOCATION */
74 struct file_stack
76 struct file_stack *next;
77 location_t location;
80 /* Top-level source file. */
81 extern const char *main_input_filename;
83 extern location_t input_location;
84 #ifdef USE_MAPPED_LOCATION
85 extern void push_srcloc (location_t);
86 #else /* ! USE_MAPPED_LOCATION */
87 extern void push_srcloc (const char *name, int line);
88 #endif /* ! USE_MAPPED_LOCATION */
89 extern void pop_srcloc (void);
90 extern void restore_input_file_stack (int);
92 #define LOCATION_FILE(LOC) ((expand_location (LOC)).file)
93 #define LOCATION_LINE(LOC) ((expand_location (LOC)).line)
95 #define input_line LOCATION_LINE(input_location)
96 #define input_filename LOCATION_FILE(input_location)
98 /* Stack of currently pending input files.
99 The line member is not accurate for the innermost file on the stack. */
100 extern struct file_stack *input_file_stack;
102 /* Incremented on each change to input_file_stack. */
103 extern int input_file_stack_tick;
105 /* The number of bits available for input_file_stack_tick. */
106 #define INPUT_FILE_STACK_BITS 31
108 #endif