Skip to content

Conversation

@PastaPastaPasta
Copy link
Member

Issue being fixed or feature implemented

Enable additional -Werror compiler flags; tested with clang-17; interested to see if CI is happy

What was done?

Enabled warnings and fixed issues; added some static_asserts for checks which were not needed due to the types used.

How Has This Been Tested?

Building

Breaking Changes

None

Checklist:

Go over all the following points, and put an x in all the boxes that apply.

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

@PastaPastaPasta PastaPastaPasta added this to the 20 milestone Oct 2, 2023
Copy link
Collaborator

@knst knst left a comment

Choose a reason for hiding this comment

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

Beside particilar comments I think it is better to sort list of -Werror warnings; at least our own (not from bitcoin's).

Bitcoin's I think better to keep in same order as they do.

configure.ac Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: isn't trigraphs are removed since C++17?

I think it's quite useless check then.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Collaborator

Choose a reason for hiding this comment

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

Check this one,isn't it doing the same? https://en.cppreference.com/w/cpp/types/is_unsigned

Suggested change
static_assert(std::numeric_limits<decltype(opcode)>::min() == 0);
static_assert(std::is_unsigned<decltype(opcode)>::value);

Copy link
Member Author

Choose a reason for hiding this comment

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

Like, yes it is, but I wanted a 1 for 1 for the runtime check just done at compile time; they will evaluate the same for all normal integer types; idk 🤷‍♂️

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's constexpr since C++17, so, should work for any type:

template< class T >
inline constexpr bool is_unsigned_v = is_unsigned<T>::value;

which elsee runtime checks do you mean?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, for sure it's constexpr, but the runtime check I'm removing is specifically 0 <= opcode and the most intuitive way imo to say that's always true is to say the min is 0; but honestly using the unsigned is probably appropriate too

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually interesting it seems that static_assert(std::is_unsigned_v<decltype(opcode)>); fails as opcodetype is an enum and I guess enums aren't considered unsigned?

Copy link
Collaborator

Choose a reason for hiding this comment

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

again std::is_unsigned

@github-actions
Copy link

github-actions bot commented Oct 6, 2023

This pull request has conflicts, please rebase.

@UdjinM6 UdjinM6 modified the milestones: 20, 21, 20.1 Nov 11, 2023
@github-actions
Copy link

This pull request has conflicts, please rebase.

@UdjinM6 UdjinM6 modified the milestones: 20.1, 21 Mar 5, 2024
@UdjinM6 UdjinM6 removed this from the 21 milestone Jul 19, 2024
@DashCoreAutoGuix
Copy link

❌ Backport Verification - Issues Detected

Original Bitcoin commit: N/A - This is a Dash-specific compiler warning enhancement, not a Bitcoin backport
Reviewed commit hash: 247d5ba1a4-verify-1753722727

Issues found:

  • Merge conflicts detected: This PR has conflicts with the current develop branch and shows mergeable status as "CONFLICTING"
  • No CI checks configured: No automated testing has been run on this branch
  • Stale PR: This PR is from 2023 and has accumulated conflicts over time

Since this is not a Bitcoin backport, the standard backport verification process does not apply. However, the PR has merge conflicts that prevent it from being merged cleanly.

Recommendation: The PR author needs to:

  1. Rebase this PR against the current develop branch to resolve conflicts
  2. Ensure CI checks are configured and passing
  3. Update the changes to work with the current codebase

Please address these issues and re-run verification after rebasing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants