Commit 4c8cc616 by Richard Kenner

(special_symbol, check_macro_name, collect_expansion): Don't treat "L"

in "L'...'" as identifier.

From-SVN: r13660
parent 21f18241
/* CPP Library. /* CPP Library.
Copyright (C) 1986, 87, 89, 92-6, 1997 Free Software Foundation, Inc. Copyright (C) 1986, 87, 89, 92-6, 1997 Free Software Foundation, Inc.
Written by Per Bothner, 1994-95. Contributed by Per Bothner, 1994-95.
Based on CCCP program by Paul Rubin, June 1986 Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987 Adapted to ANSI C, Richard Stallman, Jan 1987
...@@ -1308,7 +1308,8 @@ collect_expansion (pfile, buf, limit, nargs, arglist) ...@@ -1308,7 +1308,8 @@ collect_expansion (pfile, buf, limit, nargs, arglist)
Don't leave the # in the expansion. */ Don't leave the # in the expansion. */
exp_p--; exp_p--;
SKIP_WHITE_SPACE (p); SKIP_WHITE_SPACE (p);
if (p == limit || ! is_idstart[*p]) if (p == limit || ! is_idstart[*p]
|| (*p == 'L' && p + 1 < limit && (p[1] == '\'' || p[1] == '"')))
cpp_error (pfile, cpp_error (pfile,
"`#' operator is not followed by a macro argument name"); "`#' operator is not followed by a macro argument name");
else else
...@@ -1369,7 +1370,8 @@ collect_expansion (pfile, buf, limit, nargs, arglist) ...@@ -1369,7 +1370,8 @@ collect_expansion (pfile, buf, limit, nargs, arglist)
while (p != limit && is_idchar[*p]) p++; while (p != limit && is_idchar[*p]) p++;
id_len = p - id_beg; id_len = p - id_beg;
if (is_idstart[c]) { if (is_idstart[c]
&& ! (id_len == 1 && c == 'L' && (*p == '\'' || *p == '"'))) {
register struct arglist *arg; register struct arglist *arg;
for (arg = arglist; arg != NULL; arg = arg->next) { for (arg = arglist; arg != NULL; arg = arg->next) {
...@@ -1667,7 +1669,8 @@ check_macro_name (pfile, symname, usage) ...@@ -1667,7 +1669,8 @@ check_macro_name (pfile, symname, usage)
for (p = symname; is_idchar[*p]; p++) for (p = symname; is_idchar[*p]; p++)
; ;
sym_length = p - symname; sym_length = p - symname;
if (sym_length == 0) if (sym_length == 0
|| (sym_length == 1 && *symname == 'L' && (*p == '\'' || *p == '"')))
cpp_error (pfile, "invalid %s name", usage); cpp_error (pfile, "invalid %s name", usage);
else if (!is_idstart[*symname]) { else if (!is_idstart[*symname]) {
U_CHAR *msg; /* what pain... */ U_CHAR *msg; /* what pain... */
...@@ -2417,6 +2420,8 @@ special_symbol (hp, pfile) ...@@ -2417,6 +2420,8 @@ special_symbol (hp, pfile)
if (!is_idstart[*ip->cur]) if (!is_idstart[*ip->cur])
goto oops; goto oops;
if (ip->cur[0] == 'L' && (ip->cur[1] == '\'' || ip->cur[1] == '"'))
goto oops;
if (hp = cpp_lookup (pfile, ip->cur, -1, -1)) if (hp = cpp_lookup (pfile, ip->cur, -1, -1))
{ {
#if 0 #if 0
......
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