Skip to content

Commit

Permalink
explicity casts the return value to void to ignore warning for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
phyBrackets committed Jun 12, 2024
1 parent 899a530 commit eeba48f
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion examples/01-simple-connection/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ int main()
Signal<std::string, int> signal;

// Connect a lambda
signal.connect([](std::string arg1, int arg2) {
(void)signal.connect([](std::string arg1, int arg2) {
std::cout << arg1 << " " << arg2 << std::endl;
});

Expand Down
2 changes: 1 addition & 1 deletion examples/04-simple-property/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int main()
{
Widget w("A cool widget");

w.value.valueChanged().connect([](int newValue) {
(void)w.value.valueChanged().connect([](int newValue) {
std::cout << "The new value is " << newValue << std::endl;
});

Expand Down
2 changes: 1 addition & 1 deletion examples/05-property-bindings/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int main()
Image img;
std::cout << "The initial size of the image = " << img.byteSize.get() << " bytes" << std::endl;

img.byteSize.valueChanged().connect([](const int &newValue) {
(void)img.byteSize.valueChanged().connect([](const int &newValue) {
std::cout << "The new size of the image = " << newValue << " bytes" << std::endl;
});

Expand Down
2 changes: 1 addition & 1 deletion examples/06-lazy-property-bindings/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ int main()
Image img;
std::cout << "The initial size of the image = " << img.byteSize.get() << " bytes" << std::endl;

img.byteSize.valueChanged().connect([](const int &newValue) {
(void)img.byteSize.valueChanged().connect([](const int &newValue) {
std::cout << "The new size of the image = " << newValue << " bytes" << std::endl;
});

Expand Down
4 changes: 2 additions & 2 deletions tests/binding/tst_binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,15 @@ TEST_CASE("Binding expression updates")
Private::makeNode(input)),
evaluator)
};
prop1.valueChanged().connect([&ordering](int) { ordering.emplace_back(1); });
(void)prop1.valueChanged().connect([&ordering](int) { ordering.emplace_back(1); });

auto prop2 = Property<int>{
std::make_unique<Binding<int>>(
Private::makeNode([](auto x) { return 3 * x; },
Private::makeNode(input)),
evaluator)
};
prop2.valueChanged().connect([&ordering](int) { ordering.emplace_back(2); });
(void)prop2.valueChanged().connect([&ordering](int) { ordering.emplace_back(2); });

input = 8;
evaluator.evaluateAll();
Expand Down
10 changes: 5 additions & 5 deletions tests/property/tst_property.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class ClassWithProperty

ClassWithProperty()
{
property().valueChanged.connect(
(void)property().valueChanged.connect(
[this]() {
this->changed.emit();
});
Expand All @@ -92,7 +92,7 @@ TEST_CASE("An object with a Signal that is wrapped in a property can emit the Si
auto handler = [&called]() { called = true; };

ClassWithProperty outer;
outer.changed.connect(handler);
(void)outer.changed.connect(handler);

outer.property().emitSignal();

Expand Down Expand Up @@ -159,7 +159,7 @@ TEST_CASE("Signals")
auto handler = [&notified]() { notified = true; };

auto p = new Property<int>{ 5 };
p->destroyed().connect(handler);
(void)p->destroyed().connect(handler);

delete p;
REQUIRE(notified == true);
Expand Down Expand Up @@ -254,7 +254,7 @@ TEST_CASE("Property Updaters")
updatedValue = value;
slotCalled = true;
};
property.valueChanged().connect(handler);
(void)property.valueChanged().connect(handler);

updater->set(123);
REQUIRE(property.get() == 123);
Expand Down Expand Up @@ -299,7 +299,7 @@ TEST_CASE("Moving")

auto property = Property<std::unique_ptr<int>>{ std::make_unique<int>(42) };
property.valueChanged().connect(handlerVoid);
property.valueChanged().connect(handlerValue);
(void)property.valueChanged().connect(handlerValue);

auto movedProperty{ std::move(property) };
movedProperty.set(std::make_unique<int>(123));
Expand Down
24 changes: 12 additions & 12 deletions tests/signal/tst_signal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ TEST_CASE("Signal connections")
auto evaluator = std::make_shared<ConnectionEvaluator>();

std::thread thread1([&] {
signal1.connectDeferred(evaluator, [&val](int value) {
(void)signal1.connectDeferred(evaluator, [&val](int value) {
val += value;
});
});

std::thread thread2([&] {
signal2.connectDeferred(evaluator, [&val](int value) {
(void)signal2.connectDeferred(evaluator, [&val](int value) {
val += value;
});
});
Expand All @@ -169,11 +169,11 @@ TEST_CASE("Signal connections")
int val2 = 4;
auto evaluator = std::make_shared<ConnectionEvaluator>();

signal1.connectDeferred(evaluator, [&val1](int value) {
(void)signal1.connectDeferred(evaluator, [&val1](int value) {
val1 += value;
});

signal2.connectDeferred(evaluator, [&val2](int value) {
(void)signal2.connectDeferred(evaluator, [&val2](int value) {
val2 += value;
});

Expand Down Expand Up @@ -224,7 +224,7 @@ TEST_CASE("Signal connections")
int val = 4;
auto evaluator = std::make_shared<ConnectionEvaluator>();

signal.connectDeferred(evaluator, [&val](int value) {
(void)signal.connectDeferred(evaluator, [&val](int value) {
val += value;
});

Expand All @@ -246,7 +246,7 @@ TEST_CASE("Signal connections")
bool anotherCalled = false;

auto handle = signal->connectDeferred(evaluator, [&called]() { called = true; });
anotherSignal.connectDeferred(evaluator, [&anotherCalled]() { anotherCalled = true; });
(void)anotherSignal.connectDeferred(evaluator, [&anotherCalled]() { anotherCalled = true; });

signal->emit();
anotherSignal.emit();
Expand Down Expand Up @@ -368,7 +368,7 @@ TEST_CASE("Signal connections")
});

int lambdaCallCount2 = 0;
signal.connect([&]() {
(void)signal.connect([&]() {
++lambdaCallCount2;
});

Expand Down Expand Up @@ -396,7 +396,7 @@ TEST_CASE("Signal connections")
handle = &result;

int lambdaCallCount2 = 0;
signal.connect([&]() {
(void)signal.connect([&]() {
++lambdaCallCount2;
});

Expand All @@ -413,12 +413,12 @@ TEST_CASE("Signal connections")
{
Signal<> signal;
int lambdaCallCount = 0;
signal.connect([&]() {
(void)signal.connect([&]() {
++lambdaCallCount;
});

int lambdaCallCount2 = 0;
signal.connect([&]() {
(void)signal.connect([&]() {
++lambdaCallCount2;
});

Expand Down Expand Up @@ -454,7 +454,7 @@ TEST_CASE("Moving")
auto handler = [&count]() { ++count; };

Signal<> signal;
signal.connect(handler);
(void)signal.connect(handler);

Signal<> movedSignal{ std::move(signal) };
movedSignal.emit();
Expand All @@ -467,7 +467,7 @@ TEST_CASE("Moving")
auto handler = [&count]() { ++count; };

Signal<> signal;
signal.connect(handler);
(void)signal.connect(handler);

Signal<> movedSignal = std::move(signal);
movedSignal.emit();
Expand Down

0 comments on commit eeba48f

Please sign in to comment.