Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings #1087

Merged
merged 15 commits into from
Jun 3, 2023
Merged

Fix warnings #1087

merged 15 commits into from
Jun 3, 2023

Conversation

jcfr
Copy link
Member

@jcfr jcfr commented Apr 14, 2023

These fixes are confirmed to build with all CTK options enabled for both Qt4 and Qt5

@jcfr jcfr mentioned this pull request Apr 17, 2023
@jcfr jcfr force-pushed the fix-warnings branch 2 times, most recently from 535bb84 to 693b85c Compare April 17, 2023 08:04
jcfr added 15 commits June 3, 2023 14:53
This commit adds the comment recognized by the GCC when using Qt < 5.8.
See https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-fallthrough

It fixes warnings like the following:

  /path/to/CTK/Libs/PluginFramework/ctkPlugin_p.cpp:350:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
    350 |     if (operation.fetchAndAddOrdered(0) == ACTIVATING) return; // finalization already in progress.
        |     ^~
This commit fixes warnings like the following:

  /path/to/CTK/Libs/PluginFramework/ctkPlugin_p.cpp:532:29: warning: ‘T* QWeakPointer<T>::data() const [with T = ctkPlugin]’ is deprecated: Use toStrongRef() instead, and data() on the returned QSharedPointer [-Wdeprecated-declarations]
    532 |         this->q_func().data()->start();
        |                             ^
This commit fixes the following warning:

  /path/to/CTK/Libs/PluginFramework/ctkPlugin_p.cpp:544:17: warning: catching polymorphic type ‘class std::bad_cast’ by value [-Wcatch-value=]
    544 |     catch (std::bad_cast)
        |                 ^~~~~~~~
This commit fixes warnings like the following:

  /path/to/CTK/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewTest1.cpp:76:73: warning: passing ‘Qt::CheckState’ chooses ‘int’ over ‘uint’ {aka ‘unsigned int’} [-Wsign-promo]
     76 |   model.setHeaderData(0, Qt::Horizontal, Qt::Checked, Qt::CheckStateRole);
        |
This commit removes function that became obsolete in
b9d0ab9 (Apply ValueProxy to widgets min and max ) and fixes
the following warning:

  /path/to/CTK/Libs/Widgets/Testing/Cpp/ctkCoordinatesWidgetValueProxyTest.cpp:75:9: warning: ‘QString {anonymous}::coordinatesFromValue(double)’ defined but not used [-Wunused-function]
     75 | QString coordinatesFromValue(double val)
        |         ^~~~~~~~~~~~~~~~~~~~
… std::list

This commit fixes the following warning:

  /path/to/CTK/Libs/PluginFramework/ctkPluginAbstractTracked_p.h:251:3: warning: ‘template<class T> class QLinkedList’ is deprecated: Use std::list instead [-Wdeprecated-declarations]
    251 |   QLinkedList<S> initial;
        |   ^~~~~~~~~~~
This commit fixes warnings like the following by leveraging ctkUtils
functions.

  /path/to/CTK/Libs/PluginFramework/ctkPluginAbstractTracked_p.h:251:3: warning: ‘template<class T> class QLinkedList’ is deprecated: Use std::list instead [-Wdeprecated-declarations]
    251 |   QLinkedList<S> initial;
        |   ^~~~~~~~~~~
This commit fixes the following warning:

  /path/to/CTK/Libs/DICOM/Core/ctkDICOMItem.cpp: In member function ‘QString ctkDICOMItem::Decode(const DcmTag&, const OFString&) const’:
  /path/to/CTK/Libs/DICOM/Core/ctkDICOMItem.cpp:432:38: warning: comparison is always true due to limited range of data type [-Wtype-limits]
           if (32 <= raw[i] && raw[i] < 128)
                                        ^
