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

Further fixes for Clang-Tidy warnings. #132

Merged
merged 10 commits into from
May 12, 2024

Conversation

cristian64
Copy link
Collaborator

Follow-up to #125, where a Clang-Tidy configuration file was introduced, and a number of warning types were fully addressed.

The warnings were:

```
/w/dolphin-memory-engine/Source/GUI/MemScanner/ResultsListModel.cpp:10:23: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
   10 | int ResultsListModel::columnCount(const QModelIndex& parent) const
      |                       ^
/w/dolphin-memory-engine/Source/GUI/MemScanner/ResultsListModel.cpp:17:23: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
   17 | int ResultsListModel::rowCount(const QModelIndex& parent) const
      |                       ^
/w/dolphin-memory-engine/Source/GUI/MemScanner/ResultsListModel.cpp:26:28: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
   26 | QVariant ResultsListModel::data(const QModelIndex& index, int role) const
      |                            ^
/w/dolphin-memory-engine/Source/GUI/MemScanner/ResultsListModel.cpp:46:24: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
   46 | bool ResultsListModel::removeRows(int row, int count, const QModelIndex& parent)
      |                        ^
/w/dolphin-memory-engine/Source/GUI/MemScanner/ResultsListModel.cpp:61:28: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
   61 | QVariant ResultsListModel::headerData(int section, Qt::Orientation orientation, int role) const
      |                            ^
/w/dolphin-memory-engine/Source/GUI/MemScanner/ResultsListModel.h:23:7: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
   23 |   int columnCount(const QModelIndex& parent = QModelIndex()) const override;
      |       ^
/w/dolphin-memory-engine/Source/GUI/MemScanner/ResultsListModel.h:24:7: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
   24 |   int rowCount(const QModelIndex& parent = QModelIndex()) const override;
      |       ^
/w/dolphin-memory-engine/Source/GUI/MemScanner/ResultsListModel.h:25:12: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
   25 |   QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
      |            ^
/w/dolphin-memory-engine/Source/GUI/MemScanner/ResultsListModel.h:26:12: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
   26 |   QVariant headerData(int section, Qt::Orientation orientation,
      |            ^
/w/dolphin-memory-engine/Source/GUI/MemScanner/ResultsListModel.h:28:8: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
   28 |   bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
      |        ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:174:20: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
  174 | int MemWatchModel::columnCount(const QModelIndex& parent) const
      |                    ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:181:20: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
  181 | int MemWatchModel::rowCount(const QModelIndex& parent) const
      |                    ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:195:25: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
  195 | QVariant MemWatchModel::data(const QModelIndex& index, int role) const
      |                         ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:247:21: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
  247 | bool MemWatchModel::setData(const QModelIndex& index, const QVariant& value, int role)
      |                     ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:341:28: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
  341 | QModelIndex MemWatchModel::index(int row, int column, const QModelIndex& parent) const
      |                            ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:374:25: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
  374 | QVariant MemWatchModel::headerData(int section, Qt::Orientation orientation, int role) const
      |                         ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:535:21: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
  535 | void MemWatchModel::sort(int column, Qt::SortOrder order)
      |                     ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.h:34:7: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
   34 |   int columnCount(const QModelIndex& parent = QModelIndex()) const override;
      |       ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.h:35:7: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
   35 |   int rowCount(const QModelIndex& parent = QModelIndex()) const override;
      |       ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.h:36:12: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
   36 |   QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
      |            ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.h:37:15: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
   37 |   QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
      |               ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.h:39:12: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
   39 |   QVariant headerData(int section, Qt::Orientation orientation,
      |            ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.h:41:8: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
   41 |   bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
      |        ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.h:47:8: warning: default arguments on virtual or override methods are prohibited [google-default-arguments]
   47 |   void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
      |        ^
```
The warnings were:

