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

LoopingControl: use auto instead of auto* for iterator #4379

Merged
merged 1 commit into from
Oct 12, 2021

Conversation

Be-ing
Copy link
Contributor

@Be-ing Be-ing commented Oct 12, 2021

I don't know how auto* worked before considering the iterator
is not a pointer type, but it doesn't work in Qt6.

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.

Now clang-tidy is complaining:

 src/engine/controls/loopingcontrol.cpp#L1127

'auto i' can be declared as 'auto *i' [readability-qualified-auto]

@Be-ing
Copy link
Contributor Author

Be-ing commented Oct 12, 2021

clang-tidy needs to be ignored in this case. QStack inherits from QVector in Qt5 and QVector::iterator is a typedef for T *. In Qt6, QStack inherits from QList instead, so QVector::iterator is not a pointer type.

@daschuer
Copy link
Member

I think we need to introduce an ifdef here then.
The best without auto, to make the difference visible.

@Be-ing
Copy link
Contributor Author

Be-ing commented Oct 12, 2021

Using QStack::iterator explicitly instead of auto works too.

@Be-ing Be-ing changed the title LoopingControl: use auto instead of auto* for iterator LoopingControl: use QStack::iterator instead of auto for iterator Oct 12, 2021
src/engine/controls/loopingcontrol.cpp Outdated Show resolved Hide resolved
QStack inherits from QVector in Qt5 so QStack::iterator is a
pointer type which clang-tidy wants to be auto*. But in Qt6,
QStack inherits from QList so QStack::iterator is not a pointer
type and clang-tidy wants to use auto. Resolve this by using the
QStack::iterator type explicitly.
@Be-ing
Copy link
Contributor Author

Be-ing commented Oct 12, 2021

Merge?

@uklotzde
Copy link
Contributor

Waiting for @daschuer to formally approve the changes according to our rules.

@daschuer daschuer merged commit 7f53cbd into mixxxdj:main Oct 12, 2021
@Be-ing Be-ing deleted the loopingcontrol_iterator branch October 12, 2021 21:02
@Be-ing Be-ing changed the title LoopingControl: use QStack::iterator instead of auto for iterator LoopingControl: use auto instead of auto* for iterator Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants