Menu

#5650 Use C++11 "override" keyword

Fixed
Dan Eble
Maintainability
2020-01-07
2020-01-01
Dan Eble
No

1: Remove unnecessary include and namespace use

2: Check name in DECLARE_CLASSNAME()

3: Separate DECLARE_CLASSNAME() from VIRTUAL_COPY_CONSTRUCTOR()

4: Eliminate VIRTUAL_COPY_CONSTRUCTOR()

Just write out the virtual clone() function.

5: Use C++11 "override" keyword throughout the code

The chosen style is to state "virtual" for the base function only, because "override" implies "virtual".

6: Compile with -Werror=suggest-override, when supported

This fails the build if a virtual method is overridden without using the "override" keyword. This complements the standard behavior of failing the build if a virtual method with the "override" keyword does not actually override anything.

https://codereview.appspot.com/551320043

Related

Issues: #5309

Discussion

  • Anonymous

    Anonymous - 2020-01-02
    • Description has changed:

    Diff:

    
    
    • Needs: -->
    • Patch: new --> review
    • Type: --> Enhancement
     
  • Anonymous

    Anonymous - 2020-01-02

    Passes make, make check and a full make doc.

     
  • Anonymous

    Anonymous - 2020-01-05
    • Patch: review --> countdown
     
  • Anonymous

    Anonymous - 2020-01-05

    Patch on countdown for Jan 7th

     
  • Anonymous

    Anonymous - 2020-01-07
    • Patch: countdown --> push
     
  • Anonymous

    Anonymous - 2020-01-07

    Patch counted down - please push

     
  • Dan Eble

    Dan Eble - 2020-01-07
    • labels: --> Fixed_2_21_0
    • status: Started --> Fixed
    • Patch: push -->
    • Type: Enhancement --> Maintainability
     
  • Dan Eble

    Dan Eble - 2020-01-07
    commit 1ba2d0f8dce97a2dbb3c8f2b6147131ab6f9b10f (origin/staging, staging)
    Author: Dan Eble <nine.fierce.ballads@gmail.com>
    Date:   Wed Jan 1 14:23:33 2020 -0500
    
        Issue 5650/6: Compile with -Werror=suggest-override, when supported
    
        This fails the build if a virtual method is overridden without using the
        "override" keyword.  This complements the standard behavior of failing
        the build if a virtual method with the "override" keyword does not
        actually override anything.
    
    commit 8e6641274af0777a4f93fe6f472eac22d1903d31
    Author: Dan Eble <nine.fierce.ballads@gmail.com>
    Date:   Wed Jan 1 14:23:33 2020 -0500
    
        Issue 5650/5: Use C++11 "override" keyword throughout the code
    
        The chosen style is to state "virtual" for the base function only,
        because "override" implies "virtual".
    
    commit f60b074c15df9f0966a9a4fa2595d75496873f6b
    Author: Dan Eble <nine.fierce.ballads@gmail.com>
    Date:   Wed Jan 1 12:37:56 2020 -0500
    
        Issue 5650/4: Eliminate VIRTUAL_COPY_CONSTRUCTOR()
    
        Just write out the virtual clone() function.
    
    commit 61cb3985a1d8e2055602f36da862c7fea91a9f7c
    Author: Dan Eble <nine.fierce.ballads@gmail.com>
    Date:   Wed Jan 1 10:51:41 2020 -0500
    
        Issue 5650/3: Separate DECLARE_CLASSNAME() from VIRTUAL_COPY_CONSTRUCTOR()
    
    commit 11f95a1e576da31913fc470e7bf8f1a87cd0ce11
    Author: Dan Eble <nine.fierce.ballads@gmail.com>
    Date:   Wed Jan 1 10:49:45 2020 -0500
    
        Issue 5650/2: Check name in DECLARE_CLASSNAME()
    
    commit bca4b31f8a9a77d0e78af983e9f1ba88fa656dc2
    Author: Dan Eble <nine.fierce.ballads@gmail.com>
    Date:   Wed Jan 1 09:59:52 2020 -0500
    
        Issue 5650/1: Remove unnecessary include and namespace use
    
     
MongoDB Logo MongoDB