```
/w/dolphin-memory-engine/Source/GUI/MemCopy/DlgCopy.h:17:3: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
   17 |   DlgCopy(QWidget* parent = nullptr);
      |   ^
      |   explicit
/w/dolphin-memory-engine/Source/GUI/MemViewer/MemViewer.h:21:3: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
   21 |   MemViewer(QWidget* parent);
      |   ^
      |   explicit
/w/dolphin-memory-engine/Source/GUI/MemWatcher/Dialogs/DlgImportCTFile.h:14:3: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
   14 |   DlgImportCTFile(QWidget* parent);
      |   ^
      |   explicit
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.h:31:3: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
   31 |   MemWatchModel(QObject* parent);
      |   ^
      |   explicit
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchWidget.h:15:3: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
   15 |   MemWatchWidget(QWidget* parent);
      |   ^
      |   explicit
/w/dolphin-memory-engine/Source/GUI/Settings/DlgSettings.h:14:3: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
   14 |   DlgSettings(QWidget* parent = nullptr);
      |   ^
      |   explicit
/w/dolphin-memory-engine/Source/MemoryWatch/MemWatchEntry.h:18:3: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
   18 |   MemWatchEntry(MemWatchEntry* entry);
      |   ^
      |   explicit
```
The warnings were:

```
/w/dolphin-memory-engine/Source/DolphinProcess/Linux/LinuxDolphinProcess.cpp:136:12: warning: redundant boolean literal in conditional return statement [readability-simplify-boolean-expr]
  136 |     return false;
      |            ^
/w/dolphin-memory-engine/Source/DolphinProcess/Linux/LinuxDolphinProcess.cpp:271:12: warning: redundant boolean literal in conditional return statement [readability-simplify-boolean-expr]
  270 |   if (nwrote != size)
      |   ~~~~~~~~~~~~~~~~~~~
      |   return nwrote == size
  271 |     return false;
      |     ~~~~~~~^~~~~~
  272 |
  273 |   return true;
      |   ~~~~~~~~~~~
/w/dolphin-memory-engine/Source/GUI/MemViewer/MemViewer.cpp:763:9: warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
  763 |     if (!(value >= '0' && value <= '9') && !(value >= 'A' && value <= 'F'))
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                 <      ||       >
/w/dolphin-memory-engine/Source/GUI/MemViewer/MemViewer.cpp:763:44: warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
  763 |     if (!(value >= '0' && value <= '9') && !(value >= 'A' && value <= 'F'))
      |                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                    <      ||       >
/w/dolphin-memory-engine/Source/GUI/MemViewer/MemViewer.cpp:983:7: warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
  983 |   if (!(m_currentFirstAddress + (m_numColumns * rowIndex + columnIndex) >= m_memViewStart &&
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                         <                 ||
  984 |         m_currentFirstAddress + (m_numColumns * rowIndex + columnIndex) < m_memViewEnd) ||
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                         >=
/w/dolphin-memory-engine/Source/GUI/MemWatcher/Dialogs/DlgImportCTFile.cpp:173:28: warning: redundant boolean literal in conditional assignment [readability-simplify-boolean-expr]
  172 |   if (m_btnGroupImportAddressMethod->checkedId() == 0)
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |   m_useDolphinPointers = m_btnGroupImportAddressMethod->checkedId() != 0
  173 |     m_useDolphinPointers = false;
      |     ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
  174 |   else
      |   ~~~~
  175 |     m_useDolphinPointers = true;
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
The warnings were:

```
/w/dolphin-memory-engine/Source/DolphinProcess/Linux/LinuxDolphinProcess.cpp:174:5: warning: switching on non-enum value without default case may not cover all cases [bugprone-switch-missing-default-case]
  174 |     switch (size)
      |     ^
/w/dolphin-memory-engine/Source/DolphinProcess/Linux/LinuxDolphinProcess.cpp:239:5: warning: switching on non-enum value without default case may not cover all cases [bugprone-switch-missing-default-case]
  239 |     switch (size)
      |     ^
/w/dolphin-memory-engine/Source/GUI/MemScanner/MemScanWidget.cpp:273:3: warning: switching on non-enum value without default case may not cover all cases [bugprone-switch-missing-default-case]
  273 |   switch (numTerms)
      |   ^