This commit fixes the following warning introduced in 7b48c48 (ENH: Add
support for PBR material properties in material property widgets):

  In file included from /path/to/CTK/Libs/Visualization/VTK/Widgets/ctkVTKSurfaceMaterialPropertyWidget.h:25:0,
                   from /path/to/CTK-build/CTK-build/Libs/Visualization/VTK/Widgets/ui_ctkVTKPropertyWidget.h:27,
                   from /path/to/CTK/Libs/Visualization/VTK/Widgets/ctkVTKPropertyWidget.cpp:26:
  /path/to/CTK/Libs/Widgets/ctkMaterialPropertyWidget.h:183:16: warning: ‘virtual void ctkMaterialPropertyWidget::onInterpolationModeChanged(int)’ was hidden [-Woverloaded-virtual]
     virtual void onInterpolationModeChanged(int interpolationModeIndex);
                  ^
  In file included from /path/to/CTK-build/CTK-build/Libs/Visualization/VTK/Widgets/ui_ctkVTKPropertyWidget.h:27:0,
                   from /path/to/CTK/Libs/Visualization/VTK/Widgets/ctkVTKPropertyWidget.cpp:26:
  /path/to/CTK/Libs/Visualization/VTK/Widgets/ctkVTKSurfaceMaterialPropertyWidget.h:59:16: warning:   by ‘virtual void ctkVTKSurfaceMaterialPropertyWidget::onInterpolationModeChanged(ctkMaterialPropertyWidget::InterpolationMode)’ [-Woverloaded-virtual]
     virtual void onInterpolationModeChanged(ctkMaterialPropertyWidget::InterpolationMode newMode);
                  ^
This commit fixes the following warning using QAtomicInteger::loadRelaxed
introduced in Qt 5.14:

  /path/to/CTK/Libs/PluginFramework/ctkPluginAbstractTracked.tpp:284:28: warning: ‘T QBasicAtomicInteger<T>::load() const [with T = int]’ is deprecated: Use loadRelaxed [-Wdeprecated-declarations]
    284 |   return trackingCount.load();
        |          ~~~~~~~~~~~~~~~~~~^~
This commit fixes the following warning:

  /path/to/CTK/Libs/Widgets/ctkTransferFunctionView.cpp: In member function ‘virtual void ctkTransferFunctionView::resizeEvent(QResizeEvent*)’:
  /path/to/CTK/Libs/Widgets/ctkTransferFunctionView.cpp:96:29: warning: ‘void QGraphicsView::setMatrix(const QMatrix&, bool)’ is deprecated: Use setTransform() [-Wdeprecated-declarations]
     96 |   this->setMatrix(zoomMatrix);
        |                             ^
  In file included from /path/to/Qt/5.15.2/gcc_64/include/QtWidgets/QGraphicsView:1,
                   from /path/to/CTK/Libs/Widgets/ctkTransferFunctionView.h:25,
                   from /path/to/CTK/Libs/Widgets/ctkTransferFunctionView.cpp:33:
  /path/to/Qt/5.15.2/gcc_64/include/QtWidgets/qgraphicsview.h:170:48: note: declared here
    170 |     QT_DEPRECATED_X("Use setTransform()") void setMatrix(const QMatrix &matrix, bool combine = false);
        |
This commit fixes warnings like the following:

  /path/to/CTK/Libs/Widgets/ctkTreeComboBox.cpp:294:68: warning: ‘void QWidget::getContentsMargins(int*, int*, int*, int*) const’ is deprecated: use contentsMargins() [-Wdeprecated-declarations]
    294 |       container->getContentsMargins(0, &marginTop, 0, &marginBottom);
        |                                                                    ^
This commit fixes warning like the following:

  /path/to/CTK/Applications/ctkDICOMHost/Testing/Cpp/ctkDICOMHostTest1.cpp:34:24: warning: ‘void QProcess::start(const QString&, QIODevice::OpenMode)’ is deprecated: Use QProcess::start(const QString &program, const QStringList &arguments,OpenMode mode = ReadWrite) instead [-Wdeprecated-declarations]
     34 |   process.start(command);
        |                        ^
This commit fixes warnings like the following:

  /path/to/CTK/Libs/CommandLineModules/Backend/LocalProcess/ctkCmdLineModuleProcessWatcher.cpp:104:26: warning: ‘Q_PID QProcess::pid() const’ is deprecated: Use processId() instead [-Wdeprecated-declarations]
    104 |   if (::kill(process.pid(), SIGSTOP))
        |                          ^
@jamesobutler jamesobutler merged commit 2acba97 into commontk:master Jun 3, 2023
@jcfr jcfr deleted the fix-warnings branch June 14, 2023 05:04
@jcfr jcfr mentioned this pull request Jun 15, 2023
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants