aboutsummaryrefslogtreecommitdiff
path: root/libcpp/traditional.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcpp/traditional.c')
-rw-r--r--libcpp/traditional.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/libcpp/traditional.c b/libcpp/traditional.c
index 3d40c2f..664bf05 100644
--- a/libcpp/traditional.c
+++ b/libcpp/traditional.c
@@ -76,7 +76,9 @@ enum ls {ls_none = 0, /* Normal state. */
ls_predicate, /* After the predicate, maybe paren? */
ls_answer, /* In answer to predicate. */
ls_has_include, /* After __has_include__. */
- ls_has_include_close}; /* Looking for ')' of __has_include__. */
+ ls_has_include_close, /* Looking for ')' of __has_include__. */
+ ls_has_attribute, /* After __has_attribute__. */
+ ls_has_attribute_close}; /* Looking for ')' of __has_attribute__. */
/* Lexing TODO: Maybe handle space in escaped newlines. Stop lex.c
from recognizing comments and directives during its lexing pass. */
@@ -533,6 +535,12 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
lex_state = ls_has_include;
continue;
}
+ else if (pfile->state.in_expression
+ && node == pfile->spec_nodes.n__has_attribute__)
+ {
+ lex_state = ls_has_attribute;
+ continue;
+ }
}
break;
@@ -558,6 +566,8 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
lex_state = ls_defined_close;
else if (lex_state == ls_has_include)
lex_state = ls_has_include_close;
+ else if (lex_state == ls_has_attribute)
+ lex_state = ls_has_attribute_close;
}
break;
@@ -596,7 +606,8 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
}
}
else if (lex_state == ls_answer || lex_state == ls_defined_close
- || lex_state == ls_has_include_close)
+ || lex_state == ls_has_include_close
+ || lex_state == ls_has_attribute_close)
lex_state = ls_none;
}
break;
@@ -678,7 +689,8 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
else if (lex_state == ls_hash
|| lex_state == ls_predicate
|| lex_state == ls_defined
- || lex_state == ls_has_include)
+ || lex_state == ls_has_include
+ || lex_state == ls_has_attribute)
lex_state = ls_none;
/* ls_answer and ls_defined_close keep going until ')'. */