aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/libcpp/traditional.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/libcpp/traditional.c')
-rw-r--r--gcc-4.9/libcpp/traditional.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc-4.9/libcpp/traditional.c b/gcc-4.9/libcpp/traditional.c
index b770db7ab..dfb53787a 100644
--- a/gcc-4.9/libcpp/traditional.c
+++ b/gcc-4.9/libcpp/traditional.c
@@ -74,7 +74,9 @@ enum ls {ls_none = 0, /* Normal state. */
ls_defined_close, /* Looking for ')' of defined(). */
ls_hash, /* After # in preprocessor conditional. */
ls_predicate, /* After the predicate, maybe paren? */
- ls_answer}; /* In answer to predicate. */
+ ls_answer, /* In answer to predicate. */
+ ls_has_include, /* After __has_include__. */
+ ls_has_include_close}; /* Looking for ')' of __has_include__. */
/* Lexing TODO: Maybe handle space in escaped newlines. Stop lex.c
from recognizing comments and directives during its lexing pass. */
@@ -524,6 +526,13 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
lex_state = ls_defined;
continue;
}
+ else if (pfile->state.in_expression
+ && (node == pfile->spec_nodes.n__has_include__
+ || node == pfile->spec_nodes.n__has_include_next__))
+ {
+ lex_state = ls_has_include;
+ continue;
+ }
}
break;
@@ -547,6 +556,8 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
lex_state = ls_answer;
else if (lex_state == ls_defined)
lex_state = ls_defined_close;
+ else if (lex_state == ls_has_include)
+ lex_state = ls_has_include_close;
}
break;
@@ -584,7 +595,8 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
goto new_context;
}
}
- else if (lex_state == ls_answer || lex_state == ls_defined_close)
+ else if (lex_state == ls_answer || lex_state == ls_defined_close
+ || lex_state == ls_has_include_close)
lex_state = ls_none;
}
break;
@@ -665,7 +677,8 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
lex_state = ls_none;
else if (lex_state == ls_hash
|| lex_state == ls_predicate
- || lex_state == ls_defined)
+ || lex_state == ls_defined
+ || lex_state == ls_has_include)
lex_state = ls_none;
/* ls_answer and ls_defined_close keep going until ')'. */