summaryrefslogtreecommitdiff
path: root/libcpp/traditional.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-12-19 12:20:58 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-12-19 12:20:58 +0000
commit33058239ca52559e37bb4e0dd1214fb37464929a (patch)
treec196a5cfa64d537aa3ba5756e62095791c4f3ca3 /libcpp/traditional.c
parent58439d80f1cca7a11af69e8fe825a5b828a8d9bf (diff)
downloadgcc-33058239ca52559e37bb4e0dd1214fb37464929a.tar.gz
PR preprocessor/63831
* c-cppbuiltin.c (c_cpp_builtins): Don't define __has_attribute and __has_cpp_attribute here. * c-ppoutput.c (init_pp_output): Set cb->has_attribute to c_common_has_attribute. * c-common.h (c_common_has_attribute): New prototype. * c-lex.c (init_c_lex): Set cb->has_attribute to c_common_has_attribute instead of cb_has_attribute. (get_token_no_padding): New function. (cb_has_attribute): Renamed to ... (c_common_has_attribute): ... this. No longer static. Use get_token_no_padding, require ()s, don't build TREE_LIST unnecessarily, fix up formatting, adjust diagnostics, call init_attributes. * directives.c (lex_macro_node): Remove __has_attribute__ handling. * internal.h (struct spec_node): Remove n__has_attribute__ field. (struct lexer_state): Remove in__has_attribute__ field. * macro.c (_cpp_builtin_macro_text): Handle BT_HAS_ATTRIBUTE. * identifiers.c (_cpp_init_hashtable): Remove __has_attribute__ handling. * init.c (builtin_array): Add __has_attribute and __has_cpp_attribute. (cpp_init_special_builtins): Don't initialize __has_attribute or __has_cpp_attribute if CLK_ASM or pfile->cb.has_attribute is NULL. * traditional.c (enum ls): Remove ls_has_attribute, ls_has_attribute_close. (_cpp_scan_out_logical_line): Remove __has_attribute__ handling. * include/cpplib.h (enum cpp_builtin_type): Add BT_HAS_ATTRIBUTE. * pch.c (cpp_read_state): Remove __has_attribute__ handling. * expr.c (eval_token): Likewise. (parse_has_attribute): Removed. * c-c++-common/cpp/pr63831-1.c: New test. * c-c++-common/cpp/pr63831-2.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218948 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp/traditional.c')
-rw-r--r--libcpp/traditional.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/libcpp/traditional.c b/libcpp/traditional.c
index 664bf054a03..3d40c2f2122 100644
--- a/libcpp/traditional.c
+++ b/libcpp/traditional.c
@@ -76,9 +76,7 @@ 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_attribute, /* After __has_attribute__. */
- ls_has_attribute_close}; /* Looking for ')' of __has_attribute__. */
+ 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. */
@@ -535,12 +533,6 @@ _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;
@@ -566,8 +558,6 @@ _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;
@@ -606,8 +596,7 @@ _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_attribute_close)
+ || lex_state == ls_has_include_close)
lex_state = ls_none;
}
break;
@@ -689,8 +678,7 @@ _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_attribute)
+ || lex_state == ls_has_include)
lex_state = ls_none;
/* ls_answer and ls_defined_close keep going until ')'. */