Commit 5538ada6 by Zack Weinberg Committed by Dave Brolley

cpplib.c (initialize_char_syntax): Move to cppinit.c.

1999-02-04 14:33 -0500  Zack Weinberg  <zack@rabi.phys.columbia.edu>
	* cpplib.c (initialize_char_syntax): Move to cppinit.c.
	(cpp_define): Remove redundant syntax checks.
	(make_assertion): Rename cpp_assert, remove redundant syntax
	checks, export.
	(cpp_options_init): Don't init things to zero twice.
	(cpp_expand_to_buffer): Use memcpy, not a char-by-char loop.
	(do_include): Kill excessively verbose import warning that
	snuck back in in the gcc2 merge.
	(convert_string): Removed.
	(do_line): Rewrite with simple last-name-used cache instead of
	private hashtable.
	(cpp_start_read): Call initialize_char_syntax here, not...
	(cpp_reader_init): ...here.
	(cpp_handle_options): Support the -std switch.
	* cpplib.h (cpp_buffer): Add last_nominal_fname member.
	(cpp_options): Add c9x flag.
	Declare all the is_* tables and trigraph table here, as const.
	Prototype cpp_assert and initialize_char_syntax.
	* cppinit.c: New file.
	* cppfiles.c (read_and_prescan): Optimize.
	* Makefile.in (LIBCPP_OBJS): Add cppinit.o.

