aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpphash.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-03-04 01:42:56 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-03-04 01:42:56 +0000
commit455d25861f0975d0baed1912bf22deed944770a2 (patch)
treea52521153bf75ca10099523abb8586d4cb5851a7 /gcc/cpphash.c
parentfcd7f76b289ddadbb67057154547d570b94f2b23 (diff)
downloadgcc-455d25861f0975d0baed1912bf22deed944770a2.zip
gcc-455d25861f0975d0baed1912bf22deed944770a2.tar.gz
gcc-455d25861f0975d0baed1912bf22deed944770a2.tar.bz2
cpplib.h (_dollar_ok): New macro.
* cpplib.h (_dollar_ok): New macro. (is_idchar, is_idstart): Use it. (IStable): Rename to _cpp_IStable. Declare it const if gcc >=2.7 or C99. Delete all references to FAKE_CONST. (is_idchar, is_idstart, is_numchar, is_numstart, is_hspace, is_space): Update for renamed IStable. * cppinit.c: Delete all references to FAKE_CONST and CAT macros. Define init_IStable as empty macro if gcc >=2.7 or C99. Change TABLE() to ISTABLE and hardcode name of table. (cpp_start_read): Don't change the IStable based on dollars_in_ident. * cpphash.c (unsafe_chars): Add pfile argument. All callers changed. Handle '$' for char1 correctly. * cpplib.c (cpp_get_token): Use is_numchar when parsing numbers. * cppexp.c (tokentab2): Make const. (cpp_lex): Make toktab const. * cppinit.c (include_defaults_array): Make const. (initialize_standard_includes): Make default_include const. From-SVN: r32321
Diffstat (limited to 'gcc/cpphash.c')
-rw-r--r--gcc/cpphash.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/cpphash.c b/gcc/cpphash.c
index ae5df16..a85c7c2 100644
--- a/gcc/cpphash.c
+++ b/gcc/cpphash.c
@@ -35,7 +35,7 @@ static int comp_def_part PARAMS ((int, U_CHAR *, int, U_CHAR *,
int, int));
static void push_macro_expansion PARAMS ((cpp_reader *,
U_CHAR *, int, HASHNODE *));
-static int unsafe_chars PARAMS ((int, int));
+static int unsafe_chars PARAMS ((cpp_reader *, int, int));
static int macro_cleanup PARAMS ((cpp_buffer *, cpp_reader *));
static enum cpp_token macarg PARAMS ((cpp_reader *, int));
static struct tm *timestamp PARAMS ((cpp_reader *));
@@ -1317,7 +1317,7 @@ macroexpand (pfile, hp)
U_CHAR *expanded = ARG_BASE + arg->expanded;
if (!ap->raw_before && totlen > 0 && arg->expand_length
&& !CPP_TRADITIONAL (pfile)
- && unsafe_chars (xbuf[totlen - 1], expanded[0]))
+ && unsafe_chars (pfile, xbuf[totlen - 1], expanded[0]))
{
xbuf[totlen++] = '\r';
xbuf[totlen++] = ' ';
@@ -1328,7 +1328,7 @@ macroexpand (pfile, hp)
if (!ap->raw_after && totlen > 0 && offset < defn->length
&& !CPP_TRADITIONAL (pfile)
- && unsafe_chars (xbuf[totlen - 1], exp[offset]))
+ && unsafe_chars (pfile, xbuf[totlen - 1], exp[offset]))
{
xbuf[totlen++] = '\r';
xbuf[totlen++] = ' ';
@@ -1382,7 +1382,8 @@ macroexpand (pfile, hp)
could cause mis-tokenization. */
static int
-unsafe_chars (c1, c2)
+unsafe_chars (pfile, c1, c2)
+ cpp_reader *pfile;
int c1, c2;
{
switch (c1)
@@ -1397,6 +1398,11 @@ unsafe_chars (c1, c2)
return 1; /* could extend a pre-processing number */
goto letter;
+ case '$':
+ if (CPP_OPTIONS (pfile)->dollars_in_ident)
+ goto letter;
+ return 0;
+
case 'L':
if (c2 == '\'' || c2 == '\"')
return 1; /* Could turn into L"xxx" or L'xxx'. */
@@ -1468,7 +1474,7 @@ push_macro_expansion (pfile, xbuf, xbuf_len, hp)
{
int c1 = mbuf->rlimit[-3];
int c2 = CPP_BUF_PEEK (CPP_PREV_BUFFER (CPP_BUFFER (pfile)));
- if (c2 == EOF || !unsafe_chars (c1, c2))
+ if (c2 == EOF || !unsafe_chars (pfile, c1, c2))
mbuf->rlimit -= 2;
}
}