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

Codechange: [C++11] Use override specifer for overriding member declarations #7324

Merged
merged 4 commits into from Mar 24, 2019

Conversation

M3Henry
Copy link
Contributor

@M3Henry M3Henry commented Mar 3, 2019

This is a C++11 feature that allows the compiler to check that a virtual
member declaration overrides a base-class member with the same signature.

Also src/blitter/32bpp_anim_sse4.hpp +38 is no longer erroneously marked
as virtual despite being a template.

@M3Henry M3Henry force-pushed the override-specifier branch 5 times, most recently from 4025137 to 8ccff43 Compare March 3, 2019 23:17
@PeterN
Copy link
Member

PeterN commented Mar 4, 2019

Well done. I had started to do this myself but didn't get any near completing it.

I am not sure if the remaining /* virtual */ comments should stay or go.

The only issue I see is the Mac OS build warns on compiling objc files which include other headers:
warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]

@PeterN
Copy link
Member

PeterN commented Mar 4, 2019

Many Window-derived classes incorrectly use virtual instead of /* virtual */. We should fix these up in separate commit(s). I believe this can be scripted easily, so I am working on this now.

I've pushed to my repo with a PR here: M3Henry#1

@M3Henry
Copy link
Contributor Author

M3Henry commented Mar 4, 2019

I'd say they should go.

I do remember GCC sometimes backports features and then warns that the feature is not compiler agnostic. Perhaps something similar?

@michicc
Copy link
Member

michicc commented Mar 23, 2019

There's a bunch of new useless warnings in the CI output for OSX. You could try adding the following to config.lib around line 1324:
# warning: <something> is a C++11 extension
flags="$flags -Wno-c++11-extensions"

We do want to use C++11, after all.

@michicc
Copy link
Member

michicc commented Mar 24, 2019

Sorry @M3Henry, I should have said line 1323, i.e. just before the if block. Right now it's skipped for all CI clang versions.

M3Henry and others added 4 commits March 24, 2019 14:28
This is a C++11 feature that allows the compiler to check that a virtual
member declaration overrides a base-class member with the same signature.

Also src/blitter/32bpp_anim_sse4.hpp +38 is no longer erroneously marked
as virtual despite being a template.
Copy link
Member

@michicc michicc left a comment

Choose a reason for hiding this comment

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

Works for me. And if there's missing override somewhere, well, no harm in adding it later.

@michicc michicc merged commit 317f69c into OpenTTD:master Mar 24, 2019
@M3Henry M3Henry deleted the override-specifier branch March 24, 2019 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants