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

BUILD: Fix GCC bogus warning by removing const #1826

Merged
merged 1 commit into from Sep 9, 2019

Conversation

@lephilousophe
Copy link
Member

commented Aug 31, 2019

GCC emits "warning: type qualifiers ignored on cast result type" when
some types are used for HashMap because of the const modifier.
This applies especially to pointer-to-member-functions.
The const there is not really useful as it only prevents unfortunate
object editions.

BUILD: Fix GCC bogus warning by removing const
GCC emits "warning: type qualifiers ignored on cast result type" when
some types are used for HashMap because of the const modifier.
This applies especially to pointer-to-member-functions.
The const there is not really useful as it only prevents unfortunate
object editions.

@lephilousophe lephilousophe requested a review from digitall Aug 31, 2019

@bluegr

This comment has been minimized.

Copy link
Member

commented Aug 31, 2019

It would be preferable to remove the leading const from getVal(): the compiler will throw a warning if this is used with simple types

@digitall
Copy link
Member

left a comment

This does fix the observed issue

@digitall

This comment has been minimized.

Copy link
Member

commented Sep 1, 2019

@bluegr: I tried removing the leading const from various declarations and templates for the getVal, but I kept getting compiler errors... If you can suggest a better solution as a patch or gist, then I will test. Thanks.

@lephilousophe

This comment has been minimized.

Copy link
Member Author

commented Sep 1, 2019

@bluegr : You can't remove const from getVal return type because it's a reference to content in HashMap and these functions are constant ones.
The non constant version of getVal don't need the _defaultValue because they simply add a new entry to the HashMap

@bluegr

This comment has been minimized.

Copy link
Member

commented Sep 2, 2019

I'll check this again today or tomorrow - need to be at a PC with the appropriate development tools installed

@bluegr

This comment has been minimized.

Copy link
Member

commented Sep 9, 2019

Since my free time is quite limited these days, I'm merging this, and will work on additional enhancements at some other point in the future. Thanks for your work!

@bluegr bluegr merged commit 5cc574a into scummvm:master Sep 9, 2019

2 checks passed

Codacy/PR Quality Review Up to standards. A positive pull request.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@lephilousophe lephilousophe deleted the lephilousophe:remove-const branch Sep 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.