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

Fix several warnings #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Martchus
Copy link

  • Avoid implicit signedness conversions where possible
  • Avoid c-style casts
  • Avoid warnings about bypassing virtual dispatch in destructors

* Avoid implicit signedness conversions where possible
* Avoid c-style casts
@aminya
Copy link

aminya commented Jul 15, 2022

@ahupowerdns Could you take a look at this?

Copy link

@aminya aminya left a comment

Choose a reason for hiding this comment

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

Instead of casting to void it is better to use [[maybe_unused]]

Comment on lines +156 to +162
void put(MDBRWTransaction& txn, const Class& t, uint32_t id, unsigned int flags=0)
{
(void)txn;
(void)t;
(void)id;
(void)flags;
}
Copy link

Choose a reason for hiding this comment

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

Suggested change
void put(MDBRWTransaction& txn, const Class& t, uint32_t id, unsigned int flags=0)
{
(void)txn;
(void)t;
(void)id;
(void)flags;
}
void put([[maybe_unused]] MDBRWTransaction& txn, [[maybe_unused]] const Class& t, [[maybe_unused]] uint32_t id, [[maybe_unused]] unsigned int flags=0)
{}

@Martchus
Copy link
Author

Martchus commented Jul 15, 2022

I suppose when making that PR I didn't want to raise the C++ standard to 17 but yes, [[maybe_unused]] would be generally preferable.

Note that this repository seems generally unmaintained so I wouldn't get my hopes up that this change is merged anytime soon. I personally just created a "custom" branch on my own fork (see https://github.com/Martchus/lmdb-safe). It is already 66 commits ahead of this one. I picked up some commits from pending PRs and did many adjustments myself. You might not want all changes from my branch but be sure to have a look.

@aminya
Copy link

aminya commented Jul 15, 2022

Thanks! Maybe @ahupowerdns can add you as a maintainer so you can take over the project. It would be great to keep this effort going. Alternatively, we can create a new organization and put the code there.

@Martchus
Copy link
Author

Maybe. Note that I've introduced a dependency to https://github.com/Martchus/cpp-utilities because I didn't want to C&P lots of build system code. That could be problematic for some users (although the library is not a runtime dependency, it is just used for CMake modules and a few headers). I've also introduced usage of https://github.com/Martchus/reflective-rapidjson but that's only optional (you can still use any serialization you want). Some of my changes might also be API breaks.

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.

2 participants