-
- Downloads
OpenMP: Robustify C front end handling of attribute-syntax pragmas
Presently, the code to handle OpenMP attribute-syntax pragmas in the C front end assumes nothing else is messing with redirecting parser->tokens, and makes no provision for restoring it from anything other than parser->tokens_buf when the buffer allocated for the pragma is exhausted. Adding support for metadirectives will change that, since it also needs to buffer tokens for the metadirective alternatives, and an attribute-syntax directive can appear inside a metadirective. This patch adds a more general save/restore mechanism attached to the parser via a pointer to a new struct omp_attribute_pragma_state. gcc/c/ChangeLog * c-parser.cc (struct c_parser): Change in_omp_attribute_pragma field to be of type struct omp_attribute_pragma_state. (struct omp_attribute_pragma_state): New. (c_parser_skip_until_found): Use the new way to restore state on EOF. (c_parser_skip_to_pragma_eol): Likewise. (c_parser_handle_statement_omp_attributes): Create an omp_attribute_pragma_state to hold the restore state. Do not store state in tok.flags. (omp_maybe_parse_omp_decl): Likewise.
Loading
Please register or sign in to comment