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

Stefan Brüns stefan.bruens at rwth-aachen.de
Mon Oct 1 02:58:48 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 e300496..7ea85f5 100644
--- a/sipgen/gencode.c
+++ b/sipgen/gencode.c
@@ -9201,13 +9201,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"
                 );
     }
 
@@ -9316,7 +9316,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