Skip to content

Commit

Permalink
fix some warnings and leaks from overnight tests (#2377)
Browse files Browse the repository at this point in the history
* fix some warnings and leaks from overnight tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
phlptp and pre-commit-ci[bot] authored Jun 16, 2022
1 parent 93aefbd commit de4d622
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 20 deletions.
25 changes: 11 additions & 14 deletions src/helics/application_api/Inputs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,18 @@ class HELICS_CXX_EXPORT Input: public Interface {
Input(ValueFederate* valueFed,
InterfaceHandle id,
std::string_view actName,
std::string_view unitsOut = std::string{});
std::string_view unitsOut = {});

Input(ValueFederate* valueFed,
std::string_view key,
std::string_view defaultType = "def",
std::string_view units = std::string{});
std::string_view units = {});

template<class FedPtr>
Input(FedPtr& valueFed,
std::string_view key,
std::string_view defaultType = "def",
std::string_view units = std::string{}):
std::string_view units = {}):
Input(std::addressof(*valueFed), key, defaultType, units)
{
static_assert(
Expand All @@ -103,14 +103,14 @@ class HELICS_CXX_EXPORT Input: public Interface {
ValueFederate* valueFed,
std::string_view key,
std::string_view defaultType = "def",
std::string_view units = std::string{});
std::string_view units = {});

template<class FedPtr>
Input(InterfaceVisibility locality,
FedPtr& valueFed,
std::string_view key,
std::string_view defaultType = "def",
std::string_view units = std::string{}):
std::string_view units = {}):
Input(locality, std::addressof(*valueFed), key, defaultType, units)
{
static_assert(
Expand All @@ -121,24 +121,21 @@ class HELICS_CXX_EXPORT Input: public Interface {
Input(ValueFederate* valueFed,
std::string_view key,
DataType defType,
std::string_view units = std::string{}):
std::string_view units = {}):
Input(valueFed, key, typeNameStringRef(defType), units)
{
}

template<class FedPtr>
Input(FedPtr& valueFed,
std::string_view key,
DataType defType,
std::string_view units = std::string()):
Input(FedPtr& valueFed, std::string_view key, DataType defType, std::string_view units = {}):
Input(valueFed, key, typeNameStringRef(defType), units)
{
}

Input(InterfaceVisibility locality,
ValueFederate* valueFed,
std::string_view key,
std::string_view units = std::string{}):
std::string_view units = {}):
Input(locality, valueFed, key, "def", units)
{
}
Expand All @@ -147,7 +144,7 @@ class HELICS_CXX_EXPORT Input: public Interface {
Input(InterfaceVisibility locality,
FedPtr& valueFed,
std::string_view key,
std::string_view units = std::string{}):
std::string_view units = {}):
Input(locality, valueFed, key, "def", units)
{
}
Expand All @@ -156,7 +153,7 @@ class HELICS_CXX_EXPORT Input: public Interface {
ValueFederate* valueFed,
std::string_view key,
DataType defType,
std::string_view units = std::string{}):
std::string_view units = {}):
Input(locality, valueFed, key, typeNameStringRef(defType), units)
{
}
Expand All @@ -166,7 +163,7 @@ class HELICS_CXX_EXPORT Input: public Interface {
FedPtr& valueFed,
std::string_view key,
DataType defType,
std::string_view units = std::string{}):
std::string_view units = {}):
Input(locality, valueFed, key, typeNameStringRef(defType), units)
{
}
Expand Down
2 changes: 1 addition & 1 deletion src/helics/network/zmq/ZmqCommsCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ bool bindzmqSocket(zmq::socket_t& socket,
socket.bind(gmlc::networking::makePortAddress(address, port));
bindsuccess = true;
}
catch (const zmq::error_t& ze) {
catch (const zmq::error_t& /*ze*/) {
if (tcount == milliseconds{0}) {
// std::cerr << "zmq binding error on socket sleeping then will try again \n";
}
Expand Down
4 changes: 2 additions & 2 deletions src/helics/shared_api_library/ValueFederateExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ static constexpr int InputValidationIdentifier = 0x3456'E052;
/** random integer for validation purposes of publications */
static constexpr int PublicationValidationIdentifier = 0x97B1'00A5;

static constexpr char* invalidInputString = "The given input object does not point to a valid object";
static constexpr const char* invalidInputString = "The given input object does not point to a valid object";

static constexpr char* invalidPublicationString = "The given publication object does not point to a valid object";
static constexpr const char* invalidPublicationString = "The given publication object does not point to a valid object";

static helics::InputObject* verifyInput(HelicsInput inp, HelicsError* err)
{
Expand Down
1 change: 1 addition & 0 deletions tests/helics/shared_library/DataAPITests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,4 +251,5 @@ TEST(data, clone)

v2 = helicsDataBufferToDouble(newbuff);
EXPECT_EQ(v1, v2);
helicsDataBufferFree(newbuff);
}
3 changes: 2 additions & 1 deletion tests/helics/shared_library/SystemTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ TEST(federate, federateNoProtection)

EXPECT_FALSE(helicsFederateIsValid(fedFind));
EXPECT_NE(err.error_code, 0);
helicsFederateInfoFree(fi);
}

TEST(federate, federateProtection)
Expand All @@ -582,7 +583,7 @@ TEST(federate, federateProtection)
helicsFederateInfoSetCoreInitString(fi, "-f 1 --autobroker --error_timeout=0", nullptr);

auto fed1 = helicsCreateValueFederate("fed1", fi, nullptr);

helicsFederateInfoFree(fi);
helicsFederateEnterExecutingMode(fed1, nullptr);

std::string fed1Nm = helicsFederateGetName(fed1);
Expand Down
4 changes: 2 additions & 2 deletions tests/helics/system_tests/iterationTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -905,11 +905,11 @@ TEST_F(iteration, iteration_high_count_nocov_ci_skip_nosan)
auto vFed2 = GetFederateAs<helics::ValueFederate>(1);

auto& pub1_1 = vFed1->registerGlobalPublication<int>("pub1_1");
auto& sub1_1 = vFed1->registerSubscription("pub2_1");
vFed1->registerSubscription("pub2_1");

auto& pub2_1 = vFed2->registerGlobalPublication<int>("pub2_1");

auto& sub2_1 = vFed2->registerSubscription("pub1_1");
vFed2->registerSubscription("pub1_1");

vFed2->enterInitializingModeAsync();
vFed1->enterInitializingMode();
Expand Down

0 comments on commit de4d622

Please sign in to comment.