Skip to content

Commit

Permalink
common: Use NPNR_ASSERT_FALSE for unreachable case
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanG077 authored and gatecat committed Sep 24, 2024
1 parent 93e233d commit 0af42f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions common/kernel/nextpnr_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include "archdefs.h"
#include "hashlib.h"
#include "indexed_store.h"
#include "log.h"
#include "nextpnr_base_types.h"
#include "nextpnr_namespaces.h"
#include "property.h"
Expand Down Expand Up @@ -201,7 +200,7 @@ enum PortType
case PORT_INOUT:
return "PORT_INOUT";
default:
log_error("Impossible PortType");
NPNR_ASSERT_FALSE("Impossible PortType");
}
}

Expand Down Expand Up @@ -250,7 +249,7 @@ enum TimingPortClass
case TMG_IGNORE:
return "TMG_IGNORE";
default:
log_error("Impossible TimingPortClass");
NPNR_ASSERT_FALSE("Impossible TimingPortClass");
}
}

Expand All @@ -268,7 +267,7 @@ enum ClockEdge
case FALLING_EDGE:
return "FALLING_EDGE";
default:
log_error("Impossible ClockEdge");
NPNR_ASSERT_FALSE("Impossible ClockEdge");
}
}

Expand Down Expand Up @@ -438,7 +437,7 @@ struct CriticalPath
case Type::HOLD:
return "hold";
default:
log_error("Impossible Segment::Type");
NPNR_ASSERT_FALSE("Impossible Segment::Type");
}
}

Expand Down
2 changes: 1 addition & 1 deletion common/kernel/timing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ const std::string TimingAnalyser::arcType_to_str(CellArc::ArcType typ)
case TimingAnalyser::CellArc::ENDPOINT:
return "ENDPOINT";
default:
log_error("Impossible CellArc::ArcType\n");
NPNR_ASSERT_FALSE("Impossible CellArc::ArcType\n");
}
}

Expand Down

0 comments on commit 0af42f1

Please sign in to comment.