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

Fix warnings due to missing override specification #96

Closed
wants to merge 1 commit into from

Conversation

gganis
Copy link

@gganis gganis commented Feb 25, 2023

BEGINRELEASENOTES

  • Fix warnings due to missing override specification

ENDRELEASENOTES

@tmadlener
Copy link
Contributor

Are these the only places where this gets flagged? Naively I would expect there to be more, since we are probably implementing more virtual functions, but maybe I am thinking about test code(?).

@jmcarcell
Copy link
Contributor

It's in a bunch of tests but also in places that are not tests:

k4FWCore/components/PodioOutput.h
22:  virtual StatusCode initialize();
25:  virtual StatusCode execute();
27:  virtual StatusCode finalize();

k4FWCore/components/PodioInput.h
26:  virtual StatusCode initialize();
28:  virtual StatusCode execute();
30:  virtual StatusCode finalize();

So it would be better if we can deal with this warning in all places at once. Is this a clang specific warning? I don't remember any warnings when compiling with gcc.

@tmadlener
Copy link
Contributor

Both gcc and clang can warn about this, for clang its modernize-use-override for gcc it is suggest-override, but the defaults are probably different in both cases. Anyhow, e.g. for podio we have this enabled in the clang-tidy configuration.

@jmcarcell
Copy link
Contributor

jmcarcell commented Feb 27, 2023

Ok so this is interesting and annoying at the same time: for gcc it's not enabled by default and also not included in -Wall nor -Wextra while for clang it is enabled by default. On top of that they may have different behaviour based on what this answer says: https://stackoverflow.com/a/41109550
(the warning in clang is -Winconsistent-missing-override and here it says it's on by default: https://clang.llvm.org/docs/DiagnosticsReference.html#winconsistent-missing-override)

@tmadlener
Copy link
Contributor

I think only using either override or final and dropping virtual makes both compilers happy, at least it does for podio.

@jmcarcell
Copy link
Contributor

Closing this one in favor of #143

@jmcarcell jmcarcell closed this Sep 1, 2023
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.

3 participants