CPP_OPTION (pfile, cplusplus_comments) = 1;
CPP_OPTION (pfile, warn_import) = 1;
CPP_OPTION (pfile, warn_paste) = 1;
+ CPP_OPTION (pfile, digraphs) = 1;
CPP_OPTION (pfile, discard_comments) = 1;
CPP_OPTION (pfile, show_column) = 1;
CPP_OPTION (pfile, tabstop) = 8;
CPP_OPTION (pfile, traditional) = 1;
CPP_OPTION (pfile, cplusplus_comments) = 0;
CPP_OPTION (pfile, trigraphs) = 0;
+ CPP_OPTION (pfile, digraphs) = 0;
CPP_OPTION (pfile, warn_trigraphs) = 0;
break;
case OPT_trigraphs:
CPP_OPTION (pfile, cplusplus_comments) = 1;
CPP_OPTION (pfile, c89) = 0;
CPP_OPTION (pfile, c99) = 1;
+ CPP_OPTION (pfile, digraphs) = 1;
CPP_OPTION (pfile, objc) = 0;
break;
- case OPT_lang_c89:
- CPP_OPTION (pfile, cplusplus) = 0;
- CPP_OPTION (pfile, cplusplus_comments) = 0;
- CPP_OPTION (pfile, c89) = 1;
- CPP_OPTION (pfile, c99) = 0;
- CPP_OPTION (pfile, objc) = 0;
- CPP_OPTION (pfile, trigraphs) = 1;
- new_pending_directive (pend, "__STRICT_ANSI__", cpp_define);
- break;
case OPT_lang_cplusplus:
CPP_OPTION (pfile, cplusplus) = 1;
CPP_OPTION (pfile, cplusplus_comments) = 1;
CPP_OPTION (pfile, c89) = 0;
CPP_OPTION (pfile, c99) = 0;
CPP_OPTION (pfile, objc) = 0;
+ CPP_OPTION (pfile, digraphs) = 1;
new_pending_directive (pend, "__cplusplus", cpp_define);
break;
case OPT_lang_objcplusplus:
CPP_OPTION (pfile, c89) = 1;
CPP_OPTION (pfile, c99) = 0;
CPP_OPTION (pfile, objc) = 0;
+ CPP_OPTION (pfile, digraphs) = 1;
break;
case OPT_std_gnu9x:
case OPT_std_gnu99:
CPP_OPTION (pfile, cplusplus_comments) = 1;
CPP_OPTION (pfile, c89) = 0;
CPP_OPTION (pfile, c99) = 1;
+ CPP_OPTION (pfile, digraphs) = 1;
CPP_OPTION (pfile, objc) = 0;
new_pending_directive (CPP_OPTION (pfile, pending),
"__STDC_VERSION__=199901L", cpp_define);
/* Fall through */
case OPT_std_iso9899_1990:
case OPT_std_c89:
+ case OPT_lang_c89:
CPP_OPTION (pfile, cplusplus) = 0;
CPP_OPTION (pfile, cplusplus_comments) = 0;
CPP_OPTION (pfile, c89) = 1;
CPP_OPTION (pfile, c99) = 0;
CPP_OPTION (pfile, objc) = 0;
+ CPP_OPTION (pfile, digraphs) = opt_code == OPT_std_iso9899_199409;
CPP_OPTION (pfile, trigraphs) = 1;
- new_pending_directive (CPP_OPTION (pfile, pending),
- "__STRICT_ANSI__", cpp_define);
+ new_pending_directive (pend, "__STRICT_ANSI__", cpp_define);
break;
case OPT_std_iso9899_199x:
case OPT_std_iso9899_1999:
CPP_OPTION (pfile, c89) = 0;
CPP_OPTION (pfile, c99) = 1;
CPP_OPTION (pfile, objc) = 0;
+ CPP_OPTION (pfile, digraphs) = 1;
CPP_OPTION (pfile, trigraphs) = 1;
new_pending_directive (CPP_OPTION (pfile, pending),
"__STRICT_ANSI__", cpp_define);
Cleanups to do:-
-o Get use of digraphs in sync with the standard reqd on the command line.
o -dM and with _cpp_dump_list: too many \n output.
o Put a printer object in cpp_reader?
o Check line numbers assigned to all errors.
if (PREV_TOKEN_TYPE == CPP_COLON
&& CPP_OPTION (pfile, cplusplus))
BACKUP_TOKEN (CPP_SCOPE);
- /* Digraph: "<:" is a '[' */
- else if (PREV_TOKEN_TYPE == CPP_LESS)
- BACKUP_DIGRAPH (CPP_OPEN_SQUARE);
- /* Digraph: "%:" is a '#' */
- else if (PREV_TOKEN_TYPE == CPP_MOD)
+ else if (CPP_OPTION (pfile, digraphs))
{
- (--cur_token)->flags |= DIGRAPH;
- goto make_hash;
+ /* Digraph: "<:" is a '[' */
+ if (PREV_TOKEN_TYPE == CPP_LESS)
+ BACKUP_DIGRAPH (CPP_OPEN_SQUARE);
+ /* Digraph: "%:" is a '#' */
+ else if (PREV_TOKEN_TYPE == CPP_MOD)
+ {
+ (--cur_token)->flags |= DIGRAPH;
+ goto make_hash;
+ }
}
}
cur_token++;
BACKUP_TOKEN (CPP_RSHIFT);
else if (PREV_TOKEN_TYPE == CPP_MINUS)
BACKUP_TOKEN (CPP_DEREF);
- /* Digraph: ":>" is a ']' */
- else if (PREV_TOKEN_TYPE == CPP_COLON)
- BACKUP_DIGRAPH (CPP_CLOSE_SQUARE);
- /* Digraph: "%>" is a '}' */
- else if (PREV_TOKEN_TYPE == CPP_MOD)
- BACKUP_DIGRAPH (CPP_CLOSE_BRACE);
+ else if (CPP_OPTION (pfile, digraphs))
+ {
+ /* Digraph: ":>" is a ']' */
+ if (PREV_TOKEN_TYPE == CPP_COLON)
+ BACKUP_DIGRAPH (CPP_CLOSE_SQUARE);
+ /* Digraph: "%>" is a '}' */
+ else if (PREV_TOKEN_TYPE == CPP_MOD)
+ BACKUP_DIGRAPH (CPP_CLOSE_BRACE);
+ }
}
cur_token++;
break;
case '%':
/* Digraph: "<%" is a '{' */
cur_token->type = CPP_MOD;
- if (IMMED_TOKEN () && PREV_TOKEN_TYPE == CPP_LESS)
+ if (IMMED_TOKEN () && PREV_TOKEN_TYPE == CPP_LESS
+ && CPP_OPTION (pfile, digraphs))
BACKUP_DIGRAPH (CPP_OPEN_BRACE);
cur_token++;
break;
if (b == a) return CPP_LSHIFT;
if (b == CPP_QUERY && cxx) return CPP_MIN;
if (b == CPP_LESS_EQ) return CPP_LSHIFT_EQ;
- if (b == CPP_COLON)
- {*digraph = 1; return CPP_OPEN_SQUARE;} /* <: digraph */
- if (b == CPP_MOD)
- {*digraph = 1; return CPP_OPEN_BRACE;} /* <% digraph */
+ if (CPP_OPTION (pfile, digraphs))
+ {
+ if (b == CPP_COLON)
+ {*digraph = 1; return CPP_OPEN_SQUARE;} /* <: digraph */
+ if (b == CPP_MOD)
+ {*digraph = 1; return CPP_OPEN_BRACE;} /* <% digraph */
+ }
break;
case CPP_PLUS: if (b == a) return CPP_PLUS_PLUS; break;
break;
case CPP_COLON:
if (b == a && cxx) return CPP_SCOPE;
- if (b == CPP_GREATER)
+ if (b == CPP_GREATER && CPP_OPTION (pfile, digraphs))
{*digraph = 1; return CPP_CLOSE_SQUARE;} /* :> digraph */
break;
case CPP_MOD:
- if (b == CPP_GREATER)
- {*digraph = 1; return CPP_CLOSE_BRACE;} /* %> digraph */
- if (b == CPP_COLON)
- {*digraph = 1; return CPP_HASH;} /* %: digraph */
+ if (CPP_OPTION (pfile, digraphs))
+ {
+ if (b == CPP_GREATER)
+ {*digraph = 1; return CPP_CLOSE_BRACE;} /* %> digraph */
+ if (b == CPP_COLON)
+ {*digraph = 1; return CPP_HASH;} /* %: digraph */
+ }
break;
case CPP_DEREF:
if (b == CPP_MULT && cxx) return CPP_DEREF_STAR;