aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplib.h
diff options
context:
space:
mode:
authorZack Weinberg <zack@rabi.phys.columbia.edu>1998-12-07 13:35:20 +0000
committerDave Brolley <brolley@gcc.gnu.org>1998-12-07 08:35:20 -0500
commitf1a86df6cbc181439d3c1b402275110c9debd76d (patch)
tree8639ccd7c1c382473eaf051751bf1a983dde27b5 /gcc/cpplib.h
parent93447205e549088d1d5208e82462b5f681030632 (diff)
downloadgcc-f1a86df6cbc181439d3c1b402275110c9debd76d.zip
gcc-f1a86df6cbc181439d3c1b402275110c9debd76d.tar.gz
gcc-f1a86df6cbc181439d3c1b402275110c9debd76d.tar.bz2
cpplib.h (struct cpp_buffer): Replace dir and dlen members with a struct file_name_list pointer.
1998-11-26 01:17 -0500 Zack Weinberg <zack@rabi.phys.columbia.edu> * cpplib.h (struct cpp_buffer): Replace dir and dlen members with a struct file_name_list pointer. (struct cpp_reader): Add pointer to chain of `actual directory' include searchpath entries. (struct file_name_list): Add *alloc pointer for the sake of the actual-directory chain. Move definition of HOST_WIDE_INT here. (cpp_parse_escape): Change prototype to match changes in cppexp.c. * cppfiles.c (actual_directory): New function. (finclude): Use it to initialize the buffer's actual_dir entry. (find_include_file): We don't need to fix up max_include_len here. * cpplib.c (do_include): Don't allocate a file_name_list on the fly for current directory "" includes, use the one that's been preallocated in pfile->buffer->actual_dir. Hoist out duplicate code from the search_start selection logic. (cpp_reader_init): Initialize pfile->actual_dirs. Remove definition of HOST_WIDE_INT. Change calls to cpp_parse_escape to match changes in cppexp.c (note hardcoded MASK, which is safe since this is the source character set). * cppexp.c: Bring over changes to cpp_parse_escape from cccp.c to handle wide character constants in #if directives. The function now returns a HOST_WIDE_INT, and takes a third argument which is a binary mask for all legal values (0x00ff for 8-bit `char', 0xffff for 16-bit `wchar_t', etc.) Define MAX_CHAR_TYPE_MASK and MAX_WCHAR_TYPE_MASK. Change callers of cpp_parse_escape to match. [Fixes c-torture/execute/widechar-1.c] From-SVN: r24153
Diffstat (limited to 'gcc/cpplib.h')
-rw-r--r--gcc/cpplib.h33
1 files changed, 30 insertions, 3 deletions
diff --git a/gcc/cpplib.h b/gcc/cpplib.h
index fe28102..3cb2753 100644
--- a/gcc/cpplib.h
+++ b/gcc/cpplib.h
@@ -110,8 +110,7 @@ struct cpp_buffer {
/* Filename specified with #line command. */
char *nominal_fname;
/* Actual directory of this file, used only for "" includes */
- char *dir;
- size_t dlen;
+ struct file_name_list *actual_dir;
/* Pointer into the include hash table. Used for include_next and
to record control macros.
@@ -182,6 +181,10 @@ struct cpp_reader {
#define ALL_INCLUDE_HASHSIZE 71
struct include_hash *all_include_files[ALL_INCLUDE_HASHSIZE];
+ /* Chain of `actual directory' file_name_list entries,
+ for "" inclusion. */
+ struct file_name_list *actual_dirs;
+
/* Current maximum length of directory names in the search path
for include files. (Altered as we get more of them.) */
unsigned int max_include_len;
@@ -485,6 +488,8 @@ struct cpp_options {
struct file_name_list
{
struct file_name_list *next;
+ struct file_name_list *alloc; /* for the cache of
+ current directory entries */
char *name;
unsigned int nlen;
/* We use these to tell if the directory mentioned here is a duplicate
@@ -656,6 +661,28 @@ struct if_stack {
};
typedef struct if_stack IF_STACK_FRAME;
+/* Find the largest host integer type and set its size and type.
+ Watch out: on some crazy hosts `long' is shorter than `int'. */
+
+#ifndef HOST_WIDE_INT
+# if HAVE_INTTYPES_H
+# include <inttypes.h>
+# define HOST_WIDE_INT intmax_t
+# else
+# if (HOST_BITS_PER_LONG <= HOST_BITS_PER_INT \
+ && HOST_BITS_PER_LONGLONG <= HOST_BITS_PER_INT)
+# define HOST_WIDE_INT int
+# else
+# if (HOST_BITS_PER_LONGLONG <= HOST_BITS_PER_LONG \
+ || ! (defined LONG_LONG_MAX || defined LLONG_MAX))
+# define HOST_WIDE_INT long
+# else
+# define HOST_WIDE_INT long long
+# endif
+# endif
+# endif
+#endif
+
extern void cpp_buf_line_and_col PARAMS((cpp_buffer *, long *, long *));
extern cpp_buffer* cpp_file_buffer PARAMS((cpp_reader *));
extern void cpp_define PARAMS ((cpp_reader*, unsigned char *));
@@ -678,7 +705,7 @@ extern void cpp_perror_with_name PROTO ((cpp_reader *, const char *));
extern void v_cpp_message PROTO ((cpp_reader *, int, const char *, va_list));
extern void cpp_grow_buffer PARAMS ((cpp_reader *, long));
-extern int cpp_parse_escape PARAMS ((cpp_reader *, char **));
+extern HOST_WIDE_INT cpp_parse_escape PARAMS ((cpp_reader *, char **, HOST_WIDE_INT));
extern cpp_buffer *cpp_push_buffer PARAMS ((cpp_reader *,
unsigned char *, long));
extern cpp_buffer *cpp_pop_buffer PARAMS ((cpp_reader *));