/w/dolphin-memory-engine/Source/GUI/MemScanner/ResultsListModel.cpp:33:5: warning: switching on non-enum value without default case may not cover all cases [bugprone-switch-missing-default-case]
   33 |     switch (index.column())
      |     ^
/w/dolphin-memory-engine/Source/GUI/MemScanner/ResultsListModel.cpp:65:5: warning: switching on non-enum value without default case may not cover all cases [bugprone-switch-missing-default-case]
   65 |     switch (section)
      |     ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:210:7: warning: switching on non-enum value without default case may not cover all cases [bugprone-switch-missing-default-case]
  210 |       switch (index.column())
      |       ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:378:5: warning: switching on non-enum value without default case may not cover all cases [bugprone-switch-missing-default-case]
  378 |     switch (section)
      |     ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:548:3: warning: switching on non-enum value without default case may not cover all cases [bugprone-switch-missing-default-case]
  548 |   switch (column)
      |   ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchWidget.cpp:825:5: warning: switching on non-enum value without default case may not cover all cases [bugprone-switch-missing-default-case]
  825 |     switch (questionBox->exec())
      |     ^
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.h:72:5: warning: switching on non-enum value without default case may not cover all cases [bugprone-switch-missing-default-case]
   72 |     switch (size)
      |     ^
```
The warnings were:

```
/w/dolphin-memory-engine/Source/GUI/MemCopy/DlgCopy.cpp:91:3: warning: multiple declarations in a single statement reduces readability [readability-isolate-declaration]
   91 |   u32 address, count;
      |   ^~~~~~~~~~~~~~~~~~~
/w/dolphin-memory-engine/Source/GUI/MemWatcher/Dialogs/DlgAddWatchEntry.cpp:262:3: warning: multiple declarations in a single statement reduces readability [readability-isolate-declaration]
  262 |   int column, rowSpan, columnSpan;
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
The warnings were:

```
/w/dolphin-memory-engine/Source/GUI/MemViewer/MemViewer.cpp:412:17: warning: method 'copySelection' can be made const [readability-make-member-function-const]
  412 | void MemViewer::copySelection(Common::MemType type)
      |                 ^
      |                                                     const
/w/dolphin-memory-engine/Source/GUI/MemViewer/MemViewer.cpp:815:17: warning: method 'renderSeparatorLines' can be made const [readability-make-member-function-const]
  815 | void MemViewer::renderSeparatorLines(QPainter& painter)
      |                 ^
      |                                                         const
/w/dolphin-memory-engine/Source/GUI/MemViewer/MemViewer.cpp:842:17: warning: method 'renderColumnsHeaderText' can be made const [readability-make-member-function-const]
  842 | void MemViewer::renderColumnsHeaderText(QPainter& painter)
      |                 ^
      |                                                            const
/w/dolphin-memory-engine/Source/GUI/MemViewer/MemViewer.cpp:866:17: warning: method 'renderRowHeaderText' can be made const [readability-make-member-function-const]
  866 | void MemViewer::renderRowHeaderText(QPainter& painter, const int rowIndex)
      |                 ^
      |                                                                            const
```
The warnings were:

```
/w/dolphin-memory-engine/Source/GUI/GUICommon.cpp:53:12: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
   53 |     return QString("");
      |            ^~~~~~~~  ~
      |            {         }
/w/dolphin-memory-engine/Source/GUI/GUICommon.cpp:70:12: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
   70 |     return QString("");
      |            ^~~~~~~~  ~
      |            {         }
/w/dolphin-memory-engine/Source/GUI/MemScanner/ResultsListModel.cpp:29:12: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
   29 |     return QVariant();
      |            ^~~~~~~~~~
      |            {}
/w/dolphin-memory-engine/Source/GUI/MemScanner/ResultsListModel.cpp:43:10: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
   43 |   return QVariant();
      |          ^~~~~~~~~~
      |          {}
/w/dolphin-memory-engine/Source/GUI/MemScanner/ResultsListModel.cpp:75:10: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
   75 |   return QVariant();
      |          ^~~~~~~~~~
      |          {}
/w/dolphin-memory-engine/Source/GUI/MemViewer/MemViewer.cpp:68:10: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
   68 |   return QSize(m_rowHeaderWidth + m_hexAreaWidth + 17 * m_charWidthEm +
      |          ^~~~~~
      |          {
   69 |                    verticalScrollBar()->width(),
   70 |                m_columnHeaderHeight + m_hexAreaHeight + m_charHeight / 2);
      |                                                                         ~
      |                                                                         }
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:198:12: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
  198 |     return QVariant();
      |            ^~~~~~~~~~
      |            {}
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:205:14: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
  205 |       return QVariant(static_cast<int>(item->getEntry()->getType()));
      |              ^~~~~~~~~                                             ~
      |              {                                                     }
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:244:10: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
  244 |   return QVariant();
      |          ^~~~~~~~~~
      |          {}
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:344:12: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
  344 |     return QModelIndex();
      |            ^~~~~~~~~~~~~
      |            {}
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:357:12: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
  357 |     return QModelIndex();
      |            ^~~~~~~~~~~~~
      |            {}
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:363:12: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
  363 |     return QModelIndex();
      |            ^~~~~~~~~~~~~
      |            {}
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:369:12: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
  369 |     return QModelIndex();
      |            ^~~~~~~~~~~~~
      |            {}
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:392:10: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
  392 |   return QVariant();
      |          ^~~~~~~~~~
      |          {}
```
The warnings were:

