aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppfiles.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cppfiles.c')
-rw-r--r--gcc/cppfiles.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c
index 2aa2eeb..dfeddcc 100644
--- a/gcc/cppfiles.c
+++ b/gcc/cppfiles.c
@@ -437,10 +437,10 @@ read_filename_string (ch, f)
len = 20;
set = alloc = xmalloc (len + 1);
- if (! is_space[ch])
+ if (! is_space(ch))
{
*set++ = ch;
- while ((ch = getc (f)) != EOF && ! is_space[ch])
+ while ((ch = getc (f)) != EOF && ! is_space(ch))
{
if (set - alloc == len)
{
@@ -503,10 +503,10 @@ read_name_map (pfile, dirname)
char *from, *to;
struct file_name_map *ptr;
- if (is_space[ch])
+ if (is_space(ch))
continue;
from = read_filename_string (ch, f);
- while ((ch = getc (f)) != EOF && is_hor_space[ch])
+ while ((ch = getc (f)) != EOF && is_hspace(ch))
;
to = read_filename_string (ch, f);
@@ -976,7 +976,7 @@ read_and_prescan (pfile, fp, desc, len)
case SPECCASE_QUESTION: /* ? */
{
- unsigned int d;
+ unsigned int d, t;
/* If we're at the end of the intermediate buffer,
we have to shift the ?'s down to the start and
come back next pass. */
@@ -998,12 +998,27 @@ read_and_prescan (pfile, fp, desc, len)
*--ibase = '?';
goto read_next;
}
- if (!trigraph_table[d])
+
+ /* Trigraph map:
+ * from to from to from to
+ * ?? = # ?? ) ] ?? ! |
+ * ?? ( [ ?? ' ^ ?? > }
+ * ?? / \ ?? < { ?? - ~
+ */
+ if (d == '=') t = '#';
+ else if (d == ')') t = ']';
+ else if (d == '!') t = '|';
+ else if (d == '(') t = '[';
+ else if (d == '\'') t = '^';
+ else if (d == '>') t = '}';
+ else if (d == '/') t = '\\';
+ else if (d == '<') t = '{';
+ else if (d == '-') t = '~';
+ else
{
*op++ = '?';
break;
}
-
if (CPP_OPTIONS (pfile)->warn_trigraphs)
{
unsigned long col;
@@ -1014,10 +1029,10 @@ read_and_prescan (pfile, fp, desc, len)
}
if (CPP_OPTIONS (pfile)->trigraphs)
{
- if (trigraph_table[d] == '\\')
+ if (t == '\\')
goto backslash;
else
- *op++ = trigraph_table[d];
+ *op++ = t;
}
else
{