diff options
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 328 |
1 files changed, 173 insertions, 155 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index ed28e13e661..fa3ace887ee 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -1935,37 +1935,37 @@ static tree cp_parser_make_typename_type (cp_parser *, tree, tree); /* APPLE LOCAL begin CW asm blocks */ -static tree cp_parser_cw_asm_compound_statement +static tree cp_parser_iasm_compound_statement (cp_parser *); -static void cp_parser_cw_asm_declaration_seq_opt +static void cp_parser_iasm_declaration_seq_opt (cp_parser *); -static void cp_parser_cw_asm_line_seq_opt +static void cp_parser_iasm_line_seq_opt (cp_parser *); -static void cp_parser_cw_asm_line +static void cp_parser_iasm_line (cp_parser *); -static void cp_parser_cw_asm_statement_seq_opt +static void cp_parser_iasm_statement_seq_opt (cp_parser *); -static void cp_parser_cw_asm_statement +static void cp_parser_iasm_statement (cp_parser *); -static tree cp_parser_cw_asm_operands +static tree cp_parser_iasm_operands (cp_parser *); -static tree cp_parser_cw_asm_operand +static tree cp_parser_iasm_operand (cp_parser *); -static tree cp_parser_cw_asm_postfix_expression +static tree cp_parser_iasm_postfix_expression (cp_parser *, bool); -static tree cp_parser_cw_identifier_or_number +static tree cp_parser_iasm_identifier_or_number (cp_parser* parser); -static tree cw_build_identifier_string +static tree iasm_build_identifier_string (cp_parser* parser, const char* str); -static tree cp_parser_cw_asm_relative_branch +static tree cp_parser_iasm_relative_branch + (cp_parser *parser); +static tree cp_parser_iasm_top_statement + (cp_parser *parser); +static void cp_parser_iasm_maybe_skip_comments (cp_parser *parser); -static tree -cp_parser_cw_asm_top_statement (cp_parser *parser); -static void -cp_parser_cw_maybe_skip_comments (cp_parser *parser); -#ifndef CW_SEE_OPCODE -#define CW_SEE_OPCODE(YYCHAR, T) YYCHAR +#ifndef IASM_SEE_OPCODE +#define IASM_SEE_OPCODE(YYCHAR, T) YYCHAR #endif #define TYPESPEC 1 #define IDENTIFIER 2 @@ -2839,9 +2839,13 @@ cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok) if (tok->type == CPP_WSTRING) wide = true; /* APPLE LOCAL begin pascal strings */ - else if (CPP_OPTION (parse_in, pascal_strings) - && str.text[1] == '\\' && str.text[2] == 'p') - pascal_p = true; + if (CPP_OPTION (parse_in, pascal_strings)) + { + if (wide && str.text[0] == 'L' && str.text[2] == '\\' && str.text[3] == 'p') + pascal_p = true; + else if (str.text[1] == '\\' && str.text[2] == 'p') + pascal_p = true; + } /* APPLE LOCAL end pascal strings */ strs = &str; @@ -2860,9 +2864,13 @@ cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok) if (tok->type == CPP_WSTRING) wide = true; /* APPLE LOCAL begin pascal strings */ - else if (count == 1 && CPP_OPTION (parse_in, pascal_strings) - && str.text[1] == '\\' && str.text[2] == 'p') - pascal_p = true; + if (CPP_OPTION (parse_in, pascal_strings) && count == 1) + { + if (wide && str.text[0] == 'L' && str.text[2] == '\\' && str.text[3] == 'p') + pascal_p = true; + else if (str.text[1] == '\\' && str.text[2] == 'p') + pascal_p = true; + } /* APPLE LOCAL end pascal strings */ obstack_grow (&str_ob, &str, sizeof (cpp_string)); @@ -2880,11 +2888,6 @@ cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok) wide = false; } - /* APPLE LOCAL begin pascal strings */ - if (wide) - pascal_p = false; - /* APPLE LOCAL end pascal strings */ - if ((translate ? cpp_interpret_string : cpp_interpret_string_notranslate) /* APPLE LOCAL pascal strings */ (parse_in, strs, count, &istr, wide, pascal_p)) @@ -3359,15 +3362,15 @@ cp_parser_primary_expression (cp_parser *parser, /* Anything else is an error. */ default: /* APPLE LOCAL begin CW asm blocks */ - if (inside_cw_asm_block) + if (inside_iasm_block) { if (token->type == CPP_OPEN_SQUARE) { tree expr; cp_lexer_consume_token (parser->lexer); - expr = cp_parser_cw_asm_operand (parser); + expr = cp_parser_iasm_operand (parser); cp_parser_require (parser, CPP_CLOSE_SQUARE, "`]'"); - return cw_build_bracket (expr, NULL_TREE); + return iasm_build_bracket (expr, NULL_TREE); } } /* APPLE LOCAL end CW asm blocks */ @@ -3739,7 +3742,7 @@ cp_parser_unqualified_id (cp_parser* parser, /* APPLE LOCAL begin CW asm blocks C++ */ case CPP_NUMBER: { - if (flag_cw_asm_blocks && inside_cw_asm_block + if (flag_iasm_blocks && inside_iasm_block && TREE_CODE (token->value) == INTEGER_CST) { char buf[60]; @@ -5115,7 +5118,7 @@ cp_parser_unary_expression (cp_parser *parser, bool address_p, bool cast_p) { /* APPLE LOCAL begin CW asm blocks */ case RID_SIZEOF: - if (inside_cw_asm_block) + if (inside_iasm_block) break; case RID_ALIGNOF: @@ -5206,7 +5209,7 @@ cp_parser_unary_expression (cp_parser *parser, bool address_p, bool cast_p) relative branch syntax. This is to allow "b *+8" which is disallwed by darwin's assembler but nevertheless is needed to be compatible with CW tools. */ - if (inside_cw_asm_block && unary_operator == INDIRECT_REF) + if (inside_iasm_block && unary_operator == INDIRECT_REF) { cp_token *token = cp_lexer_peek_nth_token (parser->lexer, 2); if (token->type == CPP_PLUS || token->type == CPP_MINUS) @@ -5261,7 +5264,7 @@ cp_parser_unary_expression (cp_parser *parser, bool address_p, bool cast_p) /* Fall through. */ case BIT_NOT_EXPR: /* APPLE LOCAL begin CW asm blocks */ - if (inside_cw_asm_block + if (inside_iasm_block && unary_operator == ADDR_EXPR && TREE_CODE (cast_expression) == LABEL_DECL) { @@ -5281,7 +5284,7 @@ cp_parser_unary_expression (cp_parser *parser, bool address_p, bool cast_p) case NEGATE_EXPR: case TRUTH_NOT_EXPR: /* APPLE LOCAL begin CW asm blocks */ - if (inside_cw_asm_block && TREE_TYPE (cast_expression) == 0) + if (inside_iasm_block && TREE_TYPE (cast_expression) == 0) { expression = build1 (unary_operator, NULL_TREE, cast_expression); break; @@ -5306,8 +5309,8 @@ cp_parser_unary_expression (cp_parser *parser, bool address_p, bool cast_p) /* Postfix expressions in CW asm are more restricted and handled quite differently, so diverge from the usual expression precedence sequence here. */ - if (inside_cw_asm_block) - return cp_parser_cw_asm_postfix_expression (parser, address_p); + if (inside_iasm_block) + return cp_parser_iasm_postfix_expression (parser, address_p); /* APPLE LOCAL end CW asm blocks */ return cp_parser_postfix_expression (parser, address_p, cast_p); @@ -5341,7 +5344,7 @@ cp_parser_unary_operator (cp_token* token) /* APPLE LOCAL begin CW asm blocks */ case CPP_NAME: - if (cw_asm_state >= cw_asm_decls + if (iasm_state >= iasm_decls && flag_ms_asms && strcasecmp (IDENTIFIER_POINTER (token->value), "offset") == 0) return ADDR_EXPR; @@ -5926,7 +5929,7 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p) new_prec = TOKEN_PRECEDENCE (token); /* APPLE LOCAL begin CW asm blocks */ - if (flag_cw_asm_blocks && inside_cw_asm_block) + if (flag_iasm_blocks && inside_iasm_block) { if ((token->flags & BOL) != 0) new_prec = PREC_NOT_OPERATOR; @@ -5965,7 +5968,7 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p) lookahead_prec = TOKEN_PRECEDENCE (token); /* APPLE LOCAL begin CW asm blocks */ - if (flag_cw_asm_blocks && inside_cw_asm_block) + if (flag_iasm_blocks && inside_iasm_block) { if ((token->flags & BOL) != 0) lookahead_prec = PREC_NOT_OPERATOR; @@ -6003,14 +6006,14 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p) } /* APPLE LOCAL begin CW asm blocks */ - if (inside_cw_asm_block && TREE_CODE (rhs) == COMPOUND_EXPR) + if (inside_iasm_block && TREE_CODE (rhs) == COMPOUND_EXPR) { gcc_assert (TREE_CODE (TREE_OPERAND (rhs, 1)) == IDENTIFIER_NODE); lhs = build_x_binary_op (tree_type, lhs, TREE_OPERAND (rhs, 0), &overloaded_p); - lhs = cw_asm_build_register_offset (lhs, TREE_OPERAND (rhs, 1)); + lhs = iasm_build_register_offset (lhs, TREE_OPERAND (rhs, 1)); return lhs; } - if (inside_cw_asm_block) + if (inside_iasm_block) { if (TREE_CODE (rhs) == IDENTIFIER_NODE || TREE_CODE (lhs) == IDENTIFIER_NODE @@ -6714,23 +6717,23 @@ cp_parser_compound_statement (cp_parser *parser, tree in_statement_expr, /* APPLE LOCAL begin CW asm blocks */ /* Maybe this is the body of an asm function, which has asm lines following the decls. */ - if (cw_asm_state >= cw_asm_decls) + if (iasm_state >= iasm_decls) { cp_token *token = cp_lexer_peek_token (parser->lexer); - cw_asm_in_decl = 1; - if (token->value && CW_SEE_OPCODE (TYPESPEC, token->value) == IDENTIFIER) + iasm_in_decl = 1; + if (token->value && IASM_SEE_OPCODE (TYPESPEC, token->value) == IDENTIFIER) { token->keyword = RID_MAX; token->type = CPP_NAME; } - cp_parser_cw_asm_declaration_seq_opt (parser); - cw_asm_in_decl = 0; - cw_asm_state = cw_asm_asm; - inside_cw_asm_block = 1; - clear_cw_asm_labels (); - cp_parser_cw_asm_line_seq_opt (parser); - cw_asm_state = cw_asm_none; - inside_cw_asm_block = 0; + cp_parser_iasm_declaration_seq_opt (parser); + iasm_in_decl = 0; + iasm_state = iasm_asm; + inside_iasm_block = 1; + iasm_clear_labels (); + cp_parser_iasm_line_seq_opt (parser); + iasm_state = iasm_none; + inside_iasm_block = 0; } else /* APPLE LOCAL end CW asm blocks */ @@ -6746,7 +6749,7 @@ cp_parser_compound_statement (cp_parser *parser, tree in_statement_expr, /* APPLE LOCAL begin CW asm blocks */ static bool -cp_lexer_cw_bol (cp_lexer* lexer) +cp_lexer_iasm_bol (cp_lexer* lexer) { cp_token *token = cp_lexer_peek_token (lexer); @@ -6783,9 +6786,9 @@ cp_parser_statement_seq_opt (cp_parser* parser, tree in_statement_expr) cp_parser_statement (parser, in_statement_expr); /* APPLE LOCAL begin CW asm blocks */ - if (flag_cw_asm_blocks - && cw_asm_state >= cw_asm_decls - && (cp_lexer_cw_bol (parser->lexer) + if (flag_iasm_blocks + && iasm_state >= iasm_decls + && (cp_lexer_iasm_bol (parser->lexer) || cp_lexer_next_token_is (parser->lexer, CPP_NAME))) break; /* APPLE LOCAL end CW asm blocks */ @@ -7630,7 +7633,7 @@ cp_parser_simple_declaration (cp_parser* parser, /* APPLE LOCAL begin CW asm blocks */ /* We might have seen an asm opcode, and it's time to switch to asm instruction handling. */ - if (flag_cw_asm_blocks && cw_asm_state >= cw_asm_decls) + if (flag_iasm_blocks && iasm_state >= iasm_decls) return; /* APPLE LOCAL end CW asm blocks */ @@ -7755,8 +7758,8 @@ cp_parser_simple_declaration (cp_parser* parser, /* APPLE LOCAL end C* language */ /* APPLE LOCAL begin CW asm blocks */ - if (flag_cw_asm_blocks) - cw_asm_in_decl = 0; + if (flag_iasm_blocks) + iasm_in_decl = 0; /* APPLE LOCAL end CW asm blocks */ done: @@ -7919,7 +7922,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser, case RID_ASM: /* Consume the token. */ cp_lexer_consume_token (parser->lexer); - ++decl_specs->specs[(int) ds_cw_asm]; + ++decl_specs->specs[(int) ds_iasm_asm]; break; /* APPLE LOCAL end CW asm blocks */ @@ -11104,12 +11107,12 @@ cp_parser_asm_definition (cp_parser* parser, bool statement_p ATTRIBUTE_UNUSED) cp_token *nextup; /* Detect when a leading `asm' is actually a spec of an asm function rather than an asm statement or block. */ - if (flag_cw_asm_blocks) + if (flag_iasm_blocks) { nextup = cp_lexer_peek_nth_token (parser->lexer, 2); if (statement_p && nextup->value - && CW_SEE_OPCODE (TYPESPEC, nextup->value) == IDENTIFIER) + && IASM_SEE_OPCODE (TYPESPEC, nextup->value) == IDENTIFIER) { nextup->keyword = RID_MAX; nextup->type = CPP_NAME; @@ -11123,7 +11126,7 @@ cp_parser_asm_definition (cp_parser* parser, bool statement_p ATTRIBUTE_UNUSED) || (nextup->type == CPP_DOT) || (nextup->type == CPP_SEMICOLON) || (nextup->type == CPP_NAME - && !cw_asm_typename_or_reserved (nextup->value)))) + && !iasm_typename_or_reserved (nextup->value)))) { /* An asm function - we'll treat the `asm' as if it were a storage class spec, which will eventually affect function @@ -11149,8 +11152,8 @@ cp_parser_asm_definition (cp_parser* parser, bool statement_p ATTRIBUTE_UNUSED) /* A CW-style asm block is introduced by an open brace. */ if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE)) { - if (flag_cw_asm_blocks) - cp_parser_cw_asm_compound_statement (parser); + if (flag_iasm_blocks) + cp_parser_iasm_compound_statement (parser); else error ("asm blocks not enabled, use `-fasm-blocks'"); return; @@ -11161,8 +11164,8 @@ cp_parser_asm_definition (cp_parser* parser, bool statement_p ATTRIBUTE_UNUSED) || cp_lexer_next_token_is_keyword (parser->lexer, RID_ASM) || cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)) { - if (flag_cw_asm_blocks) - cp_parser_cw_asm_top_statement (parser); + if (flag_iasm_blocks) + cp_parser_iasm_top_statement (parser); else error ("asm blocks not enabled, use `-fasm-blocks'"); return; @@ -16967,63 +16970,63 @@ cp_parser_allow_gnu_extensions_p (cp_parser* parser) /* This is the section of CW-asm-specific parsing functions. */ static tree -cp_parser_cw_asm_compound_statement (cp_parser *parser) +cp_parser_iasm_compound_statement (cp_parser *parser) { tree compound_stmt; - cw_asm_state = cw_asm_asm; - inside_cw_asm_block = 1; - cw_asm_at_bol = 1; - clear_cw_asm_labels (); + iasm_state = iasm_asm; + inside_iasm_block = 1; + iasm_at_bol = 1; + iasm_clear_labels (); if (!cp_parser_require (parser, CPP_OPEN_BRACE, "`{'")) return error_mark_node; /* Begin the compound-statement. */ compound_stmt = begin_compound_stmt (/*has_no_scope=*/false); /* Parse an (optional) statement-seq. */ - cp_parser_cw_asm_line_seq_opt (parser); + cp_parser_iasm_line_seq_opt (parser); /* Finish the compound-statement. */ finish_compound_stmt (compound_stmt); /* Consume the `}'. */ cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'"); /* We're done with the block of asm. */ - cw_asm_at_bol = 0; - inside_cw_asm_block = 0; - cw_asm_state = cw_asm_none; + iasm_at_bol = 0; + inside_iasm_block = 0; + iasm_state = iasm_none; return compound_stmt; } static tree -cp_parser_cw_asm_top_statement (cp_parser *parser) +cp_parser_iasm_top_statement (cp_parser *parser) { tree compound_stmt; - cw_asm_state = cw_asm_asm; - inside_cw_asm_block = 1; - cw_asm_at_bol = 1; - clear_cw_asm_labels (); + iasm_state = iasm_asm; + inside_iasm_block = 1; + iasm_at_bol = 1; + iasm_clear_labels (); /* Begin the compound-statement. */ compound_stmt = begin_compound_stmt (/*has_no_scope=*/false); - if (!cp_lexer_cw_bol (parser->lexer)) + if (!cp_lexer_iasm_bol (parser->lexer)) { /* Parse a line. */ - cp_parser_cw_asm_line (parser); + cp_parser_iasm_line (parser); } /* Finish the compound-statement. */ finish_compound_stmt (compound_stmt); /* We're done with the block of asm. */ - cw_asm_at_bol = 0; - inside_cw_asm_block = 0; - cw_asm_state = cw_asm_none; + iasm_at_bol = 0; + inside_iasm_block = 0; + iasm_state = iasm_none; return compound_stmt; } static void -cp_parser_cw_asm_declaration_seq_opt (cp_parser* parser) +cp_parser_iasm_declaration_seq_opt (cp_parser* parser) { cp_token *token = cp_lexer_peek_token (parser->lexer); if (token->type == CPP_NAME - && !cw_asm_typename_or_reserved (token->value)) + && !iasm_typename_or_reserved (token->value)) return; /* Scan declarations until there aren't any more. */ @@ -17044,8 +17047,8 @@ cp_parser_cw_asm_declaration_seq_opt (cp_parser* parser) || token->type == CPP_EINCL) cp_lexer_handle_pragma_etc (parser->lexer); - if (cw_asm_state >= cw_asm_decls - && (cp_lexer_cw_bol (parser->lexer) + if (iasm_state >= iasm_decls + && (cp_lexer_iasm_bol (parser->lexer) || cp_lexer_next_token_is (parser->lexer, CPP_NAME))) break; } @@ -17058,7 +17061,7 @@ cp_parser_cw_asm_declaration_seq_opt (cp_parser* parser) line-seq [opt] line */ static void -cp_parser_cw_asm_line_seq_opt (cp_parser* parser) +cp_parser_iasm_line_seq_opt (cp_parser* parser) { /* Scan lines of asm until there aren't any more. */ while (true) @@ -17069,20 +17072,20 @@ cp_parser_cw_asm_line_seq_opt (cp_parser* parser) break; /* Parse the line. */ - cp_parser_cw_asm_line (parser); + cp_parser_iasm_line (parser); } } static void -cp_parser_cw_asm_line (cp_parser* parser) +cp_parser_iasm_line (cp_parser* parser) { - cp_parser_cw_asm_statement_seq_opt (parser); + cp_parser_iasm_statement_seq_opt (parser); } /* Skip tokens until the end of line is seen. */ static void -cp_parser_cw_skip_to_eol (cp_parser *parser) +cp_parser_iasm_skip_to_eol (cp_parser *parser) { while (true) { @@ -17094,7 +17097,7 @@ cp_parser_cw_skip_to_eol (cp_parser *parser) if (token->type == CPP_EOF) break; /* If the next token starts a new line, stop. */ - if (cp_lexer_cw_bol (parser->lexer)) + if (cp_lexer_iasm_bol (parser->lexer)) break; /* Otherwise, consume the token. */ cp_lexer_consume_token (parser->lexer); @@ -17102,14 +17105,14 @@ cp_parser_cw_skip_to_eol (cp_parser *parser) } static void -cp_parser_cw_maybe_skip_comments (cp_parser *parser) +cp_parser_iasm_maybe_skip_comments (cp_parser *parser) { if (flag_ms_asms && cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)) { /* Eat the ';', then skip rest of characters on this line. */ cp_lexer_consume_token (parser->lexer); - cp_parser_cw_skip_to_eol (parser); + cp_parser_iasm_skip_to_eol (parser); } } @@ -17117,7 +17120,7 @@ cp_parser_cw_maybe_skip_comments (cp_parser *parser) the line. */ static void -cp_parser_cw_asm_statement_seq_opt (cp_parser* parser) +cp_parser_iasm_statement_seq_opt (cp_parser* parser) { int check; /* Scan statements until there aren't any more. */ @@ -17130,7 +17133,7 @@ cp_parser_cw_asm_statement_seq_opt (cp_parser* parser) /* ; denotes comments in MS-style asms. */ if (flag_ms_asms) { - cp_parser_cw_maybe_skip_comments (parser); + cp_parser_iasm_maybe_skip_comments (parser); return; } cp_lexer_consume_token (parser->lexer); @@ -17142,40 +17145,55 @@ cp_parser_cw_asm_statement_seq_opt (cp_parser* parser) else { /* Parse a single statement. */ - cp_parser_cw_asm_statement (parser); + cp_parser_iasm_statement (parser); check = 1; } if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE) || cp_lexer_next_token_is (parser->lexer, CPP_EOF) /* We parse at most, one line. */ - || cp_lexer_cw_bol (parser->lexer)) + || cp_lexer_iasm_bol (parser->lexer)) return; if (check && !(cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE) || cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON) || cp_lexer_next_token_is_keyword (parser->lexer, RID_ASM) - || cp_lexer_cw_bol (parser->lexer))) + || cp_lexer_iasm_bol (parser->lexer))) { cp_parser_error (parser, "expected `;' or `}' `asm' or end-of-line"); } } - if (!cp_lexer_cw_bol (parser->lexer)) - cp_parser_cw_maybe_skip_comments (parser); + if (!cp_lexer_iasm_bol (parser->lexer)) + cp_parser_iasm_maybe_skip_comments (parser); } /* Build an identifier comprising the string passed and the next token. */ static tree -cw_build_identifier_string (cp_parser* parser, const char* str) +iasm_build_identifier_string (cp_parser* parser, const char* str) { char *buf; int len; tree id; - id = cp_parser_cw_identifier_or_number (parser); + if (strcmp (str, ".") == 0 + && (cp_lexer_peek_token (parser->lexer)->flags & PREV_WHITE) == 0) + { + if (cp_lexer_next_token_is_keyword (parser->lexer, RID_SHORT)) + { + cp_lexer_consume_token (parser->lexer); + return get_identifier (".short"); + } + if (cp_lexer_next_token_is_keyword (parser->lexer, RID_LONG)) + { + cp_lexer_consume_token (parser->lexer); + return get_identifier (".long"); + } + } + + id = cp_parser_iasm_identifier_or_number (parser); len = strlen (str); buf = (char *) alloca (IDENTIFIER_LENGTH (id) + len + 1); memcpy (buf, str, len); @@ -17189,7 +17207,7 @@ cw_build_identifier_string (cp_parser* parser, const char* str) the identifier. */ static tree -cp_parser_cw_identifier (cp_parser* parser) +cp_parser_iasm_identifier (cp_parser* parser) { cp_token *token; tree t; @@ -17226,10 +17244,10 @@ cp_parser_cw_identifier (cp_parser* parser) { /* .align */ cp_lexer_consume_token (parser->lexer); - t = cw_build_identifier_string (parser, "."); + t = iasm_build_identifier_string (parser, "."); } else if (token->value - && CW_SEE_OPCODE (TYPESPEC, token->value) == IDENTIFIER) + && IASM_SEE_OPCODE (TYPESPEC, token->value) == IDENTIFIER) { cp_lexer_consume_token (parser->lexer); t = token->value; @@ -17271,11 +17289,11 @@ cp_parser_cw_identifier (cp_parser* parser) cp_lexer_consume_token (parser->lexer); - return cw_get_identifier (t, str); + return iasm_get_identifier (t, str); } static tree -cp_parser_cw_identifier_or_number (cp_parser* parser) +cp_parser_iasm_identifier_or_number (cp_parser* parser) { cp_token *token; @@ -17294,16 +17312,16 @@ cp_parser_cw_identifier_or_number (cp_parser* parser) } static tree -cp_parser_cw_asm_maybe_prefix (cp_parser *parser, tree id) +cp_parser_iasm_maybe_prefix (cp_parser *parser, tree id) { tree prefix_list = NULL_TREE; - while (cw_is_prefix (id)) + while (iasm_is_prefix (id)) { - if (cp_lexer_cw_bol (parser->lexer)) + if (cp_lexer_iasm_bol (parser->lexer)) break; prefix_list = tree_cons (NULL_TREE, id, prefix_list); - id = cp_parser_cw_identifier (parser); + id = cp_parser_iasm_identifier (parser); } if (prefix_list) @@ -17312,7 +17330,7 @@ cp_parser_cw_asm_maybe_prefix (cp_parser *parser, tree id) } static void -cp_parser_cw_asm_statement (cp_parser* parser) +cp_parser_iasm_statement (cp_parser* parser) { tree aname, scspec, anothername, operands; @@ -17334,19 +17352,19 @@ cp_parser_cw_asm_statement (cp_parser* parser) else if (cp_lexer_next_token_is (parser->lexer, CPP_ATSIGN)) { cp_lexer_consume_token (parser->lexer); - aname = cp_parser_cw_identifier_or_number (parser); + aname = cp_parser_iasm_identifier_or_number (parser); /* Optional ':' after a label. */ if (cp_lexer_next_token_is (parser->lexer, CPP_COLON)) cp_lexer_consume_token (parser->lexer); - cw_asm_label (aname, 1); + iasm_label (aname, 1); } else { - aname = cp_parser_cw_identifier (parser); + aname = cp_parser_iasm_identifier (parser); if (cp_lexer_next_token_is (parser->lexer, CPP_COLON)) { cp_lexer_consume_token (parser->lexer); - cw_asm_label (aname, 0); + iasm_label (aname, 0); } else { @@ -17357,37 +17375,37 @@ cp_parser_cw_asm_statement (cp_parser* parser) if (scspec) { - anothername = cp_parser_cw_asm_operand (parser); - cw_asm_entry (aname, scspec, anothername); + anothername = cp_parser_iasm_operand (parser); + iasm_entry (aname, scspec, anothername); } else { - aname = cp_parser_cw_asm_maybe_prefix (parser, aname); - cw_asm_in_operands = 1; - operands = cp_parser_cw_asm_operands (parser); - cw_asm_stmt (aname, operands, input_line); + aname = cp_parser_iasm_maybe_prefix (parser, aname); + iasm_in_operands = 1; + operands = cp_parser_iasm_operands (parser); + iasm_stmt (aname, operands, input_line); } - if (cp_lexer_cw_bol (parser->lexer)) + if (cp_lexer_iasm_bol (parser->lexer)) return; break; } } - if (cp_lexer_cw_bol (parser->lexer)) + if (cp_lexer_iasm_bol (parser->lexer)) return; } - cp_parser_cw_maybe_skip_comments (parser); + cp_parser_iasm_maybe_skip_comments (parser); } /* Eat tokens until we get back to something we recognize. */ static void -cp_parser_cw_skip_to_next_asm (cp_parser *parser) +cp_parser_iasm_skip_to_next_asm (cp_parser *parser) { cp_token *token = cp_lexer_peek_token (parser->lexer); do { - if (cp_lexer_cw_bol (parser->lexer) + if (cp_lexer_iasm_bol (parser->lexer) || token->type == CPP_SEMICOLON || token->type == CPP_CLOSE_BRACE || token->type == CPP_EOF @@ -17399,21 +17417,21 @@ cp_parser_cw_skip_to_next_asm (cp_parser *parser) } tree -cp_parser_cw_asm_operands (cp_parser *parser) +cp_parser_iasm_operands (cp_parser *parser) { tree operands = NULL_TREE, operand; while (true) { /* If we're looking at the end of the line, then we've run out of operands. */ - if (cp_lexer_cw_bol (parser->lexer) + if (cp_lexer_iasm_bol (parser->lexer) || cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON) || cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE) || cp_lexer_next_token_is (parser->lexer, CPP_EOF) || cp_lexer_next_token_is_keyword (parser->lexer, RID_ASM)) break; - operand = cp_parser_cw_asm_operand (parser); + operand = cp_parser_iasm_operand (parser); if (operand && operand != error_mark_node) { @@ -17423,7 +17441,7 @@ cp_parser_cw_asm_operands (cp_parser *parser) } else { - cp_parser_cw_skip_to_next_asm (parser); + cp_parser_iasm_skip_to_next_asm (parser); return NULL_TREE; } } @@ -17432,7 +17450,7 @@ cp_parser_cw_asm_operands (cp_parser *parser) } tree -cp_parser_cw_asm_operand (cp_parser *parser) +cp_parser_iasm_operand (cp_parser *parser) { tree operand; @@ -17445,7 +17463,7 @@ cp_parser_cw_asm_operand (cp_parser *parser) /* Need to handle case of relative branch using: .[+|-]number syntax */ static tree -cp_parser_cw_asm_relative_branch (cp_parser *parser) +cp_parser_iasm_relative_branch (cp_parser *parser) { cp_token *token; token = cp_lexer_peek_nth_token (parser->lexer, 2); @@ -17456,7 +17474,7 @@ cp_parser_cw_asm_relative_branch (cp_parser *parser) cp_lexer_consume_token (parser->lexer); /* consume '-' or '+' */ cp_lexer_consume_token (parser->lexer); - return cw_build_identifier_string (parser, str); + return iasm_build_identifier_string (parser, str); } return error_mark_node; } @@ -17490,7 +17508,7 @@ cp_parser_cw_asm_relative_branch (cp_parser *parser) Returns a representation of the expression. */ static tree -cp_parser_cw_asm_postfix_expression (cp_parser *parser, bool address_p) +cp_parser_iasm_postfix_expression (cp_parser *parser, bool address_p) { bool for_offsetof = false; cp_token *token; @@ -17542,7 +17560,7 @@ cp_parser_cw_asm_postfix_expression (cp_parser *parser, bool address_p) if (token->type == CPP_DOT || token->type == CPP_MULT) { - postfix_expression = cp_parser_cw_asm_relative_branch (parser); + postfix_expression = cp_parser_iasm_relative_branch (parser); if (postfix_expression != error_mark_node) break; } @@ -17656,13 +17674,13 @@ cp_parser_cw_asm_postfix_expression (cp_parser *parser, bool address_p) /* Look for the closing `]'. */ cp_parser_require (parser, CPP_CLOSE_SQUARE, "`]'"); - if (inside_cw_asm_block) + if (inside_iasm_block) { if (TREE_CODE (postfix_expression) == BRACKET_EXPR || TREE_CODE (index) == IDENTIFIER_NODE || TREE_TYPE (index) == NULL_TREE) { - postfix_expression = cw_build_bracket (postfix_expression, index); + postfix_expression = iasm_build_bracket (postfix_expression, index); break; } } @@ -17694,7 +17712,7 @@ cp_parser_cw_asm_postfix_expression (cp_parser *parser, bool address_p) } postfix_expression = - cw_asm_build_register_offset (postfix_expression, expr); + iasm_build_register_offset (postfix_expression, expr); cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); @@ -17736,8 +17754,8 @@ cp_parser_cw_asm_postfix_expression (cp_parser *parser, bool address_p) { /* Consume the `.' or `->' operator. */ cp_lexer_consume_token (parser->lexer); - postfix_expression = cw_build_bracket (postfix_expression, - new_token->value); + postfix_expression = iasm_build_bracket (postfix_expression, + new_token->value); cp_lexer_consume_token (parser->lexer); break; } @@ -17832,7 +17850,7 @@ cp_parser_cw_asm_postfix_expression (cp_parser *parser, bool address_p) adjust_result_of_qualified_name_lookup (name, BINFO_TYPE (BASELINK_BINFO (name)), scope); postfix_expression - = cw_asm_cp_build_component_ref (postfix_expression, name); + = iasm_cp_build_component_ref (postfix_expression, name); } /* Otherwise, try the pseudo-destructor-name production. */ else @@ -17868,8 +17886,8 @@ cp_parser_cw_asm_postfix_expression (cp_parser *parser, bool address_p) /* Handle things like: inc dword ptr [eax] */ tree type = postfix_expression; cp_lexer_consume_token (parser->lexer); - postfix_expression = cp_parser_cw_asm_postfix_expression (parser, address_p); - postfix_expression = cw_ptr_conv (type, postfix_expression); + postfix_expression = cp_parser_iasm_postfix_expression (parser, address_p); + postfix_expression = iasm_ptr_conv (type, postfix_expression); } default: @@ -17883,11 +17901,11 @@ cp_parser_cw_asm_postfix_expression (cp_parser *parser, bool address_p) } int -cw_asm_typename_or_reserved (tree value) +iasm_typename_or_reserved (tree value) { tree type_decl; - if (CW_SEE_OPCODE (TYPESPEC, value) == IDENTIFIER) + if (IASM_SEE_OPCODE (TYPESPEC, value) == IDENTIFIER) return 0; if (C_IS_RESERVED_WORD (value)) |