From c0874cf927def6f8ca327390d16f054ac65d8912 Mon Sep 17 00:00:00 2001 From: Axel Feldmann Date: Thu, 16 May 2024 21:29:22 -0400 Subject: [PATCH] Fix undefined behavior in element.cpp --- include/element.h | 2 +- src/MNRLAdapter.cpp | 3 +++ src/element.cpp | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/element.h b/include/element.h index 228f9bb..de7aab6 100644 --- a/include/element.h +++ b/include/element.h @@ -77,7 +77,7 @@ class Element { std::vector> getOutputSpecelPointers(); bool clearOutputs(); bool clearOutputPointers(); - bool clearInputs(); + void clearInputs(); std::map getInputs(); bool addOutput(std::string); bool addOutputPointer(std::pair); diff --git a/src/MNRLAdapter.cpp b/src/MNRLAdapter.cpp index 4ba32c5..f6a367c 100644 --- a/src/MNRLAdapter.cpp +++ b/src/MNRLAdapter.cpp @@ -41,6 +41,9 @@ static string convertThreshold(MNRLDefs::CounterMode m) { return "latch"; case MNRLDefs::CounterMode::ROLLOVER_ON_THRESHOLD: return "roll"; + default: + cerr << "Unknown counter mode. Exiting." << endl; + exit(1); } } diff --git a/src/element.cpp b/src/element.cpp index 39f854c..5e2a369 100644 --- a/src/element.cpp +++ b/src/element.cpp @@ -306,7 +306,7 @@ bool Element::clearOutputPointers() { return true; } -bool Element::clearInputs() { +void Element::clearInputs() { inputs.clear(); }