From-SVN: r25024
parent c20df9e7
...@@ -873,10 +873,10 @@ stamp-objlist: $(OBJS) ...@@ -873,10 +873,10 @@ stamp-objlist: $(OBJS)
# We call this executable `xgcc' rather than `gcc' # We call this executable `xgcc' rather than `gcc'
# to avoid confusion if the current directory is in the path # to avoid confusion if the current directory is in the path
# and CC is `gcc'. It is renamed to `gcc' when it is installed. # and CC is `gcc'. It is renamed to `gcc' when it is installed.
xgcc$(exeext): gcc.o version.o intl.o prefix.o \ xgcc$(exeext): gcc.o version.o choose-temp.o intl.o pexecute.o prefix.o \
version.o $(LIBDEPS) $(EXTRA_GCC_OBJS) version.o mkstemp.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o prefix.o version.o \ $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o prefix.o version.o \
$(EXTRA_GCC_OBJS) $(LIBS) choose-temp.o pexecute.o mkstemp.o $(EXTRA_GCC_OBJS) $(LIBS)
# Dump a specs file to make -B./ read these specs over installed ones. # Dump a specs file to make -B./ read these specs over installed ones.
specs: xgcc$(exeext) specs: xgcc$(exeext)
...@@ -1337,11 +1337,11 @@ graph.o: graph.c $(CONFIG_H) system.h toplev.h flags.h output.h $(RTL_H) \ ...@@ -1337,11 +1337,11 @@ graph.o: graph.c $(CONFIG_H) system.h toplev.h flags.h output.h $(RTL_H) \
hard-reg-set.h $(BASIC_BLOCK_H) hard-reg-set.h $(BASIC_BLOCK_H)
sbitmap.o: sbitmap.c $(CONFIG_H) system.h $(RTL_H) flags.h $(BASIC_BLOCK_H) sbitmap.o: sbitmap.c $(CONFIG_H) system.h $(RTL_H) flags.h $(BASIC_BLOCK_H)
collect2$(exeext): collect2.o tlink.o hash.o underscore.o \ collect2$(exeext): collect2.o tlink.o hash.o cplus-dem.o underscore.o \
version.o $(LIBDEPS) version.o choose-temp.o mkstemp.o $(LIBDEPS)
COLLECT2_OBJS = collect2.o tlink.o hash.o \ COLLECT2_OBJS = collect2.o tlink.o hash.o choose-temp.o cplus-dem.o \
intl.o underscore.o version.o intl.o underscore.o version.o mkstemp.o
collect2 : $(COLLECT2_OBJS) $(LIBDEPS) collect2 : $(COLLECT2_OBJS) $(LIBDEPS)
# Don't try modifying collect2 (aka ld) in place--it might be linking this. # Don't try modifying collect2 (aka ld) in place--it might be linking this.
-rm -f collect2$(exeext) -rm -f collect2$(exeext)
...@@ -1356,6 +1356,16 @@ collect2.o : collect2.c $(CONFIG_H) system.h gstab.h intl.h \ ...@@ -1356,6 +1356,16 @@ collect2.o : collect2.c $(CONFIG_H) system.h gstab.h intl.h \
tlink.o: tlink.c $(DEMANGLE_H) hash.h $(CONFIG_H) system.h toplev.h collect2.h tlink.o: tlink.c $(DEMANGLE_H) hash.h $(CONFIG_H) system.h toplev.h collect2.h
hash.o: hash.c hash.h system.h toplev.h hash.o: hash.c hash.h system.h toplev.h
cplus-dem.o: $(srcdir)/../libiberty/cplus-dem.c $(DEMANGLE_H)
rm -f cplus-dem.c
$(LN_S) $(srcdir)/../libiberty/cplus-dem.c cplus-dem.c
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) cplus-dem.c
pexecute.o: $(srcdir)/../libiberty/pexecute.c $(CONFIG_H) system.h
rm -f pexecute.c
$(LN_S) $(srcdir)/../libiberty/pexecute.c pexecute.c
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) pexecute.c
vfprintf.o: $(srcdir)/../libiberty/vfprintf.c $(CONFIG_H) system.h vfprintf.o: $(srcdir)/../libiberty/vfprintf.c $(CONFIG_H) system.h
rm -f vfprintf.c rm -f vfprintf.c
$(LN_S) $(srcdir)/../libiberty/vfprintf.c vfprintf.c $(LN_S) $(srcdir)/../libiberty/vfprintf.c vfprintf.c
...@@ -1423,6 +1433,16 @@ obstack.o: $(srcdir)/../libiberty/obstack.c $(CONFIG_H) ...@@ -1423,6 +1433,16 @@ obstack.o: $(srcdir)/../libiberty/obstack.c $(CONFIG_H)
$(LN_S) $(srcdir)/../libiberty/obstack.c obstack.c $(LN_S) $(srcdir)/../libiberty/obstack.c obstack.c
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) obstack.c $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) obstack.c
choose-temp.o: $(srcdir)/../libiberty/choose-temp.c $(CONFIG_H) system.h
rm -f choose-temp.c
$(LN_S) $(srcdir)/../libiberty/choose-temp.c choose-temp.c
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) choose-temp.c
mkstemp.o: $(srcdir)/../libiberty/mkstemp.c $(CONFIG_H) system.h
rm -f mkstemp.c
$(LN_S) $(srcdir)/../libiberty/mkstemp.c mkstemp.c
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) mkstemp.c
prefix.o: prefix.c $(CONFIG_H) system.h Makefile prefix.h prefix.o: prefix.c $(CONFIG_H) system.h Makefile prefix.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-DPREFIX=\"$(prefix)\" \ -DPREFIX=\"$(prefix)\" \
...@@ -1959,7 +1979,7 @@ cccp.o: cccp.c $(CONFIG_H) intl.h pcp.h version.c config.status system.h \ ...@@ -1959,7 +1979,7 @@ cccp.o: cccp.c $(CONFIG_H) intl.h pcp.h version.c config.status system.h \
-c `echo $(srcdir)/cccp.c | sed 's,^\./,,'` -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
LIBCPP_OBJS = cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o cppfiles.o \ LIBCPP_OBJS = cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o cppfiles.o \
cppulp.o prefix.o version.o mbchar.o @extra_cpp_objs@ intl.o cppinit.o cppulp.o prefix.o version.o mbchar.o @extra_cpp_objs@
# All the other archives built/used by this makefile are for targets. This # All the other archives built/used by this makefile are for targets. This
# one is strictly for the host. # one is strictly for the host.
...@@ -1996,12 +2016,15 @@ cpphash.o: cpphash.c cpplib.h machmode.h cpphash.h $(CONFIG_H) system.h ...@@ -1996,12 +2016,15 @@ cpphash.o: cpphash.c cpplib.h machmode.h cpphash.h $(CONFIG_H) system.h
cppalloc.o: cppalloc.c $(CONFIG_H) cpplib.h machmode.h system.h cppalloc.o: cppalloc.c $(CONFIG_H) cpplib.h machmode.h system.h
cppinit.o: cppalloc.c $(CONFIG_H) cpplib.h machmode.h system.h
# Note for the stamp targets, we run the program `true' instead of # Note for the stamp targets, we run the program `true' instead of
# having an empty command (nothing following the semicolon). # having an empty command (nothing following the semicolon).
proto: config.status protoize$(exeext) unprotoize$(exeext) SYSCALLS.c.X proto: config.status protoize$(exeext) unprotoize$(exeext) SYSCALLS.c.X
PROTO_OBJS = getpwd.o intl.o version.o PROTO_OBJS = choose-temp.o getopt.o getopt1.o getpwd.o \
intl.o pexecute.o version.o mkstemp.o
protoize$(exeext): protoize.o $(PROTO_OBJS) $(LIBDEPS) protoize$(exeext): protoize.o $(PROTO_OBJS) $(LIBDEPS)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ protoize.o $(PROTO_OBJS) $(LIBS) $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ protoize.o $(PROTO_OBJS) $(LIBS)
...@@ -2031,6 +2054,16 @@ unprotoize.o: unprotoize.c protoize.c $(srcdir)/../include/getopt.h \ ...@@ -2031,6 +2054,16 @@ unprotoize.o: unprotoize.c protoize.c $(srcdir)/../include/getopt.h \
-DSTD_PROTO_DIR=\"$(libsubdir)\" \ -DSTD_PROTO_DIR=\"$(libsubdir)\" \
$(srcdir)/unprotoize.c $(srcdir)/unprotoize.c
getopt.o: $(srcdir)/../libiberty/getopt.c $(srcdir)/../include/getopt.h
rm -f getopt.c
$(LN_S) $(srcdir)/../libiberty/getopt.c getopt.c
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) getopt.c
getopt1.o: $(srcdir)/../libiberty/getopt1.c $(srcdir)/../include/getopt.h
rm -f getopt1.c
$(LN_S) $(srcdir)/../libiberty/getopt1.c getopt1.c
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) getopt1.c
# This info describes the target machine, so compile with GCC just built. # This info describes the target machine, so compile with GCC just built.
SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES) \ SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES) \
stmp-int-hdrs stmp-int-hdrs
......
...@@ -814,12 +814,11 @@ read_and_prescan (pfile, fp, desc, len) ...@@ -814,12 +814,11 @@ read_and_prescan (pfile, fp, desc, len)
int desc; int desc;
size_t len; size_t len;
{ {
U_CHAR *buf = (U_CHAR *) xmalloc (len); U_CHAR *buf = (U_CHAR *) xmalloc (len);
U_CHAR *ip, *op, *line_base; U_CHAR *ip, *op, *line_base;
U_CHAR *ibase; U_CHAR *ibase;
unsigned int line; unsigned int line;
int count, seen_eof; int count;
size_t offset; size_t offset;
/* 4096 bytes of buffer proper, 2 to detect running off the end without /* 4096 bytes of buffer proper, 2 to detect running off the end without
address arithmetic all the time, and 2 for pushback in the case there's address arithmetic all the time, and 2 for pushback in the case there's
...@@ -832,35 +831,35 @@ read_and_prescan (pfile, fp, desc, len) ...@@ -832,35 +831,35 @@ read_and_prescan (pfile, fp, desc, len)
line_base = buf; line_base = buf;
line = 1; line = 1;
ibase = intermed + 2; ibase = intermed + 2;
seen_eof = 0;
for (;;) for (;;)
{ {
read_next: read_next:
count = read (desc, intermed + 2, INTERMED_BUFFER_SIZE); count = read (desc, intermed + 2, INTERMED_BUFFER_SIZE);
if (count < 0) if (count < 0)
goto error; goto error;
if (count == 0) else if (count == 0)
seen_eof = 1;
count += 2 - (ibase - intermed);
if (count == 0)
break; break;
offset += count;
ip = ibase; ip = ibase;
ip[count] = ip[count+1] = '\0';
ibase = intermed + 2; ibase = intermed + 2;
offset += count; ibase[count] = ibase[count+1] = '\0';
if (offset > len) if (offset > len)
{ {
size_t delta_op = op - buf; size_t delta_op;
size_t delta_line_base = line_base - buf; size_t delta_line_base;
len *= 2; len *= 2;
if (offset > len) if (offset > len)
/* len overflowed. /* len overflowed.
This could happen if the file is larger than half the This could happen if the file is larger than half the
maximum address space of the machine. */ maximum address space of the machine. */
goto too_big; goto too_big;
delta_op = op - buf;
delta_line_base = line_base - buf;
buf = xrealloc (buf, len); buf = xrealloc (buf, len);
op = buf + delta_op; op = buf + delta_op;
line_base = buf + delta_line_base; line_base = buf + delta_line_base;
...@@ -868,7 +867,7 @@ read_and_prescan (pfile, fp, desc, len) ...@@ -868,7 +867,7 @@ read_and_prescan (pfile, fp, desc, len)
for (;;) for (;;)
{ {
U_CHAR c; unsigned int c;
c = *ip++; c = *ip++;
switch (c) switch (c)
{ {
...@@ -880,16 +879,14 @@ read_and_prescan (pfile, fp, desc, len) ...@@ -880,16 +879,14 @@ read_and_prescan (pfile, fp, desc, len)
break; break;
case '\0': case '\0':
if (seen_eof)
goto eof;
else
goto read_next; goto read_next;
case '\r': case '\r':
if (*ip == '\n') ip++; if (*ip == '\n') ip++;
else if (*ip == '\0' && !seen_eof) else if (*ip == '\0')
{ {
*--ibase = '\r'; --ibase;
break; intermed[1] = '\r';
goto read_next;
} }
*op++ = '\n'; *op++ = '\n';
line++; line++;
...@@ -898,10 +895,11 @@ read_and_prescan (pfile, fp, desc, len) ...@@ -898,10 +895,11 @@ read_and_prescan (pfile, fp, desc, len)
case '\n': case '\n':
if (*ip == '\r') ip++; if (*ip == '\r') ip++;
else if (*ip == '\0' && !seen_eof) else if (*ip == '\0')
{ {
*--ibase = '\n'; --ibase;
break; intermed[1] = '\n';
goto read_next;
} }
*op++ = '\n'; *op++ = '\n';
line++; line++;
...@@ -912,28 +910,30 @@ read_and_prescan (pfile, fp, desc, len) ...@@ -912,28 +910,30 @@ read_and_prescan (pfile, fp, desc, len)
if (CPP_OPTIONS (pfile)->trigraphs if (CPP_OPTIONS (pfile)->trigraphs
|| CPP_OPTIONS (pfile)->warn_trigraphs) || CPP_OPTIONS (pfile)->warn_trigraphs)
{ {
unsigned int d;
/* If we're at the end of the intermediate buffer, /* If we're at the end of the intermediate buffer,
we have to shift the ?'s down to the start and we have to shift the ?'s down to the start and
come back next pass. */ come back next pass. */
c = ip[0]; d = ip[0];
if (c == '\0' && !seen_eof) if (d == '\0')
{ {
*--ibase = '?'; --ibase;
break; intermed[1] = '?';
goto read_next;
} }
if (c != '?') if (d != '?')
{ {
*op++ = '?'; *op++ = '?';
break; break;
} }
c = ip[1]; d = ip[1];
if (c == '\0' && !seen_eof) if (d == '\0')
{ {
*--ibase = '?'; ibase -= 2;
*--ibase = '?'; intermed[0] = intermed[1] = '?';
break; goto read_next;
} }
if (!trigraph_table[c]) if (!trigraph_table[d])
{ {
*op++ = '?'; *op++ = '?';
break; break;
...@@ -941,33 +941,47 @@ read_and_prescan (pfile, fp, desc, len) ...@@ -941,33 +941,47 @@ read_and_prescan (pfile, fp, desc, len)
if (CPP_OPTIONS (pfile)->warn_trigraphs) if (CPP_OPTIONS (pfile)->warn_trigraphs)
cpp_warning_with_line (pfile, line, op-line_base, cpp_warning_with_line (pfile, line, op-line_base,
"trigraph ??%c encountered", c); "trigraph ??%c encountered", d);
if (CPP_OPTIONS (pfile)->trigraphs) if (CPP_OPTIONS (pfile)->trigraphs)
{ *op++ = trigraph_table[d];
*op++ = trigraph_table[c];
ip += 2;
break;
}
else else
{ {
*op++ = '?'; *op++ = '?';
*op++ = '?'; *op++ = '?';
*op++ = c; *op++ = d;
ip += 2;
} }
ip += 2;
} }
else else
*op++ = c; *op++ = c;
} }
} }
} }
eof:
if (op == buf) if (offset == 0)
return 0; return 0;
/* Deal with pushed-back chars at true EOF.
If two chars were pushed back, they must both be ?'s.
If one was, it might be ?, \r, or \n, and \r needs to
become \n.
We know we have space already. */
if (ibase == intermed)
{
*op++ = '?';
*op++ = '?';
}
else if (ibase == intermed + 1)
{
if (*ibase == '?')
*op++ = '?';
else
*op++ = '\n';
}
if (op[-1] != '\n' || op[-2] == '\\') if (op[-1] != '\n' || op[-2] == '\\')
{ {
if (CPP_PEDANTIC (pfile))
cpp_pedwarn_with_line (pfile, line, op - line_base, cpp_pedwarn_with_line (pfile, line, op - line_base,
"no newline at end of file"); "no newline at end of file");
if (offset + 2 > len) if (offset + 2 > len)
...@@ -983,8 +997,7 @@ read_and_prescan (pfile, fp, desc, len) ...@@ -983,8 +997,7 @@ read_and_prescan (pfile, fp, desc, len)
*op++ = '\n'; *op++ = '\n';
} }
buf = xrealloc (buf, op - buf); fp->buf = (len - offset < 20) ? buf : xrealloc (buf, op - buf);
fp->buf = buf;
return op - buf; return op - buf;
too_big: too_big:
......
/* CPP Library.
Copyright (C) 1986, 87, 89, 92-98, 1999 Free Software Foundation, Inc.
Contributed by Per Bothner, 1994-95.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This file will have more stuff in it eventually, but right now
we just have one hack: we move all the is_* table initialization
in here, and we can declare them const in cpplib.h, which improves
code a bit. */
#include "config.h"
#include "system.h"
typedef unsigned char U_CHAR;
/* table to tell if char can be part of a C identifier. */
U_CHAR is_idchar[256] = { 0 };
/* table to tell if char can be first char of a c identifier. */
U_CHAR is_idstart[256] = { 0 };
/* table to tell if c is horizontal space. */
U_CHAR is_hor_space[256] = { 0 };
/* table to tell if c is horizontal or vertical space. */
U_CHAR is_space[256] = { 0 };
/* Table to handle trigraph conversion, which occurs before all other
processing, everywhere in the file. (This is necessary since one
of the trigraphs encodes backslash.) Note it's off by default.
from to from to from to
?? = # ?? ) ] ?? ! |
?? ( [ ?? ' ^ ?? > }
?? / \ ?? < { ?? - ~
There is not a space between the ?? and the third char. I put spaces
there to avoid warnings when compiling this file. */
U_CHAR trigraph_table[256] = { 0 };
/* Initialize syntactic classifications of characters. */
void
initialize_char_syntax (int dollar_in_ident)
{
is_idstart['a'] = 1; is_idstart['b'] = 1; is_idstart['c'] = 1;
is_idstart['d'] = 1; is_idstart['e'] = 1; is_idstart['f'] = 1;
is_idstart['g'] = 1; is_idstart['h'] = 1; is_idstart['i'] = 1;
is_idstart['j'] = 1; is_idstart['k'] = 1; is_idstart['l'] = 1;
is_idstart['m'] = 1; is_idstart['n'] = 1; is_idstart['o'] = 1;
is_idstart['p'] = 1; is_idstart['q'] = 1; is_idstart['r'] = 1;
is_idstart['s'] = 1; is_idstart['t'] = 1; is_idstart['u'] = 1;
is_idstart['v'] = 1; is_idstart['w'] = 1; is_idstart['x'] = 1;
is_idstart['y'] = 1; is_idstart['z'] = 1;
is_idstart['A'] = 1; is_idstart['B'] = 1; is_idstart['C'] = 1;
is_idstart['D'] = 1; is_idstart['E'] = 1; is_idstart['F'] = 1;
is_idstart['G'] = 1; is_idstart['H'] = 1; is_idstart['I'] = 1;
is_idstart['J'] = 1; is_idstart['K'] = 1; is_idstart['L'] = 1;
is_idstart['M'] = 1; is_idstart['N'] = 1; is_idstart['O'] = 1;
is_idstart['P'] = 1; is_idstart['Q'] = 1; is_idstart['R'] = 1;
is_idstart['S'] = 1; is_idstart['T'] = 1; is_idstart['U'] = 1;
is_idstart['V'] = 1; is_idstart['W'] = 1; is_idstart['X'] = 1;
is_idstart['Y'] = 1; is_idstart['Z'] = 1;
is_idstart['_'] = 1;
is_idchar['a'] = 1; is_idchar['b'] = 1; is_idchar['c'] = 1;
is_idchar['d'] = 1; is_idchar['e'] = 1; is_idchar['f'] = 1;
is_idchar['g'] = 1; is_idchar['h'] = 1; is_idchar['i'] = 1;
is_idchar['j'] = 1; is_idchar['k'] = 1; is_idchar['l'] = 1;
is_idchar['m'] = 1; is_idchar['n'] = 1; is_idchar['o'] = 1;
is_idchar['p'] = 1; is_idchar['q'] = 1; is_idchar['r'] = 1;
is_idchar['s'] = 1; is_idchar['t'] = 1; is_idchar['u'] = 1;
is_idchar['v'] = 1; is_idchar['w'] = 1; is_idchar['x'] = 1;
is_idchar['y'] = 1; is_idchar['z'] = 1;
is_idchar['A'] = 1; is_idchar['B'] = 1; is_idchar['C'] = 1;
is_idchar['D'] = 1; is_idchar['E'] = 1; is_idchar['F'] = 1;
is_idchar['G'] = 1; is_idchar['H'] = 1; is_idchar['I'] = 1;
is_idchar['J'] = 1; is_idchar['K'] = 1; is_idchar['L'] = 1;
is_idchar['M'] = 1; is_idchar['N'] = 1; is_idchar['O'] = 1;
is_idchar['P'] = 1; is_idchar['Q'] = 1; is_idchar['R'] = 1;
is_idchar['S'] = 1; is_idchar['T'] = 1; is_idchar['U'] = 1;
is_idchar['V'] = 1; is_idchar['W'] = 1; is_idchar['X'] = 1;
is_idchar['Y'] = 1; is_idchar['Z'] = 1;
is_idchar['1'] = 1; is_idchar['2'] = 1; is_idchar['3'] = 1;
is_idchar['4'] = 1; is_idchar['5'] = 1; is_idchar['6'] = 1;
is_idchar['7'] = 1; is_idchar['8'] = 1; is_idchar['9'] = 1;
is_idchar['0'] = 1;
is_idchar['_'] = 1;
/* These will be reset later if -$ is in effect. */
is_idchar['$'] = dollar_in_ident;
is_idstart['$'] = dollar_in_ident;
/* horizontal space table */
is_hor_space[' '] = 1;
is_hor_space['\t'] = 1;
is_hor_space['\v'] = 1;
is_hor_space['\f'] = 1;
is_hor_space['\r'] = 1;
is_space[' '] = 1;
is_space['\t'] = 1;
is_space['\v'] = 1;
is_space['\f'] = 1;
is_space['\n'] = 1;
is_space['\r'] = 1;
/* trigraph conversion */
trigraph_table['='] = '#'; trigraph_table[')'] = ']';
trigraph_table['!'] = '|'; trigraph_table['('] = '[';
trigraph_table['\''] = '^'; trigraph_table['>'] = '}';
trigraph_table['/'] = '\\'; trigraph_table['<'] = '{';
trigraph_table['-'] = '~';
}
...@@ -108,6 +108,8 @@ struct cpp_buffer { ...@@ -108,6 +108,8 @@ struct cpp_buffer {
char *fname; char *fname;
/* Filename specified with #line command. */ /* Filename specified with #line command. */
char *nominal_fname; char *nominal_fname;
/* Last filename specified with #line command. */
char *last_nominal_fname;
/* Actual directory of this file, used only for "" includes */ /* Actual directory of this file, used only for "" includes */
struct file_name_list *actual_dir; struct file_name_list *actual_dir;
...@@ -422,6 +424,9 @@ struct cpp_options { ...@@ -422,6 +424,9 @@ struct cpp_options {
/* Nonzero for the 1989 C Standard, including corrigenda and amendments. */ /* Nonzero for the 1989 C Standard, including corrigenda and amendments. */
char c89; char c89;
/* Nonzero for the 199x C Standard, including corrigenda and amendments. */
char c9x;
/* Nonzero means give all the error messages the ANSI standard requires. */ /* Nonzero means give all the error messages the ANSI standard requires. */
char pedantic; char pedantic;
...@@ -639,10 +644,11 @@ struct definition { ...@@ -639,10 +644,11 @@ struct definition {
} args; } args;
}; };
extern unsigned char is_idchar[256]; extern const unsigned char is_idstart[256];
extern unsigned char is_hor_space[256]; extern const unsigned char is_idchar[256];
extern unsigned char is_space[256]; extern const unsigned char is_hor_space[256];
extern unsigned char trigraph_table[256]; extern const unsigned char is_space[256];
extern const unsigned char trigraph_table[256];
/* Stack of conditionals currently in progress /* Stack of conditionals currently in progress
(including both successful and failing conditionals). */ (including both successful and failing conditionals). */
...@@ -669,6 +675,7 @@ typedef struct if_stack IF_STACK_FRAME; ...@@ -669,6 +675,7 @@ typedef struct if_stack IF_STACK_FRAME;
extern void cpp_buf_line_and_col PARAMS((cpp_buffer *, long *, long *)); extern void cpp_buf_line_and_col PARAMS((cpp_buffer *, long *, long *));
extern cpp_buffer* cpp_file_buffer PARAMS((cpp_reader *)); extern cpp_buffer* cpp_file_buffer PARAMS((cpp_reader *));
extern void cpp_define PARAMS ((cpp_reader*, unsigned char *)); extern void cpp_define PARAMS ((cpp_reader*, unsigned char *));
extern void cpp_assert PARAMS ((cpp_reader *, unsigned char *));
extern void cpp_error PVPROTO ((cpp_reader *, const char *, ...)) extern void cpp_error PVPROTO ((cpp_reader *, const char *, ...))
ATTRIBUTE_PRINTF_2; ATTRIBUTE_PRINTF_2;
...@@ -729,6 +736,9 @@ extern int finclude PROTO ((cpp_reader *, int, ...@@ -729,6 +736,9 @@ extern int finclude PROTO ((cpp_reader *, int,
extern void deps_output PROTO ((cpp_reader *, char *, int)); extern void deps_output PROTO ((cpp_reader *, char *, int));
extern struct include_hash *include_hash PROTO ((cpp_reader *, char *, int)); extern struct include_hash *include_hash PROTO ((cpp_reader *, char *, int));
/* cppinit.c */
extern void initialize_char_syntax PROTO ((int));
#ifndef INCLUDE_LEN_FUDGE #ifndef INCLUDE_LEN_FUDGE
#define INCLUDE_LEN_FUDGE 0 #define INCLUDE_LEN_FUDGE 0
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment