From c0c457246d25e7c64f65d1b37f976b7e804b10ab Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Tue, 31 Jul 2018 03:53:59 +0200 Subject: dselect: Use override attribute for virtual methods in derived classes C++11 makes it possible to use these attributes so that errors can be avoided, by helping the compiler know when we mean methods to override the ones from the parent class. Warned-by: cppcheck --- dselect/method.h | 18 +++++++++--------- dselect/pkglist.h | 20 ++++++++++---------- scripts/t/Dpkg_Shlibs/patterns.cpp | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/dselect/method.h b/dselect/method.h index c21e5da0e..f9593ec27 100644 --- a/dselect/method.h +++ b/dselect/method.h @@ -62,15 +62,15 @@ protected: void itd_description(); // Define these virtuals - void redraw1itemsel(int index, int selected); - void redrawcolheads(); - void redrawthisstate(); - void redrawinfo(); - void redrawtitle(); - void setwidths(); - void setheights(); - const char *itemname(int index); - const struct helpmenuentry *helpmenulist(); + void redraw1itemsel(int index, int selected) override; + void redrawcolheads() override; + void redrawthisstate() override; + void redrawinfo() override; + void redrawtitle() override; + void setwidths() override; + void setheights() override; + const char *itemname(int index) override; + const struct helpmenuentry *helpmenulist() override; public: // Keybinding functions */ diff --git a/dselect/pkglist.h b/dselect/pkglist.h index 077cabb88..f60a93169 100644 --- a/dselect/pkglist.h +++ b/dselect/pkglist.h @@ -149,16 +149,16 @@ protected: int deselect_one_of(pkginfo *er, pkginfo *ed, dependency *dep); // Define these virtuals - bool checksearch(char *str); - bool matchsearch(int index); - void redraw1itemsel(int index, int selected); - void redrawcolheads(); - void redrawthisstate(); - void redrawinfo(); - void redrawtitle(); - void setwidths(); - const char *itemname(int index); - const struct helpmenuentry *helpmenulist(); + bool checksearch(char *str) override; + bool matchsearch(int index) override; + void redraw1itemsel(int index, int selected) override; + void redrawcolheads() override; + void redrawthisstate() override; + void redrawinfo() override; + void redrawtitle() override; + void setwidths() override; + const char *itemname(int index) override; + const struct helpmenuentry *helpmenulist() override; // Miscellaneous internal routines diff --git a/scripts/t/Dpkg_Shlibs/patterns.cpp b/scripts/t/Dpkg_Shlibs/patterns.cpp index 3beee43e0..8bfcb4dad 100644 --- a/scripts/t/Dpkg_Shlibs/patterns.cpp +++ b/scripts/t/Dpkg_Shlibs/patterns.cpp @@ -75,7 +75,7 @@ namespace NSB public: ClassD(); virtual ~ClassD(); - virtual void generate_vt(const char *) const; + virtual void generate_vt(const char *) const override; }; EXPORT(ClassD::ClassD()); -- cgit v1.2.3