From f181b502493a90d8e9cc79feae77f9c7d90e0c1c Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Thu, 15 Dec 2022 17:36:39 +0000 Subject: [PATCH] [build] Address warnings in gcc 11 and 12. TEST=local builds Bug: https://github.com/dart-lang/sdk/issues/50645 Change-Id: If6cd26620feff06abd449be0f7d1dd1e620b8411 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275841 Reviewed-by: Alexander Aprelev Commit-Queue: Ryan Macnak --- runtime/vm/cpuinfo_linux.cc | 1 + runtime/vm/image_snapshot.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/runtime/vm/cpuinfo_linux.cc b/runtime/vm/cpuinfo_linux.cc index 27cc16ebd81..22e86cb5242 100644 --- a/runtime/vm/cpuinfo_linux.cc +++ b/runtime/vm/cpuinfo_linux.cc @@ -67,6 +67,7 @@ void CpuInfo::Cleanup() { bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) { if (method_ == kCpuInfoCpuId) { const char* field = CpuId::field(idx); + if (field == NULL) return false; bool contains = (strstr(field, search_string) != NULL); free(const_cast(field)); return contains; diff --git a/runtime/vm/image_snapshot.cc b/runtime/vm/image_snapshot.cc index c11a5faf6fe..912eb131fac 100644 --- a/runtime/vm/image_snapshot.cc +++ b/runtime/vm/image_snapshot.cc @@ -640,6 +640,7 @@ const char* ImageWriter::SectionSymbol(ProgramSection section, bool vm) { case ProgramSection::BuildId: return kSnapshotBuildIdAsmSymbol; } + UNREACHABLE(); return nullptr; }