diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-02-23 08:43:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-23 08:43:18 +0100 |
commit | bd10c7045865bc7788f695b3ecc4fb136a499d87 (patch) | |
tree | 17b378d5698fe51bcd2e67aa648e704b29427b88 /modules/gdscript | |
parent | 63b0d822d109f3612d5c22e4342ebef9cd3b9163 (diff) | |
parent | 2cf6ac6c507529884d6b8acfdc42f3bc1826b19d (diff) |
Merge pull request #36461 from akien-mga/c++17-fallthrough-attribute
Replace FALLTHROUGH macro by C++17 [[fallthrough]]
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/gdscript_editor.cpp | 8 | ||||
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 26 | ||||
-rw-r--r-- | modules/gdscript/gdscript_tokenizer.cpp | 6 |
3 files changed, 20 insertions, 20 deletions
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index eac879f3d9..bc3f66719f 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -2565,7 +2565,7 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path } break; case GDScriptParser::COMPLETION_FUNCTION: { is_function = true; - FALLTHROUGH; + [[fallthrough]]; } case GDScriptParser::COMPLETION_IDENTIFIER: { _find_identifiers(context, is_function, options); @@ -2608,7 +2608,7 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path } break; case GDScriptParser::COMPLETION_METHOD: { is_function = true; - FALLTHROUGH; + [[fallthrough]]; } case GDScriptParser::COMPLETION_INDEX: { const GDScriptParser::Node *node = parser.get_completion_node(); @@ -3330,7 +3330,7 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol case GDScriptParser::COMPLETION_PARENT_FUNCTION: case GDScriptParser::COMPLETION_FUNCTION: { is_function = true; - FALLTHROUGH; + [[fallthrough]]; } case GDScriptParser::COMPLETION_IDENTIFIER: { @@ -3462,7 +3462,7 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol } break; case GDScriptParser::COMPLETION_METHOD: { is_function = true; - FALLTHROUGH; + [[fallthrough]]; } case GDScriptParser::COMPLETION_INDEX: { const GDScriptParser::Node *node = parser.get_completion_node(); diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index ce6226d757..842ce6c1c1 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -793,7 +793,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s } _add_warning(GDScriptWarning::UNASSIGNED_VARIABLE_OP_ASSIGN, -1, identifier.operator String()); } - FALLTHROUGH; + [[fallthrough]]; } case GDScriptTokenizer::TK_OP_ASSIGN: { lv->assignments += 1; @@ -2766,13 +2766,12 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { } #endif // DEBUG_ENABLED switch (token) { - case GDScriptTokenizer::TK_EOF: + case GDScriptTokenizer::TK_EOF: { p_block->end_line = tokenizer->get_token_line(); + return; // End of file! + } break; case GDScriptTokenizer::TK_ERROR: { - return; //go back - - //end of file! - + return; } break; case GDScriptTokenizer::TK_NEWLINE: { @@ -3525,11 +3524,12 @@ void GDScriptParser::_parse_class(ClassNode *p_class) { case GDScriptTokenizer::TK_CURSOR: { tokenizer->advance(); } break; - case GDScriptTokenizer::TK_EOF: + case GDScriptTokenizer::TK_EOF: { p_class->end_line = tokenizer->get_token_line(); + return; // End of file! + } break; case GDScriptTokenizer::TK_ERROR: { - return; //go back - //end of file! + return; // Go back. } break; case GDScriptTokenizer::TK_NEWLINE: { if (!_parse_newline()) { @@ -3719,7 +3719,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) { return; } - FALLTHROUGH; + [[fallthrough]]; } case GDScriptTokenizer::TK_PR_FUNCTION: { @@ -4220,7 +4220,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) { break; } - FALLTHROUGH; + [[fallthrough]]; } case Variant::REAL: { @@ -5489,7 +5489,7 @@ String GDScriptParser::DataType::to_string() const { if (!gds_class.empty()) { return gds_class; } - FALLTHROUGH; + [[fallthrough]]; } case SCRIPT: { if (is_meta_type) { @@ -8345,7 +8345,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) { if (cn->value.get_type() == Variant::STRING) { break; } - FALLTHROUGH; + [[fallthrough]]; } default: { _mark_line_as_safe(statement->line); diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp index adcdbdc4a4..818033025e 100644 --- a/modules/gdscript/gdscript_tokenizer.cpp +++ b/modules/gdscript/gdscript_tokenizer.cpp @@ -343,7 +343,7 @@ StringName GDScriptTokenizer::get_token_literal(int p_offset) const { default: { } } - } + } break; case TK_OP_AND: case TK_OP_OR: break; // Don't get into default, since they can be non-literal @@ -539,7 +539,7 @@ void GDScriptTokenizerText::_advance() { ignore_warnings = true; } #endif // DEBUG_ENABLED - FALLTHROUGH; + [[fallthrough]]; } case '\n': { line++; @@ -756,7 +756,7 @@ void GDScriptTokenizerText::_advance() { } INCPOS(1); is_string_name = true; - FALLTHROUGH; + [[fallthrough]]; case '\'': case '"': { |