Mozilla's C++ style guide [1] says (since 2015) virtual function declarations should specify only one of `virtual`, `final`, or `override`.

Over the weekend, I will land a mach lint check (bug 1436263) that will warn about some virtual style violations such as:

  virtual void Bad1() final
  void Bad2() final override
  void Bad3() override final

It won't warn about the redundant `override` in `virtual void NotBad() override` at this time because there are 8000+ instances in mozilla-central. Also, virtual/override is more of a style issue whereas virtual/final can mask real bugs.

A clang-tidy check would be more thorough, but this mach lint is better than nothing until someone steps up to write a proper clang plugin. :) We had a clang-tidy check but it was disabled recently (bug 1420366) because it was too noisy (because it analyzed the post-processed source after NS_IMETHOD macros had been expanded to `virtual`).


[1] https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to