[vm] Fix build for gcc 7.3.0.

Change-Id: I02ead73679c3a6e1e5c9313f78c5f02ad6ca79b0
Reviewed-on: https://dart-review.googlesource.com/53521
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak 2018-05-03 17:59:44 +00:00 committed by commit-bot@chromium.org
parent 9d10a6ad4a
commit 7e54844fe7
12 changed files with 177 additions and 65 deletions

View file

@ -501,6 +501,7 @@ if (is_win) {
default_warning_flags += [
# Permanent.
"/wd4091", # typedef warning from dbghelp.h
"/wd4722", # destructor never returns
# Investigate.
"/wd4312", # int to pointer of greater size conversion.

View file

@ -88,5 +88,5 @@ void Console::RestoreConfig() {
} // namespace bin
} // namespace dart
#endif // defined(HOST_OS_LINUX) || defined(HOST_OS_MACOS) || \
#endif // defined(HOST_OS_LINUX) || defined(HOST_OS_MACOS) ||
// defined(HOST_OS_ANDROID) || defined(HOST_OS_FUCHSIA)

View file

@ -297,7 +297,7 @@ static int Main(int argc, const char** argv) {
OS::PrintErr("No tests matched: %s\n", run_filter);
return 1;
}
if (DynamicAssertionHelper::failed()) {
if (Expect::failed()) {
return 255;
}
return 0;

View file

@ -10,9 +10,9 @@
namespace dart {
bool DynamicAssertionHelper::failed_ = false;
bool Expect::failed_ = false;
void DynamicAssertionHelper::Fail(const char* format, ...) {
void DynamicAssertionHelper::Print(const char* format, va_list arguments) {
// Take only the last 1KB of the file name if it is longer.
const intptr_t file_len = strlen(file_);
const intptr_t file_offset = (file_len > (1 * KB)) ? file_len - (1 * KB) : 0;
@ -25,22 +25,32 @@ void DynamicAssertionHelper::Fail(const char* format, ...) {
snprintf(buffer, sizeof(buffer), "%s: %d: error: ", file, line_);
// Print the error message into the buffer.
va_list arguments;
va_start(arguments, format);
vsnprintf(buffer + file_and_line_length,
sizeof(buffer) - file_and_line_length, format, arguments);
va_end(arguments);
// Print the buffer on stderr and/or syslog.
OS::PrintErr("%s\n", buffer);
}
// In case of failed assertions, abort right away. Otherwise, wait
// until the program is exiting before producing a non-zero exit
// code through abort.
if (kind_ == ASSERT) {
void Assert::Fail(const char* format, ...) {
va_list arguments;
va_start(arguments, format);
Print(format, arguments);
va_end(arguments);
// Abort right away.
NOT_IN_PRODUCT(Dart_DumpNativeStackTrace(NULL));
OS::Abort();
}
void Expect::Fail(const char* format, ...) {
va_list arguments;
va_start(arguments, format);
Print(format, arguments);
va_end(arguments);
// Wait until the program is exiting before producing a non-zero exit
// code through abort.
failed_ = true;
}

View file

@ -26,15 +26,34 @@ namespace dart {
class DynamicAssertionHelper {
public:
enum Kind { ASSERT, EXPECT };
DynamicAssertionHelper(const char* file, int line)
: file_(file), line_(line) {}
DynamicAssertionHelper(const char* file, int line, Kind kind)
: file_(file), line_(line), kind_(kind) {}
protected:
void Print(const char* format, va_list arguments);
const char* const file_;
const int line_;
DISALLOW_IMPLICIT_CONSTRUCTORS(DynamicAssertionHelper);
};
class Assert : public DynamicAssertionHelper {
public:
Assert(const char* file, int line) : DynamicAssertionHelper(file, line) {}
DART_NORETURN void Fail(const char* format, ...) PRINTF_ATTRIBUTE(2, 3);
template <typename T>
T NotNull(const T p);
};
class Expect : public DynamicAssertionHelper {
public:
Expect(const char* file, int line) : DynamicAssertionHelper(file, line) {}
void Fail(const char* format, ...) PRINTF_ATTRIBUTE(2, 3);
static bool failed() { return failed_; }
#if defined(TESTING)
template <typename E, typename A>
void Equals(const E& expected, const A& actual);
@ -65,38 +84,29 @@ class DynamicAssertionHelper {
template <typename E, typename A>
void GreaterEqual(const E& left, const A& right);
#endif
template <typename T>
T NotNull(const T p);
#endif
static bool failed() { return failed_; }
private:
static bool failed_;
const char* const file_;
const int line_;
const Kind kind_;
DISALLOW_IMPLICIT_CONSTRUCTORS(DynamicAssertionHelper);
};
class Assert : public DynamicAssertionHelper {
public:
Assert(const char* file, int line)
: DynamicAssertionHelper(file, line, ASSERT) {}
};
class Expect : public DynamicAssertionHelper {
public:
Expect(const char* file, int line)
: DynamicAssertionHelper(file, line, EXPECT) {}
};
template <typename T>
T Assert::NotNull(const T p) {
if (p != NULL) return p;
Fail("expected: not NULL, found NULL");
return NULL;
}
#if defined(TESTING)
// Only allow the expensive (with respect to code size) assertions
// in testing code.
template <typename E, typename A>
void DynamicAssertionHelper::Equals(const E& expected, const A& actual) {
void Expect::Equals(const E& expected, const A& actual) {
if (actual == expected) return;
std::ostringstream ess, ass;
ess << expected;
@ -106,7 +116,7 @@ void DynamicAssertionHelper::Equals(const E& expected, const A& actual) {
}
template <typename E, typename A>
void DynamicAssertionHelper::NotEquals(const E& not_expected, const A& actual) {
void Expect::NotEquals(const E& not_expected, const A& actual) {
if (actual != not_expected) return;
std::ostringstream ness;
ness << not_expected;
@ -115,9 +125,7 @@ void DynamicAssertionHelper::NotEquals(const E& not_expected, const A& actual) {
}
template <typename E, typename A, typename T>
void DynamicAssertionHelper::FloatEquals(const E& expected,
const A& actual,
const T& tol) {
void Expect::FloatEquals(const E& expected, const A& actual, const T& tol) {
if (((expected - tol) <= actual) && (actual <= (expected + tol))) {
return;
}
@ -131,7 +139,7 @@ void DynamicAssertionHelper::FloatEquals(const E& expected,
}
template <typename E, typename A>
NO_SANITIZE_MEMORY void DynamicAssertionHelper::StringEquals(const E& expected,
NO_SANITIZE_MEMORY void Expect::StringEquals(const E& expected,
const A& actual) {
std::ostringstream ess, ass;
ess << expected;
@ -142,7 +150,7 @@ NO_SANITIZE_MEMORY void DynamicAssertionHelper::StringEquals(const E& expected,
}
template <typename E, typename A>
NO_SANITIZE_MEMORY void DynamicAssertionHelper::IsSubstring(const E& needle,
NO_SANITIZE_MEMORY void Expect::IsSubstring(const E& needle,
const A& haystack) {
std::ostringstream ess, ass;
ess << needle;
@ -154,8 +162,7 @@ NO_SANITIZE_MEMORY void DynamicAssertionHelper::IsSubstring(const E& needle,
}
template <typename E, typename A>
NO_SANITIZE_MEMORY void DynamicAssertionHelper::IsNotSubstring(
const E& needle,
NO_SANITIZE_MEMORY void Expect::IsNotSubstring(const E& needle,
const A& haystack) {
std::ostringstream ess, ass;
ess << needle;
@ -167,7 +174,7 @@ NO_SANITIZE_MEMORY void DynamicAssertionHelper::IsNotSubstring(
}
template <typename E, typename A>
void DynamicAssertionHelper::LessThan(const E& left, const A& right) {
void Expect::LessThan(const E& left, const A& right) {
if (left < right) return;
std::ostringstream ess, ass;
ess << left;
@ -177,7 +184,7 @@ void DynamicAssertionHelper::LessThan(const E& left, const A& right) {
}
template <typename E, typename A>
void DynamicAssertionHelper::LessEqual(const E& left, const A& right) {
void Expect::LessEqual(const E& left, const A& right) {
if (left <= right) return;
std::ostringstream ess, ass;
ess << left;
@ -187,7 +194,7 @@ void DynamicAssertionHelper::LessEqual(const E& left, const A& right) {
}
template <typename E, typename A>
void DynamicAssertionHelper::GreaterThan(const E& left, const A& right) {
void Expect::GreaterThan(const E& left, const A& right) {
if (left > right) return;
std::ostringstream ess, ass;
ess << left;
@ -197,7 +204,7 @@ void DynamicAssertionHelper::GreaterThan(const E& left, const A& right) {
}
template <typename E, typename A>
void DynamicAssertionHelper::GreaterEqual(const E& left, const A& right) {
void Expect::GreaterEqual(const E& left, const A& right) {
if (left >= right) return;
std::ostringstream ess, ass;
ess << left;
@ -205,14 +212,14 @@ void DynamicAssertionHelper::GreaterEqual(const E& left, const A& right) {
std::string es = ess.str(), as = ass.str();
Fail("expected: %s >= %s", es.c_str(), as.c_str());
}
#endif
template <typename T>
T DynamicAssertionHelper::NotNull(const T p) {
T Expect::NotNull(const T p) {
if (p != NULL) return p;
Fail("expected: not NULL, found NULL");
return NULL;
}
#endif
} // namespace dart

View file

@ -78,8 +78,10 @@ uint32_t Utils::StringHash(const char* data, int length) {
switch (size) {
case 3:
hash ^= cursor[2] << 16;
/* Falls through. */
case 2:
hash ^= cursor[1] << 8;
/* Falls through. */
case 1:
hash ^= cursor[0];
hash *= M;

View file

@ -314,7 +314,7 @@ bool BinaryOpNode::IsPotentiallyConst() const {
this->right()->AsLiteralNode()->literal().IsNull()) {
return false;
}
// Fall-through intentional.
/* Falls through */
case Token::kADD:
case Token::kSUB:
case Token::kMUL:
@ -353,7 +353,7 @@ const Instance* BinaryOpNode::EvalConstExpr() const {
if (left_val->IsString()) {
return right_val->IsString() ? left_val : NULL;
}
// Fall-through intentional.
/* Falls through */
case Token::kSUB:
case Token::kMUL:
case Token::kDIV:

View file

@ -3263,7 +3263,10 @@ class InstanceCallInstr : public TemplateDartCall<0> {
CompileType* result_type() const { return result_type_; }
intptr_t result_cid() const {
return (result_type_ != NULL) ? result_type_->ToCid() : kDynamicCid;
if (result_type_ == NULL) {
return kDynamicCid;
}
return result_type_->ToCid();
}
PRINT_OPERANDS_TO_SUPPORT
@ -3759,7 +3762,10 @@ class StaticCallInstr : public TemplateDartCall<0> {
CompileType* result_type() const { return result_type_; }
intptr_t result_cid() const {
return (result_type_ != NULL) ? result_type_->ToCid() : kDynamicCid;
if (result_type_ == NULL) {
return kDynamicCid;
}
return result_type_->ToCid();
}
bool is_known_list_constructor() const { return is_known_list_constructor_; }

View file

@ -38,43 +38,55 @@ void FunctionNodeHelper::ReadUntilExcluding(Field field) {
ASSERT(tag == kFunctionNode);
if (++next_read_ == field) return;
}
/* Falls through */
case kPosition:
position_ = helper_->ReadPosition(); // read position.
if (++next_read_ == field) return;
/* Falls through */
case kEndPosition:
end_position_ = helper_->ReadPosition(); // read end position.
if (++next_read_ == field) return;
/* Falls through */
case kAsyncMarker:
async_marker_ = static_cast<AsyncMarker>(helper_->ReadByte());
if (++next_read_ == field) return;
/* Falls through */
case kDartAsyncMarker:
dart_async_marker_ = static_cast<AsyncMarker>(
helper_->ReadByte()); // read dart async marker.
if (++next_read_ == field) return;
/* Falls through */
case kTypeParameters:
helper_->SkipTypeParametersList(); // read type parameters.
if (++next_read_ == field) return;
/* Falls through */
case kTotalParameterCount:
total_parameter_count_ =
helper_->ReadUInt(); // read total parameter count.
if (++next_read_ == field) return;
/* Falls through */
case kRequiredParameterCount:
required_parameter_count_ =
helper_->ReadUInt(); // read required parameter count.
if (++next_read_ == field) return;
/* Falls through */
case kPositionalParameters:
helper_->SkipListOfVariableDeclarations(); // read positionals.
if (++next_read_ == field) return;
/* Falls through */
case kNamedParameters:
helper_->SkipListOfVariableDeclarations(); // read named.
if (++next_read_ == field) return;
/* Falls through */
case kReturnType:
helper_->SkipDartType(); // read return type.
if (++next_read_ == field) return;
/* Falls through */
case kBody:
if (helper_->ReadTag() == kSomething)
helper_->SkipStatement(); // read body.
if (++next_read_ == field) return;
/* Falls through */
case kEnd:
return;
}
@ -114,25 +126,32 @@ void VariableDeclarationHelper::ReadUntilExcluding(Field field) {
case kPosition:
position_ = helper_->ReadPosition(); // read position.
if (++next_read_ == field) return;
/* Falls through */
case kEqualPosition:
equals_position_ = helper_->ReadPosition(); // read equals position.
if (++next_read_ == field) return;
/* Falls through */
case kAnnotations:
helper_->SkipListOfExpressions(); // read annotations.
if (++next_read_ == field) return;
/* Falls through */
case kFlags:
flags_ = helper_->ReadFlags();
if (++next_read_ == field) return;
/* Falls through */
case kNameIndex:
name_index_ = helper_->ReadStringReference(); // read name index.
if (++next_read_ == field) return;
/* Falls through */
case kType:
helper_->SkipDartType(); // read type.
if (++next_read_ == field) return;
/* Falls through */
case kInitializer:
if (helper_->ReadTag() == kSomething)
helper_->SkipExpression(); // read initializer.
if (++next_read_ == field) return;
/* Falls through */
case kEnd:
return;
}
@ -156,28 +175,35 @@ void FieldHelper::ReadUntilExcluding(Field field,
ASSERT(tag == kField);
if (++next_read_ == field) return;
}
/* Falls through */
case kCanonicalName:
canonical_name_ =
helper_->ReadCanonicalNameReference(); // read canonical_name.
if (++next_read_ == field) return;
/* Falls through */
case kSourceUriIndex:
source_uri_index_ = helper_->ReadUInt(); // read source_uri_index.
helper_->set_current_script_id(source_uri_index_);
if (++next_read_ == field) return;
/* Falls through */
case kPosition:
position_ = helper_->ReadPosition(false); // read position.
helper_->RecordTokenPosition(position_);
if (++next_read_ == field) return;
/* Falls through */
case kEndPosition:
end_position_ = helper_->ReadPosition(false); // read end position.
helper_->RecordTokenPosition(end_position_);
if (++next_read_ == field) return;
/* Falls through */
case kFlags:
flags_ = helper_->ReadFlags();
if (++next_read_ == field) return;
/* Falls through */
case kName:
helper_->SkipName(); // read name.
if (++next_read_ == field) return;
/* Falls through */
case kAnnotations: {
annotation_count_ = helper_->ReadListLength(); // read list length.
for (intptr_t i = 0; i < annotation_count_; ++i) {
@ -185,9 +211,11 @@ void FieldHelper::ReadUntilExcluding(Field field,
}
if (++next_read_ == field) return;
}
/* Falls through */
case kType:
helper_->SkipDartType(); // read type.
if (++next_read_ == field) return;
/* Falls through */
case kInitializer:
if (helper_->ReadTag() == kSomething) {
if (detect_function_literal_initializer &&
@ -207,6 +235,7 @@ void FieldHelper::ReadUntilExcluding(Field field,
helper_->SkipExpression(); // read initializer.
}
if (++next_read_ == field) return;
/* Falls through */
case kEnd:
return;
}
@ -222,31 +251,39 @@ void ProcedureHelper::ReadUntilExcluding(Field field) {
ASSERT(tag == kProcedure);
if (++next_read_ == field) return;
}
/* Falls through */
case kCanonicalName:
canonical_name_ =
helper_->ReadCanonicalNameReference(); // read canonical_name.
if (++next_read_ == field) return;
/* Falls through */
case kSourceUriIndex:
source_uri_index_ = helper_->ReadUInt(); // read source_uri_index.
helper_->set_current_script_id(source_uri_index_);
if (++next_read_ == field) return;
/* Falls through */
case kPosition:
position_ = helper_->ReadPosition(false); // read position.
helper_->RecordTokenPosition(position_);
if (++next_read_ == field) return;
/* Falls through */
case kEndPosition:
end_position_ = helper_->ReadPosition(false); // read end position.
helper_->RecordTokenPosition(end_position_);
if (++next_read_ == field) return;
/* Falls through */
case kKind:
kind_ = static_cast<Kind>(helper_->ReadByte());
if (++next_read_ == field) return;
/* Falls through */
case kFlags:
flags_ = helper_->ReadFlags();
if (++next_read_ == field) return;
/* Falls through */
case kName:
helper_->SkipName(); // read name.
if (++next_read_ == field) return;
/* Falls through */
case kAnnotations: {
annotation_count_ = helper_->ReadListLength(); // read list length.
for (intptr_t i = 0; i < annotation_count_; ++i) {
@ -254,20 +291,24 @@ void ProcedureHelper::ReadUntilExcluding(Field field) {
}
if (++next_read_ == field) return;
}
/* Falls through */
case kForwardingStubSuperTarget:
if (helper_->ReadTag() == kSomething) {
forwarding_stub_super_target_ = helper_->ReadCanonicalNameReference();
}
if (++next_read_ == field) return;
/* Falls through */
case kForwardingStubInterfaceTarget:
if (helper_->ReadTag() == kSomething) {
helper_->ReadCanonicalNameReference();
}
if (++next_read_ == field) return;
/* Falls through */
case kFunction:
if (helper_->ReadTag() == kSomething)
helper_->SkipFunctionNode(); // read function node.
if (++next_read_ == field) return;
/* Falls through */
case kEnd:
return;
}
@ -283,28 +324,35 @@ void ConstructorHelper::ReadUntilExcluding(Field field) {
ASSERT(tag == kConstructor);
if (++next_read_ == field) return;
}
/* Falls through */
case kCanonicalName:
canonical_name_ =
helper_->ReadCanonicalNameReference(); // read canonical_name.
if (++next_read_ == field) return;
/* Falls through */
case kSourceUriIndex:
source_uri_index_ = helper_->ReadUInt(); // read source_uri_index.
helper_->set_current_script_id(source_uri_index_);
if (++next_read_ == field) return;
/* Falls through */
case kPosition:
position_ = helper_->ReadPosition(); // read position.
helper_->RecordTokenPosition(position_);
if (++next_read_ == field) return;
/* Falls through */
case kEndPosition:
end_position_ = helper_->ReadPosition(); // read end position.
helper_->RecordTokenPosition(end_position_);
if (++next_read_ == field) return;
/* Falls through */
case kFlags:
flags_ = helper_->ReadFlags();
if (++next_read_ == field) return;
/* Falls through */
case kName:
helper_->SkipName(); // read name.
if (++next_read_ == field) return;
/* Falls through */
case kAnnotations: {
annotation_count_ = helper_->ReadListLength(); // read list length.
for (intptr_t i = 0; i < annotation_count_; ++i) {
@ -312,9 +360,11 @@ void ConstructorHelper::ReadUntilExcluding(Field field) {
}
if (++next_read_ == field) return;
}
/* Falls through */
case kFunction:
helper_->SkipFunctionNode(); // read function.
if (++next_read_ == field) return;
/* Falls through */
case kInitializers: {
intptr_t list_length =
helper_->ReadListLength(); // read initializers list length.
@ -323,6 +373,7 @@ void ConstructorHelper::ReadUntilExcluding(Field field) {
}
if (++next_read_ == field) return;
}
/* Falls through */
case kEnd:
return;
}
@ -338,28 +389,35 @@ void ClassHelper::ReadUntilExcluding(Field field) {
ASSERT(tag == kClass);
if (++next_read_ == field) return;
}
/* Falls through */
case kCanonicalName:
canonical_name_ =
helper_->ReadCanonicalNameReference(); // read canonical_name.
if (++next_read_ == field) return;
/* Falls through */
case kSourceUriIndex:
source_uri_index_ = helper_->ReadUInt(); // read source_uri_index.
helper_->set_current_script_id(source_uri_index_);
if (++next_read_ == field) return;
/* Falls through */
case kPosition:
position_ = helper_->ReadPosition(false); // read position.
helper_->RecordTokenPosition(position_);
if (++next_read_ == field) return;
/* Falls through */
case kEndPosition:
end_position_ = helper_->ReadPosition(); // read end position.
helper_->RecordTokenPosition(end_position_);
if (++next_read_ == field) return;
/* Falls through */
case kFlags:
flags_ = helper_->ReadFlags(); // read flags.
if (++next_read_ == field) return;
/* Falls through */
case kNameIndex:
name_index_ = helper_->ReadStringReference(); // read name index.
if (++next_read_ == field) return;
/* Falls through */
case kAnnotations: {
annotation_count_ = helper_->ReadListLength(); // read list length.
for (intptr_t i = 0; i < annotation_count_; ++i) {
@ -367,9 +425,11 @@ void ClassHelper::ReadUntilExcluding(Field field) {
}
if (++next_read_ == field) return;
}
/* Falls through */
case kTypeParameters:
helper_->SkipTypeParametersList(); // read type parameters.
if (++next_read_ == field) return;
/* Falls through */
case kSuperClass: {
Tag type_tag = helper_->ReadTag(); // read super class type (part 1).
if (type_tag == kSomething) {
@ -377,6 +437,7 @@ void ClassHelper::ReadUntilExcluding(Field field) {
}
if (++next_read_ == field) return;
}
/* Falls through */
case kMixinType: {
Tag type_tag = helper_->ReadTag(); // read mixin type (part 1).
if (type_tag == kSomething) {
@ -384,9 +445,11 @@ void ClassHelper::ReadUntilExcluding(Field field) {
}
if (++next_read_ == field) return;
}
/* Falls through */
case kImplementedClasses:
helper_->SkipListOfDartTypes(); // read implemented_classes.
if (++next_read_ == field) return;
/* Falls through */
case kFields: {
intptr_t list_length =
helper_->ReadListLength(); // read fields list length.
@ -396,6 +459,7 @@ void ClassHelper::ReadUntilExcluding(Field field) {
}
if (++next_read_ == field) return;
}
/* Falls through */
case kConstructors: {
intptr_t list_length =
helper_->ReadListLength(); // read constructors list length.
@ -406,6 +470,7 @@ void ClassHelper::ReadUntilExcluding(Field field) {
}
if (++next_read_ == field) return;
}
/* Falls through */
case kProcedures: {
procedure_count_ = helper_->ReadListLength(); // read procedures #.
for (intptr_t i = 0; i < procedure_count_; i++) {
@ -415,6 +480,7 @@ void ClassHelper::ReadUntilExcluding(Field field) {
}
if (++next_read_ == field) return;
}
/* Falls through */
case kClassIndex:
// Read class index.
for (intptr_t i = 0; i < procedure_count_; ++i) {
@ -423,6 +489,7 @@ void ClassHelper::ReadUntilExcluding(Field field) {
helper_->reader_.ReadUInt32();
helper_->reader_.ReadUInt32();
if (++next_read_ == field) return;
/* Falls through */
case kEnd:
return;
}
@ -437,20 +504,25 @@ void LibraryHelper::ReadUntilExcluding(Field field) {
flags_ = helper_->ReadFlags();
if (++next_read_ == field) return;
}
/* Falls through */
case kCanonicalName:
canonical_name_ =
helper_->ReadCanonicalNameReference(); // read canonical_name.
if (++next_read_ == field) return;
/* Falls through */
case kName:
name_index_ = helper_->ReadStringReference(); // read name index.
if (++next_read_ == field) return;
/* Falls through */
case kSourceUriIndex:
source_uri_index_ = helper_->ReadUInt(); // read source_uri_index.
helper_->set_current_script_id(source_uri_index_);
if (++next_read_ == field) return;
/* Falls through */
case kAnnotations:
helper_->SkipListOfExpressions(); // read annotations.
if (++next_read_ == field) return;
/* Falls through */
case kDependencies: {
intptr_t dependency_count = helper_->ReadUInt(); // read list length.
for (intptr_t i = 0; i < dependency_count; ++i) {
@ -458,6 +530,7 @@ void LibraryHelper::ReadUntilExcluding(Field field) {
}
if (++next_read_ == field) return;
}
/* Falls through */
case kAdditionalExports: {
intptr_t name_count = helper_->ReadUInt();
for (intptr_t i = 0; i < name_count; ++i) {
@ -465,6 +538,7 @@ void LibraryHelper::ReadUntilExcluding(Field field) {
}
if (++next_read_ == field) return;
}
/* Falls through */
case kParts: {
intptr_t part_count = helper_->ReadUInt(); // read list length.
for (intptr_t i = 0; i < part_count; ++i) {
@ -472,6 +546,7 @@ void LibraryHelper::ReadUntilExcluding(Field field) {
}
if (++next_read_ == field) return;
}
/* Falls through */
case kTypedefs: {
intptr_t typedef_count = helper_->ReadListLength(); // read list length.
for (intptr_t i = 0; i < typedef_count; i++) {
@ -479,6 +554,7 @@ void LibraryHelper::ReadUntilExcluding(Field field) {
}
if (++next_read_ == field) return;
}
/* Falls through */
case kClasses: {
class_count_ = helper_->ReadListLength(); // read list length.
for (intptr_t i = 0; i < class_count_; ++i) {
@ -487,6 +563,7 @@ void LibraryHelper::ReadUntilExcluding(Field field) {
}
if (++next_read_ == field) return;
}
/* Falls through */
case kToplevelField: {
intptr_t field_count = helper_->ReadListLength(); // read list length.
for (intptr_t i = 0; i < field_count; ++i) {
@ -495,6 +572,7 @@ void LibraryHelper::ReadUntilExcluding(Field field) {
}
if (++next_read_ == field) return;
}
/* Falls through */
case kToplevelProcedures: {
procedure_count_ = helper_->ReadListLength(); // read list length.
for (intptr_t i = 0; i < procedure_count_; ++i) {
@ -503,6 +581,7 @@ void LibraryHelper::ReadUntilExcluding(Field field) {
}
if (++next_read_ == field) return;
}
/* Falls through */
case kLibraryIndex:
// Read library index.
for (intptr_t i = 0; i < class_count_; ++i) {
@ -516,6 +595,7 @@ void LibraryHelper::ReadUntilExcluding(Field field) {
helper_->reader_.ReadUInt32();
helper_->reader_.ReadUInt32();
if (++next_read_ == field) return;
/* Falls through */
case kEnd:
return;
}
@ -530,22 +610,27 @@ void LibraryDependencyHelper::ReadUntilExcluding(Field field) {
helper_->ReadPosition();
if (++next_read_ == field) return;
}
/* Falls through */
case kFlags: {
flags_ = helper_->ReadFlags();
if (++next_read_ == field) return;
}
/* Falls through */
case kAnnotations: {
helper_->SkipListOfExpressions();
if (++next_read_ == field) return;
}
/* Falls through */
case kTargetLibrary: {
target_library_canonical_name_ = helper_->ReadCanonicalNameReference();
if (++next_read_ == field) return;
}
/* Falls through */
case kName: {
name_index_ = helper_->ReadStringReference();
if (++next_read_ == field) return;
}
/* Falls through */
case kCombinators: {
intptr_t count = helper_->ReadListLength();
for (intptr_t i = 0; i < count; ++i) {
@ -556,6 +641,7 @@ void LibraryDependencyHelper::ReadUntilExcluding(Field field) {
}
if (++next_read_ == field) return;
}
/* Falls through */
case kEnd:
return;
}
@ -5779,7 +5865,7 @@ FlowGraph* StreamingFlowGraphBuilder::BuildGraph(intptr_t kernel_offset) {
return BuildGraphOfImplicitClosureFunction(function);
}
}
// fallthrough intended
/* Falls through */
case RawFunction::kClosureFunction:
case RawFunction::kConvertedClosureFunction: {
ReadUntilFunctionNode(parsed_function()); // read until function node.

View file

@ -3268,9 +3268,9 @@ TEST_CASE(StackTraceFormat) {
const char* lib_url =
isolate->use_dart_frontend() ? "file:///test-lib" : "test-lib";
const size_t kExpectedLen = 512;
char expected[kExpectedLen];
snprintf(expected, kExpectedLen,
const size_t kBufferSize = 1024;
char expected[kBufferSize];
snprintf(expected, kBufferSize,
"Unhandled exception:\n"
"MyException\n"
"#0 baz (%1$s:2:3)\n"

View file

@ -120,9 +120,9 @@ class OS {
// Shut down the OS class.
static void Shutdown();
static void Abort();
static DART_NORETURN void Abort();
static void Exit(int code);
static DART_NORETURN void Exit(int code);
};
} // namespace dart

View file

@ -557,8 +557,8 @@ RegExpTree* RegExpParser::ParseDisjunction() {
ReportError("Nothing to repeat");
UNREACHABLE();
}
// fallthrough
}
/* Falls through */
default:
builder->AddCharacter(current());
Advance();