Skip to content

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

Merged
daschuer merged 1 commit intomixxxdj:mainfrom
Be-ing:loopingcontrol_iterator
Oct 12, 2021
Merged

LoopingControl: use auto instead of auto* for iterator#4379
daschuer merged 1 commit intomixxxdj:mainfrom
Be-ing:loopingcontrol_iterator

Conversation

@Be-ing
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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

@Be-ing Be-ing force-pushed the loopingcontrol_iterator branch from ed4e068 to aeaf906 Compare October 12, 2021 07:24
@Be-ing
Copy link
Copy Markdown
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
Comment thread src/engine/controls/loopingcontrol.cpp Outdated
@Be-ing Be-ing force-pushed the loopingcontrol_iterator branch from aeaf906 to d8abb25 Compare October 12, 2021 16:21
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 Be-ing force-pushed the loopingcontrol_iterator branch from d8abb25 to 60d5afc Compare October 12, 2021 17:17
@Be-ing
Copy link
Copy Markdown
Contributor Author

Be-ing commented Oct 12, 2021

Merge?

@uklotzde
Copy link
Copy Markdown
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