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

[Core] Fix Clang warning when discard-qualifier on line 133 of registry.h #12992

Conversation

loumalouomega
Copy link
Member

📝 Description

Fix Clang warning when discard-qualifier on line 133 of registry.h. const is not needed for the cend iterator.

🆕 Changelog

@loumalouomega loumalouomega added Warning Kratos Core Clang Compilation FastPR This Pr is simple and / or has been already tested and the revision should be fast labels Jan 9, 2025
@loumalouomega loumalouomega requested a review from a team as a code owner January 9, 2025 09:54
@roigcarlo
Copy link
Member

i would expect to be the oposite, cend and cbegin should requeire const. If not static auto const cend() at least should be static auto cend() const

@loumalouomega
Copy link
Member Author

i would expect to be the oposite, cend and cbegin should requeire const. If not static auto const cend() at least should be static auto cend() const

I just do as the compiler says

@roigcarlo
Copy link
Member

roigcarlo commented Jan 9, 2025

I mean yes, the solution you did solves the problem, but we end up having the same function twice. end and cend should be different somewhere.

@loumalouomega
Copy link
Member Author

I mean yes, the solution you did solves the problem, but we end up having the same function twice. end and cend should be different somewhere.

No, cend returns a const interator instead of a iterator. The auto hides that.

@roigcarlo
Copy link
Member

omg are we using auto for return types now? God have mercy

@loumalouomega
Copy link
Member Author

I mean yes, the solution you did solves the problem, but we end up having the same function twice. end and cend should be different somewhere.

No, cend returns a const interator instead of a iterator. The auto hides that.

kratos/includes/registry.h:133:17: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers]
    static auto const cend()

@loumalouomega loumalouomega merged commit b86e4a5 into master Jan 9, 2025
11 checks passed
@loumalouomega loumalouomega deleted the core/discard-qualifier-warning-clang-on-registry-line-133 branch January 9, 2025 15:31
@loumalouomega
Copy link
Member Author

omg are we using auto for return types now? God have mercy

Not my code

@roigcarlo
Copy link
Member

Na its fine, I hadn't seen the auto, sorry for the noise :P

@loumalouomega
Copy link
Member Author

Na its fine, I hadn't seen the auto, sorry for the noise :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clang Compilation FastPR This Pr is simple and / or has been already tested and the revision should be fast Kratos Core Warning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants