tests/auto/compilerwarnings/tst_compilerwarnings.cpp
changeset 29 b72c6db6890b
parent 18 2f34d5167611
child 37 758a864f9613
equal deleted inserted replaced
25:e24348a560a6 29:b72c6db6890b
    60     Q_OBJECT
    60     Q_OBJECT
    61 
    61 
    62 private slots:
    62 private slots:
    63     void warnings_data();
    63     void warnings_data();
    64     void warnings();
    64     void warnings();
       
    65 
       
    66 private:
       
    67     bool shouldIgnoreWarning(QString const&);
    65 };
    68 };
    66 
    69 
    67 #if 0
    70 #if 0
    68 /*
    71 /*
    69     Return list of all documented qfeatures (QT_NO_*)
    72     Return list of all documented qfeatures (QT_NO_*)
   240 #endif
   243 #endif
   241     QStringList errList;
   244     QStringList errList;
   242     if (!errs.isEmpty()) {
   245     if (!errs.isEmpty()) {
   243         errList = errs.split("\n");
   246         errList = errs.split("\n");
   244         qDebug() << "Arguments:" << args;
   247         qDebug() << "Arguments:" << args;
   245         foreach (QString err, errList) {
   248         QStringList validErrors;
   246             qDebug() << err;
   249         foreach (QString const& err, errList) {
       
   250             bool ignore = shouldIgnoreWarning(err);
       
   251             qDebug() << err << (ignore ? " [ignored]" : "");
       
   252             if (!ignore) {
       
   253                 validErrors << err;
       
   254             }
   247         }
   255         }
       
   256         errList = validErrors;
   248     }
   257     }
   249     QCOMPARE(errList.count(), 0); // verbose info how many lines of errors in output
   258     QCOMPARE(errList.count(), 0); // verbose info how many lines of errors in output
   250     QVERIFY(errs.isEmpty());
       
   251 
   259 
   252     tmpQSourceFile.remove();
   260     tmpQSourceFile.remove();
       
   261 }
       
   262 
       
   263 bool tst_CompilerWarnings::shouldIgnoreWarning(QString const& warning)
       
   264 {
       
   265     if (warning.isEmpty()) {
       
   266         return true;
       
   267     }
       
   268 
       
   269     // icecc outputs warnings if some icecc node breaks
       
   270     if (warning.startsWith("ICECC[")) {
       
   271         return true;
       
   272     }
       
   273 
       
   274     // Add more bogus warnings here
       
   275 
       
   276     return false;
   253 }
   277 }
   254 
   278 
   255 QTEST_APPLESS_MAIN(tst_CompilerWarnings)
   279 QTEST_APPLESS_MAIN(tst_CompilerWarnings)
   256 
   280 
   257 #include "tst_compilerwarnings.moc"
   281 #include "tst_compilerwarnings.moc"