Skip to content

Commit

Permalink
OcdFileExport: Use exception instead of Q_UNREACHABLE
Browse files Browse the repository at this point in the history
Avoid undefined behaviour.
  • Loading branch information
dg0yt committed Dec 20, 2020
1 parent 0b44c8a commit 8c6be46
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/fileformats/ocd_file_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,7 @@ void OcdFileExport::exportSymbols(OcdFile<Format>& file)

case Symbol::NoSymbol:
case Symbol::AllSymbols:
Q_UNREACHABLE();
FILEFORMAT_ASSERT(false); // unreachable
}

FILEFORMAT_ASSERT(!ocd_symbol.isEmpty());
Expand Down Expand Up @@ -1331,7 +1331,7 @@ qint16 OcdFileExport::exportSubPattern(const MapCoordVector& coords, const Symbo
case Symbol::AllSymbols:
case Symbol::Combined:
case Symbol::Text:
Q_UNREACHABLE();
FILEFORMAT_ASSERT(false); // unreachable
}

return num_coords;
Expand Down Expand Up @@ -2153,7 +2153,7 @@ void OcdFileExport::exportCombinedSymbol(OcdFile<Format>& file, const CombinedSy
case Symbol::Text:
case Symbol::NoSymbol:
case Symbol::AllSymbols:
Q_UNREACHABLE();
FILEFORMAT_ASSERT(false); // unreachable
}
break;

Expand Down Expand Up @@ -2315,7 +2315,7 @@ void OcdFileExport::exportGenericCombinedSymbol(OcdFile<Format>& file, const Com
break;
case Symbol::NoSymbol:
case Symbol::AllSymbols:
Q_UNREACHABLE();
FILEFORMAT_ASSERT(false); // unreachable
}
if (type == 0)
{
Expand Down Expand Up @@ -2353,7 +2353,7 @@ QByteArray OcdFileExport::exportCombinedAreaSymbol<Ocd::AreaSymbolV8>(
const AreaSymbol* /*area_symbol*/,
const Symbol* /*line_symbol*/)
{
Q_UNREACHABLE();
FILEFORMAT_ASSERT(false); // unreachable
}


Expand Down

0 comments on commit 8c6be46

Please sign in to comment.