Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding exception type for empty callback functions (reopening of PR #301) #304

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

lukas-he
Copy link

@lukas-he lukas-he commented Feb 11, 2025

Hello everyone,

As discussed with Greg yesterday, I am reopening a PR for Greg's bugfix contribution with PR #301 .

This exception will be thrown when an empty std::function is passed to
the callback connection module. Adding the type first so that tests can
be written.
Some L2 tests were asserting that the std::bad_function_call exception
should be thrown when a bad callback is called. We will be changing that
behavior so that the exception is thrown when the callback connection is
established, requiring updated test cases.
The CalleeHandle class is the "owner" of the callback function objects
associated with a callback connection. As such, it will check the
validity of those function objects and throw the EmptyFunctionObject
exception if either the callback or cleanup function is empty / invalid.
@lukas-he lukas-he changed the title Bugfix/1.0.2/194 std function checks Adding exception type for empty callback functions (reopening of PR #301) Feb 11, 2025
Copy link

@PLeVasseur PLeVasseur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not much to say! LGTM. I learned a bit more C++ reading through here.

I saw that a couple of stages of CI fell over. @lukas-he -- would you like to investigate?

include/up-cpp/utils/CallbackConnection.h Show resolved Hide resolved
include/up-cpp/utils/CallbackConnection.h Show resolved Hide resolved
include/up-cpp/utils/CallbackConnection.h Outdated Show resolved Hide resolved
@lukas-he
Copy link
Author

I looked into the error and as far as I understand, the linting fails before actually linting, but when trying to install clang-tidy-12 see here. So we could go to a newer clang-tidy version. What do you think @PLeVasseur?

@PLeVasseur
Copy link

So we could go to a newer clang-tidy version.

Seems like a reasonable solution if the previous version we're using is not available and doesn't in-turn flag a bunch of more things to fix 😅

IIRC the default runner image is now Ubuntu 24.04.1, see here. Likely that version of clang-tidy may not be available.

If you find that updating clang-tidy flags a bunch of additional things to fix, one option is to use Ubuntu 22.04 for now. Then address the issues found by the new clang-tidy all in one PR. It's a thought!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The callback connection module should check std::function parameters from outside for validity
3 participants