[PyQt] [PATCH 5/5] Fix GCC suggest-override warning

Stefan Brüns stefan.bruens at rwth-aachen.de
Sat Sep 29 15:27:49 BST 2018


qt_metacall etc are always virtual function overrides, add the override
keyword.
Same for the protected overloads of the classes virtual functions.

Signed-off-by: Stefan Brüns <stefan.bruens at rwth-aachen.de>
---
 sipgen/gencode.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sipgen/gencode.c b/sipgen/gencode.c
index 20dea03..6e20f06 100644
--- a/sipgen/gencode.c
+++ b/sipgen/gencode.c
@@ -9212,13 +9212,13 @@ static void generateShadowClassDeclaration(sipSpec *pt,classDef *cd,FILE *fp)
     {
         prcode(fp,
 "\n"
-"    int qt_metacall(QMetaObject::Call,int,void **);\n"
-"    void *qt_metacast(const char *);\n"
+"    int qt_metacall(QMetaObject::Call,int,void **) SIP_OVERRIDE;\n"
+"    void *qt_metacast(const char *) SIP_OVERRIDE;\n"
             );
 
         if (!noPyQtQMetaObject(cd))
             prcode(fp,
-"    const QMetaObject *metaObject() const;\n"
+"    const QMetaObject *metaObject() const SIP_OVERRIDE;\n"
                 );
     }
 
@@ -9327,7 +9327,7 @@ void prOverloadDecl(FILE *fp, ifaceFileDef *scope, overDef *od, int defval)
         }
     }
  
-    prcode(fp, ")%s%X", (isConst(od) ? " const" : ""), od->exceptions);
+    prcode(fp, ")%s SIP_OVERRIDE%X", (isConst(od) ? " const" : ""), od->exceptions);
 
     restoreArgs(od->cppsig);
 }
-- 
2.19.0



More information about the PyQt mailing list