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

Refactor/gh13222 util deprecate #13223

Merged
merged 5 commits into from May 17, 2024

Conversation

Swiftb0y
Copy link
Member

@Swiftb0y Swiftb0y commented May 8, 2024

as requested in #13222

One primary issue is that marking entire classes [[deprecated]] will result in build failures due to -Wdeprecated -Werror. So marking them deprecated formally would require their removal in the same step. That's why I only made them deprecated in the form of a comment.

@Swiftb0y
Copy link
Member Author

Swiftb0y commented May 8, 2024

needs some more testing first

@Swiftb0y
Copy link
Member Author

Swiftb0y commented May 9, 2024

I don't think a purely lexical solution will work. I prefer @fwcd's suggestion. I'll see how many warnings it creates and evaluate from there how easy it will be to remove them.

@fwcd
Copy link
Member

fwcd commented May 9, 2024

A warning for deprected function that we want to keep in the code for now will introduce a lot of noise. Contributors will start to look into it on one hand and we may get blind for other concerning warnings.

If the function is deprecated and is no longer to be used, having contributors look into it is IMO a good thing, given that those call sites should be refactored anyway. This is the purpose of these warnings, to draw attention to code snippets that should be updated. If we really need to keep it around, we may look into suppressing it on a case-by-case basis.

@Swiftb0y Swiftb0y force-pushed the refactor/gh13222-util-deprecate branch from 1a610fa to 1c90a8f Compare May 9, 2024 11:00
@Swiftb0y Swiftb0y marked this pull request as ready for review May 9, 2024 11:01
@Swiftb0y
Copy link
Member Author

Swiftb0y commented May 9, 2024

apart from the formal deprecation warnings, this is ready for review.

Copy link
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

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

src/widget/paintable.cpp requires also #include

@daschuer
Copy link
Member

daschuer commented May 9, 2024

If the function is deprecated and is no longer to be used, having contributors look into it is IMO a good thing

I strongly disagree. The contributor should always start over with a clean build without any warning. This is important to keep the barrier for new contributors low. A new contributor cannot understand what it means, unless we define a receipt for a fix.

We may rather work on this as the core team in a branch with warnings enabled. I also consider it not as an urgent task. Because the old code is known good and tested. Every change involves a degree of a regression risk. I don't like to review PRs with new code and deprecation warning fixes.

@fwcd
Copy link
Member

fwcd commented May 9, 2024

The contributor should always start over with a clean build without any warning

Yeah, that's fair and it makes sense to me to reduce the number of warnings as much as possible, hence my idea that we could suppress warnings as needed (though the downside is that C++ doesn't seem to have a standard mechanism for this and adding different compiler-specific pragmas might add even more noise)

Do we have an idea of how many such warnings we would get? If the number is manageable, maybe we could fix the issues on main where we have enough time to test them?

@acolombier
Copy link
Contributor

Thanks for looking into this. Having warning, which shows as annotation on PR or in the pre-commit would be very valuable I think

@Swiftb0y
Copy link
Member Author

Swiftb0y commented May 10, 2024

src/widget/paintable.cpp requires also #include

what header would that be? don't see any class from <memory> being used in Paintable (on 2.4)

@Swiftb0y
Copy link
Member Author

Do we have an idea of how many such warnings we would get?

mixxx::Duration has 414 results in 123 files, and ReadableSlice/WriteableSlice ~59 results in 19 files.

I don't like to review PRs with new code and deprecation warning fixes.

I disagree. I think applying the "Boy Scout Rule" (Robert C. Martin) is an important tactic in combating code rot. Outlawing it would result in PRs that is either just a feature (that is explicitly not improving code quality, especially because we sometimes even enforce using outdated practices "for consistency") or PRs that are just refactorings and cleanup (for which ppl don't have incentive to review because it doesn't result in a new exciting feature). Do you see the dilemma here?

@Swiftb0y
Copy link
Member Author

If you don't like the warnings, we can either keep it deprecated "informally" as I have done now, or I can issue another pull request that removes the deprecated classes entirely. The latter approach resulting in a PR that is likely to get neglected because of the reasons I mentioned in the previous comments.

@daschuer
Copy link
Member

src/widget/paintable.cpp requires also #include

what header would that be? don't see any class from being used in Paintable (on 2.4)

auto pSvg = std::make_unique<QSvgRenderer>();

@daschuer
Copy link
Member

The whole question boils down to:

  • Do we want to remove the deprecated functions
  • Who should do this.

If yes and one has interest to do it, than go ahead.
If no, than don't impose the work to others by a warning.

In the later case we don't have yet a convenient way to enable the warning only for new code.
We may enable the warning and disable it for all these 123 files.

But I think the current solution in this PR is good enough for now.

@Swiftb0y
Copy link
Member Author

Do we want to remove the deprecated functions

IMO yes.

Who should do this.

I would start an attempt. I may not be able to succeed entirely, but I'm fairly confident a large number of occurrences could be eliminated at which point disabling warnings for select files would become feasible.

But I think the current solution in this PR is good enough for now.

Thank you. I agree for now. At least with the informal deprecation, people have the chance to know that a types use is discouraged, even if they aren't scolded for it by the compiler.

#13223 (comment)

Whoops thank you. fixed.

@Swiftb0y Swiftb0y force-pushed the refactor/gh13222-util-deprecate branch from 2b6b710 to d150a55 Compare May 12, 2024 08:18
@Swiftb0y
Copy link
Member Author

friendly ping

@daschuer
Copy link
Member

I have not managed to test the ReferenceHolder changes. The 2.5-beta PRs have a higher prio for me.
If you wish a quick merge, you may split that change out to another PR.

@Swiftb0y
Copy link
Member Author

Swiftb0y commented May 17, 2024

done #13240

Copy link
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

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

LGTM, thank you.

rigtorp::SPSCQueue<ReceiverMessageType>& m_sender_messages;
QScopedPointer<BaseReferenceHolder> m_pTwoWayMessagePipeReference;
std::shared_ptr<rigtorp::SPSCQueue<SenderMessageType>> m_receiver_messages;
std::shared_ptr<rigtorp::SPSCQueue<ReceiverMessageType>> m_sender_messages;
Copy link
Member

Choose a reason for hiding this comment

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

Please use a m_p prefix

Copy link
Member Author

Choose a reason for hiding this comment

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

whoops sorry. do you want me to open a follow up PR?

Copy link
Member

Choose a reason for hiding this comment

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

This was a pending comment for the other PR.

Copy link
Member

@daschuer daschuer May 18, 2024

Choose a reason for hiding this comment

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

Maybe we have confused GitHub 😎

Copy link
Member Author

Choose a reason for hiding this comment

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

ah, yea. I'll fix it there then

@daschuer daschuer merged commit cc9beb6 into mixxxdj:2.4 May 17, 2024
14 checks passed
@Swiftb0y Swiftb0y deleted the refactor/gh13222-util-deprecate branch May 17, 2024 20:38
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.

None yet

4 participants