```
/w/dolphin-memory-engine/Source/CheatEngineParser/CheatEngineParser.cpp:52:7: warning: do not use 'else' after 'return' [readability-else-after-return]
   52 |       else if (!m_errorMessages.isEmpty())
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   53 |       {
      |       ~
   54 |         if (m_errorMessages.endsWith("\n\n"))
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   55 |           m_errorMessages.remove(m_errorMessages.length() - 2, 2);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   56 |       }
      |       ~
/w/dolphin-memory-engine/Source/CheatEngineParser/CheatEngineParser.cpp:145:9: warning: do not use 'else' after 'continue' [readability-else-after-return]
  145 |         else
      |         ^~~~
  146 |         {
      |         ~
  147 |           currentCheatEntryState.typeFound = true;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  148 |           if (strVarType == "Byte" || strVarType == "Binary")
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  149 |             type = Common::MemType::type_byte;
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  150 |           else if (strVarType == "String")
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  151 |             type = Common::MemType::type_string;
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  152 |           else if (strVarType == "Array of byte")
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  153 |             type = Common::MemType::type_byteArray;
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  154 |           else
      |           ~~~~
  155 |             currentCheatEntryState.validType = false;
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  156 |         }
      |         ~
/w/dolphin-memory-engine/Source/Common/MemoryCommon.cpp:497:5: warning: do not use 'else' after 'return' [readability-else-after-return]
  497 |     else
      |     ^~~~
  498 |     {
      |     ~
  499 |       s8 aByte = 0;
      |       ~~~~~~~~~~~~~
  500 |       std::memcpy(&aByte, memory, sizeof(s8));
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  501 |       // This has to be converted to an integer type because printing a uint8_t would resolve to a
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  502 |       // char and print a single character.  Additionaly, casting a signed type to a larger signed
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  503 |       // type will extend the sign to match the size of the destination type, this is required for
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  504 |       // signed values in decimal, but must be bypassed for other bases, this is solved by first
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  505 |       // casting to u8 then to signed int.
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  506 |       if (base == Common::MemBase::base_decimal)
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  507 |         ss << static_cast<int>(aByte);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  508 |       else
      |       ~~~~
  509 |         ss << static_cast<int>(static_cast<u8>(aByte));
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  510 |       return ss.str();
      |       ~~~~~~~~~~~~~~~~
  511 |     }
      |     ~
/w/dolphin-memory-engine/Source/DolphinProcess/DolphinAccessor.cpp:130:3: warning: do not use 'else' after 'return' [readability-else-after-return]
  130 |   else if (isARAMAccessible())
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  131 |   {
      |   ~
  132 |     return Common::GetMEM1SizeReal() + Common::ARAM_SIZE;
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  133 |   }
      |   ~
  134 |   else
      |   ~~~~
  135 |   {
      |   ~
  136 |     return Common::GetMEM1SizeReal();
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  137 |   }
      |   ~
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:356:3: warning: do not use 'else' after 'return' [readability-else-after-return]
  356 |   else
      |   ^~~~
      |       return QModelIndex()
  357 |     return QModelIndex();
      |     ~~~~~~~~~~~~~~~~~~~~
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:414:3: warning: do not use 'else' after 'return' [readability-else-after-return]
  414 |   else if (node->getParent() == m_rootNode)
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  415 |     return 1;
      |     ~~~~~~~~~
  416 |   else
      |   ~~~~
  417 |     return getNodeDeepness(node->getParent()) + 1;
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:560:11: warning: do not use 'else' after 'return' [readability-else-after-return]
  560 |           else if (left->isGroup())
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~
  561 |             return true;
      |             ~~~~~~~~~~~~
  562 |           else if (right->isGroup())
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~
  563 |             return false;
      |             ~~~~~~~~~~~~
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:577:17: warning: do not use 'else' after 'return' [readability-else-after-return]
  577 |                 else if (right->isGroup())
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
  578 |                   return false;
      |                   ~~~~~~~~~~~~
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:592:17: warning: do not use 'else' after 'return' [readability-else-after-return]
  592 |                 else if (right->isGroup())
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
  593 |                   return false;
      |                   ~~~~~~~~~~~~
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:609:17: warning: do not use 'else' after 'return' [readability-else-after-return]
  609 |                 else if (right->isGroup())
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
  610 |                   return false;
      |                   ~~~~~~~~~~~~
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:624:11: warning: do not use 'else' after 'return' [readability-else-after-return]
  624 |           else if (left->isGroup())
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~
  625 |             return true;
      |             ~~~~~~~~~~~~
  626 |           else if (right->isGroup())
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~
  627 |             return false;
      |             ~~~~~~~~~~~~
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchWidget.cpp:535:3: warning: do not use 'else' after 'return' [readability-else-after-return]
  535 |   else if (m_watchView->selectionModel()->isSelected(index.parent()))
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  536 |     return true;
      |     ~~~~~~~~~~~~
  537 |   else
      |   ~~~~
  538 |     return isAnyAncestorSelected(index.parent());
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchWidget.cpp:630:7: warning: do not use 'else' after 'return' [readability-else-after-return]
  630 |       else if (answer == QMessageBox::No)
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  631 |         m_watchModel->clearRoot();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.cpp:329:5: warning: do not use 'else' after 'return' [readability-else-after-return]
  329 |     else
      |     ^~~~
  330 |       return (compareMemoryAsNumbers(newerMemory, memoryToCompare1, noOffset, false, false,
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  331 |                                      realSize) == MemScanner::CompareResult::equal);
      |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.cpp:502:3: warning: do not use 'else' after 'return' [readability-else-after-return]
  502 |   else if (filter == MemScanner::ScanFiter::exact || filter == MemScanner::ScanFiter::increasedBy ||
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  503 |            filter == MemScanner::ScanFiter::decreasedBy ||
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  504 |            filter == MemScanner::ScanFiter::biggerThan ||
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  505 |            filter == MemScanner::ScanFiter::smallerThan)
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  506 |     return 1;
      |     ~~~~~~~~
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.h:124:5: warning: do not use 'else' after 'return' [readability-else-after-return]
  124 |     else if (firstByte > (secondByte + convertMemoryToType<T>(offset, offsetInvert)))
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  125 |       return CompareResult::bigger;
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  126 |     else
      |     ~~~~
  127 |       return CompareResult::equal;
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/w/dolphin-memory-engine/Source/MemoryWatch/MemWatchEntry.cpp:223:3: warning: do not use 'else' after 'return' [readability-else-after-return]
  223 |   else
      |   ^~~~
  224 |   {
      |   ~
  225 |     std::stringstream ss;
      |     ~~~~~~~~~~~~~~~~~~~~~
  226 |     ss << std::hex << std::uppercase << address;
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  227 |     return ss.str();
      |     ~~~~~~~~~~~~~~~~
  228 |   }
      |   ~
/w/dolphin-memory-engine/Source/MemoryWatch/MemWatchEntry.cpp:345:3: warning: do not use 'else' after 'return' [readability-else-after-return]
  345 |   else
      |   ^~~~
  346 |   {
      |   ~
  347 |     delete[] buffer;
      |     ~~~~~~~~~~~~~~~~
  348 |     return writeReturn;
      |     ~~~~~~~~~~~~~~~~~~~
  349 |   }
      |   ~
/w/dolphin-memory-engine/Source/MemoryWatch/MemWatchTreeNode.cpp:254:3: warning: do not use 'else' after 'return' [readability-else-after-return]
  254 |   else
      |   ^~~~
  255 |   {
      |   ~
  256 |     std::stringstream ssAddress;
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  257 |     ssAddress << std::hex << std::uppercase << m_entry->getConsoleAddress();
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  258 |     if (m_entry->isBoundToPointer())
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  259 |     {
      |     ~
  260 |       for (int i = 0; i < static_cast<int>(m_entry->getPointerLevel()); ++i)
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  261 |       {
      |       ~
  262 |         std::stringstream ssOffset;
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  263 |         ssOffset << std::hex << std::uppercase << m_entry->getPointerOffset(i);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  264 |         ssAddress << "[" << ssOffset.str() << "]";
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  265 |       }
      |       ~
  266 |     }
      |     ~
  267 |     std::string csvLine =
      |     ~~~~~~~~~~~~~~~~~~~~~
  268 |         m_entry->getLabel().toStdString() + ";" + ssAddress.str() + ";" +
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  269 |         GUICommon::getStringFromType(m_entry->getType(), m_entry->getLength()).toStdString() + "\n";
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
The warnings were:

```
/w/dolphin-memory-engine/Source/GUI/MemScanner/MemScanWidget.cpp:257:7: warning: static member accessed through instance [readability-static-accessed-through-instance]
  257 |   if (m_memScanner->typeSupportsAdditionalOptions(
      |       ^~~~~~~~~~~~~~
      |       MemScanner::
/w/dolphin-memory-engine/Source/GUI/MemScanner/MemScanWidget.cpp:273:18: warning: static member accessed through instance [readability-static-accessed-through-instance]
  273 |   int numTerms = m_memScanner->getTermsNumForFilter(theFilter);
      |                  ^~~~~~~~~~~~~~
      |                  MemScanner::
/w/dolphin-memory-engine/Source/GUI/MemViewer/MemViewer.cpp:443:21: warning: static member accessed through instance [readability-static-accessed-through-instance]
  443 |   QString strByte = dlg->getText(this, "Enter the new byte", "Byte (in hex)");
      |                     ^~~~~
      |                     QInputDialog::
/w/dolphin-memory-engine/Source/GUI/MemViewer/MemViewer.cpp:487:22: warning: static member accessed through instance [readability-static-accessed-through-instance]
  487 |   QString strLabel = dlg->getText(this, "Enter the label of the new watch", "label");
      |                      ^~~~~
      |                      QInputDialog::
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchDelegate.cpp:15:28: warning: static member accessed through instance [readability-static-accessed-through-instance]
   15 |   MemWatchTreeNode* node = model->getTreeNodeFromIndex(index);
      |                            ^~~~~~~
      |                            MemWatchModel::
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchDelegate.cpp:34:28: warning: static member accessed through instance [readability-static-accessed-through-instance]
   34 |   MemWatchTreeNode* node = model->getTreeNodeFromIndex(index);
      |                            ^~~~~~~
      |                            MemWatchModel::
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchWidget.cpp:90:9: warning: static member accessed through instance [readability-static-accessed-through-instance]
   90 |         m_watchModel->getTreeNodeFromIndex(m_watchView->selectionModel()->currentIndex()),
      |         ^~~~~~~~~~~~~~
      |         MemWatchModel::
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchWidget.cpp:132:12: warning: static member accessed through instance [readability-static-accessed-through-instance]
  132 |     node = m_watchModel->getTreeNodeFromIndex(index);
      |            ^~~~~~~~~~~~~~
      |            MemWatchModel::
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchWidget.cpp:135:30: warning: static member accessed through instance [readability-static-accessed-through-instance]
  135 |       MemWatchEntry* entry = m_watchModel->getEntryFromIndex(index);
      |                              ^~~~~~~~~~~~~~
      |                              MemWatchModel::
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchWidget.cpp:290:38: warning: static member accessed through instance [readability-static-accessed-through-instance]
  290 |       MemWatchEntry* selectedEntry = m_watchModel->getEntryFromIndex(selectedItems.at(x));
      |                                      ^~~~~~~~~~~~~~
      |                                      MemWatchModel::
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchWidget.cpp:324:56: warning: static member accessed through instance [readability-static-accessed-through-instance]
  324 |     MemWatchTreeNode* theNode = new MemWatchTreeNode(*(m_watchModel->getTreeNodeFromIndex(i)));
      |                                                        ^~~~~~~~~~~~~~
      |                                                        MemWatchModel::
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchWidget.cpp:436:30: warning: static member accessed through instance [readability-static-accessed-through-instance]
  436 |     MemWatchTreeNode* node = m_watchModel->getTreeNodeFromIndex(index);
      |                              ^~~~~~~~~~~~~~
      |                              MemWatchModel::
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchWidget.cpp:549:30: warning: static member accessed through instance [readability-static-accessed-through-instance]
  549 |     MemWatchTreeNode* node = m_watchModel->getTreeNodeFromIndex(selection.at(i));
      |                              ^~~~~~~~~~~~~~
      |                              MemWatchModel::
/w/dolphin-memory-engine/Source/main.cpp:38:10: warning: static member accessed through instance [readability-static-accessed-through-instance]
   38 |   return app.exec();
      |          ^~~~
      |          QApplication::
```
```
/w/dolphin-memory-engine/Source/DolphinProcess/Linux/LinuxDolphinProcess.cpp:142:3: warning: uninitialized record type: 'local' [hicpp-member-init]
  142 |   struct iovec local;
      |   ^
      |                     {}
/w/dolphin-memory-engine/Source/DolphinProcess/Linux/LinuxDolphinProcess.cpp:143:3: warning: uninitialized record type: 'remote' [hicpp-member-init]
  143 |   struct iovec remote;
      |   ^
      |                      {}
/w/dolphin-memory-engine/Source/DolphinProcess/Linux/LinuxDolphinProcess.cpp:211:3: warning: uninitialized record type: 'local' [hicpp-member-init]
  211 |   struct iovec local;
      |   ^
      |                     {}
/w/dolphin-memory-engine/Source/DolphinProcess/Linux/LinuxDolphinProcess.cpp:212:3: warning: uninitialized record type: 'remote' [hicpp-member-init]
  212 |   struct iovec remote;
      |   ^
      |                      {}
/w/dolphin-memory-engine/Source/GUI/MainWindow.cpp:19:1: warning: constructor does not initialize these fields: m_watcher, m_scanner, m_viewer, m_copier, m_lblDolphinStatus, m_lblMem2Status, m_menuFile, m_menuEdit, m_menuDolphin, m_menuView, m_menuHelp, m_actOpenWatchList, m_actSaveWatchList, m_actSaveAsWatchList, m_actClearWatchList, m_actImportFromCT, m_actExportAsCSV, m_actSettings, m_actAutoHook, m_actHook, m_actUnhook, m_actMemoryViewer, m_actCopyMemory, m_actQuit, m_actAbout [hicpp-member-init]
   19 | MainWindow::MainWindow()
      | ^
/w/dolphin-memory-engine/Source/GUI/MemScanner/MemScanWidget.cpp:14:1: warning: constructor does not initialize these fields: m_memScanner, m_resultsListModel, m_txbSearchRange1, m_txbSearchRange2, m_btnFirstScan, m_btnNextScan, m_btnResetScan, m_btnUndoScan, m_btnAddSelection, m_btnAddAll, m_btnRemoveSelection, m_txbSearchTerm1, m_txbSearchTerm2, m_searchTerm2Widget, m_currentValuesUpdateTimer, m_cmbScanFilter, m_cmbScanType, m_lblResultCount, m_chkSignedScan, m_chkEnforceMemAlignment, m_btnGroupScanBase, m_rdbBaseDecimal, m_rdbBaseHexadecimal, m_rdbBaseOctal, m_rdbBaseBinary, m_groupScanBase, m_tblResulstList, m_variableLengthType [hicpp-member-init]
   14 | MemScanWidget::MemScanWidget()
      | ^
/w/dolphin-memory-engine/Source/GUI/MemViewer/MemViewer.cpp:25:1: warning: constructor does not initialize these fields: m_curosrRect [hicpp-member-init]
   25 | MemViewer::MemViewer(QWidget* parent) : QAbstractScrollArea(parent)
      | ^
/w/dolphin-memory-engine/Source/GUI/MemViewer/MemViewerWidget.cpp:10:1: warning: constructor does not initialize these fields: m_txtJumpAddress, m_btnGoToMEM1Start, m_btnGoToSecondaryRAMStart, m_updateMemoryTimer, m_memViewer [hicpp-member-init]
   10 | MemViewerWidget::MemViewerWidget(QWidget* const parent) : QWidget(parent)
      | ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/Dialogs/DlgAddWatchEntry.cpp:13:1: warning: constructor does not initialize these fields: m_entry, m_txbAddress, m_offsetsLayout, m_chkBoundToPointer, m_lblValuePreview, m_txbLabel, m_cmbTypes, m_spnLength, m_pointerWidget, m_btnAddOffset, m_btnRemoveOffset [hicpp-member-init]
   13 | DlgAddWatchEntry::DlgAddWatchEntry(const bool newEntry, MemWatchEntry* const entry,
      | ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/Dialogs/DlgChangeType.cpp:11:1: warning: constructor does not initialize these fields: m_cmbTypes, m_spnLength, m_lengthSelection [hicpp-member-init]
   11 | DlgChangeType::DlgChangeType(QWidget* parent, const int typeIndex, const size_t length)
      | ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/Dialogs/DlgImportCTFile.cpp:11:1: warning: constructor does not initialize these fields: m_useDolphinPointers, m_txbFileName, m_btnBrowseFiles, m_txbCommonBase, m_btnGroupImportAddressMethod, m_rdbUseDolphinPointers, m_rdbUseCommonBase, m_groupImportAddressMethod, m_widgetAddressMethod [hicpp-member-init]
   11 | DlgImportCTFile::DlgImportCTFile(QWidget* const parent) : QDialog(parent)
      | ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchWidget.cpp:31:1: warning: constructor does not initialize these fields: m_watchView, m_watchModel, m_watchDelegate, m_btnAddGroup, m_btnAddWatchEntry, m_updateTimer, m_freezeTimer [hicpp-member-init]
   31 | MemWatchWidget::MemWatchWidget(QWidget* parent) : QWidget(parent)
      | ^
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.cpp:30:1: warning: constructor does not initialize these fields: m_memSize [hicpp-member-init]
   30 | MemScanner::MemScanner() = default;
      | ^
```
@cristian64 cristian64 merged commit 2070819 into aldelaro5:master May 12, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants