aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplex.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cpplex.c')
-rw-r--r--gcc/cpplex.c42
1 files changed, 6 insertions, 36 deletions
diff --git a/gcc/cpplex.c b/gcc/cpplex.c
index c2052bc..7ab850b 100644
--- a/gcc/cpplex.c
+++ b/gcc/cpplex.c
@@ -25,7 +25,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Cleanups to do:-
o Check line numbers assigned to all errors.
-o Replace strncmp with memcmp almost everywhere.
o lex_line's use of cur_token, flags and list->token_used is a bit opaque.
o Distinguish integers, floats, and 'other' pp-numbers.
o Store ints and char constants as binary values.
@@ -226,34 +225,6 @@ _cpp_token_spellings [N_TTYPES] = {TTYPE_TABLE };
#undef OP
#undef TK
-/* The following table is used by trigraph_ok/trigraph_replace. If we
- have designated initializers, it can be constant data; otherwise,
- it is set up at runtime by _cpp_init_input_buffer. */
-
-#if (GCC_VERSION >= 2007)
-#define init_trigraph_map() /* nothing */
-#define TRIGRAPH_MAP \
-__extension__ static const U_CHAR trigraph_map[UCHAR_MAX + 1] = {
-#define END };
-#define s(p, v) [p] = v,
-#else
-#define TRIGRAPH_MAP static U_CHAR trigraph_map[UCHAR_MAX + 1] = { 0 }; \
- static void init_trigraph_map PARAMS ((void)) { \
- unsigned char *x = trigraph_map;
-#define END }
-#define s(p, v) x[p] = v;
-#endif
-
-TRIGRAPH_MAP
- s('=', '#') s(')', ']') s('!', '|')
- s('(', '[') s('\'', '^') s('>', '}')
- s('/', '\\') s('<', '{') s('-', '~')
-END
-
-#undef TRIGRAPH_MAP
-#undef END
-#undef s
-
/* Notify the compiler proper that the current line number has jumped,
or the current file name has changed. */
@@ -748,7 +719,7 @@ trigraph_ok (pfile, end)
if (accept)
cpp_warning_with_line (pfile, pfile->buffer->lineno, col,
"trigraph ??%c converted to %c",
- (int) *end, (int) trigraph_map[*end]);
+ (int) *end, (int) _cpp_trigraph_map[*end]);
else
cpp_warning_with_line (pfile, pfile->buffer->lineno, col,
"trigraph ??%c ignored", (int) *end);
@@ -786,7 +757,7 @@ trigraph_replace (pfile, src, limit)
continue;
/* Check if it really is a trigraph. */
- if (trigraph_map[src[2]] == 0)
+ if (_cpp_trigraph_map[src[2]] == 0)
continue;
dest = src;
@@ -797,12 +768,12 @@ trigraph_replace (pfile, src, limit)
/* Now we have a trigraph, we need to scan the remaining buffer, and
copy-shifting its contents left if replacement is enabled. */
for (; src + 2 < limit; dest++, src++)
- if ((*dest = *src) == '?' && src[1] == '?' && trigraph_map[src[2]])
+ if ((*dest = *src) == '?' && src[1] == '?' && _cpp_trigraph_map[src[2]])
{
trigraph_found:
src += 2;
if (trigraph_ok (pfile, pfile->buffer->cur - (limit - src)))
- *dest = trigraph_map[*src];
+ *dest = _cpp_trigraph_map[*src];
}
/* Copy remaining (at most 2) characters. */
@@ -1713,7 +1684,7 @@ lex_line (pfile, list)
case '?':
if (cur + 1 < buffer->rlimit && *cur == '?'
- && trigraph_map[cur[1]] && trigraph_ok (pfile, cur + 1))
+ && _cpp_trigraph_map[cur[1]] && trigraph_ok (pfile, cur + 1))
{
/* Handle trigraph. */
cur++;
@@ -3536,7 +3507,7 @@ special_symbol (pfile, node, token)
}
#undef DSC
-/* Allocate pfile->input_buffer, and initialize trigraph_map[]
+/* Allocate pfile->input_buffer, and initialize _cpp_trigraph_map[]
if it hasn't happened already. */
void
@@ -3545,7 +3516,6 @@ _cpp_init_input_buffer (pfile)
{
cpp_context *base;
- init_trigraph_map ();
_cpp_init_toklist (&pfile->token_list, DUMMY_TOKEN);
pfile->no_expand_level = UINT_MAX;
pfile->context_cap = 20;