]> granicus.if.org Git - graphviz/commitdiff
gvedit: squash Qt 'flush' deprecation warnings
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 11 Nov 2022 04:04:08 +0000 (20:04 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 11 Nov 2022 05:20:36 +0000 (21:20 -0800)
I think this code originally intended to call `Qt::flush` but changes in Qt now
make ADL pick the wrong overload. This squashes the warnings below. We cannot
easily switch to the alternative the deprecation warning suggests because it is
unavailable in older versions of Qt.

  main.cpp: In function ‘char** parseArgs(int, char**)’:
  main.cpp:72:42: warning:
    ‘QTextStream& QTextStreamFunctions::flush(QTextStream&)’ is deprecated: Use
    Qt::flush [-Wdeprecated-declarations]
     72 |                     " unrecognized\n" << flush;
        |                                          ^~~~~
  In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/QTextStream:1,
                   from mainwindow.h:19,
                   from main.cpp:24:
  /usr/include/x86_64-linux-gnu/qt5/QtCore/qtextstream.h:294:76: note: declared
    here
    294 | Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::flush")
      QTextStream &flush(QTextStream &s);
        |
  main.cpp:72:42: warning:
    ‘QTextStream& QTextStreamFunctions::flush(QTextStream&)’ is deprecated: Use
    Qt::flush [-Wdeprecated-declarations]
     72 |                     " unrecognized\n" << flush;
        |                                          ^~~~~
  In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/QTextStream:1,
                   from mainwindow.h:19,
                   from main.cpp:24:
  /usr/include/x86_64-linux-gnu/qt5/QtCore/qtextstream.h:294:76: note: declared
    here
    294 | Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::flush")
      QTextStream &flush(QTextStream &s);
        |
  csettings.cpp: In function ‘bool loadAttrs(QString, QComboBox*, QComboBox*,
    QComboBox*)’:
  csettings.cpp:94:35: warning:
    ‘QTextStream& QTextStreamFunctions::flush(QTextStream&)’ is deprecated: Use
    Qt::flush [-Wdeprecated-declarations]
     94 |             "\" for reading\n" << flush;
        |                                   ^~~~~
  In file included from qt5/QtCore/qdebug.h:49,
                   from qt5/QtCore/qcborcommon.h:45,
                   from qt5/QtCore/qcborvalue.h:45,
                   from qt5/QtCore/qcborarray.h:43,
                   from qt5/QtCore/QtCore:38,
                   from qt5/QtWidgets/QtWidgetsDepends:3,
                   from qt5/QtWidgets/QtWidgets:3,
                   from csettings.cpp:16:
  /usr/include/x86_64-linux-gnu/qt5/QtCore/qtextstream.h:294:76: note: declared
    here
    294 | Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::flush")
      QTextStream &flush(QTextStream &s);
        |
  csettings.cpp:94:35: warning:
    ‘QTextStream& QTextStreamFunctions::flush(QTextStream&)’ is deprecated: Use
    Qt::flush [-Wdeprecated-declarations]
     94 |             "\" for reading\n" << flush;
        |                                   ^~~~~
  In file included from qt5/QtCore/qdebug.h:49,
                   from qt5/QtCore/qcborcommon.h:45,
                   from qt5/QtCore/qcborvalue.h:45,
                   from qt5/QtCore/qcborarray.h:43,
                   from qt5/QtCore/QtCore:38,
                   from qt5/QtWidgets/QtWidgetsDepends:3,
                   from qt5/QtWidgets/QtWidgets:3,
                   from csettings.cpp:16:
  /usr/include/x86_64-linux-gnu/qt5/QtCore/qtextstream.h:294:76: note: declared
    here
    294 | Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::flush")
      QTextStream &flush(QTextStream &s);
        |

cmd/gvedit/csettings.cpp
cmd/gvedit/main.cpp

index 1d215fe841c0baea2d6ae3c471a9660eb2e68028..b0fe35473a9eab0abccd9156d018eaa28f59c611 100644 (file)
@@ -91,7 +91,8 @@ bool loadAttrs(const QString fileName, QComboBox * cbNameG,
        file.close();
     } else {
        errout << "Could not open attribute name file \"" << fileName <<
-           "\" for reading\n" << flush;
+           "\" for reading\n";
+       errout.flush();
        return true;
     }
 
index 2693325e0efb40332e0f9293f8284849fc0c3ece..fc7da50aa36145e6a59ed1fe92ccc57d798b36e7 100644 (file)
@@ -69,7 +69,8 @@ static char **parseArgs(int argc, char *argv[])
                usage(0);
            else {
                errout << cmd << " : option -" << ((char) optopt) <<
-                   " unrecognized\n" << flush;
+                   " unrecognized\n";
+               errout.flush();
                usage(1);
            }
            break;