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

Add Clang-Tidy configuration file + a some fixes. #125

Merged
merged 25 commits into from
May 5, 2024

Conversation

cristian64
Copy link
Collaborator

A .clang-tidy file has been added to the repository (next to the .clang-format file).

A subset of the enabled warning types have been addressed.

`CMAKE_EXPORT_COMPILE_COMMANDS` is now enabled. Supported generators
(e.g. Ninja or Makefile) will now produce a `compile_commands.json`
file in the build directory.
The check list has been manually crafted for the Dolphin Memory Engine
project. Checks that are generally not worth fixing have been disabled,
but it is possible there are more checks that could be disabled; devs
are encouraged to disable them when the time comes.
Warning was:
```
/w/dolphin-memory-engine/Source/GUI/MemViewer/MemViewer.cpp:918:9: warning: result of integer division used in a floating point context; possible loss of precision [bugprone-integer-division]
  918 |         (1000 - (m_elapsedTimer.elapsed() -
      |         ^
/w/dolphin-memory-engine/Source/GUI/MemViewer/MemViewer.cpp:920:10: warning: result of integer division used in a floating point context; possible loss of precision [bugprone-integer-division]
  920 |         (1000 / 100);
      |          ^
```
The warnings were:
```
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:432:34: warning: multilevel pointer conversion from 'MemWatchTreeNode **' to 'const void *', please use explicit cast [bugprone-multi-level-implicit-pointer-conversion]
  432 |   std::memcpy(&leastDeepPointer, &leastDeepNode, sizeof(MemWatchTreeNode*));
      |                                  ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:438:27: warning: multilevel pointer conversion from 'MemWatchTreeNode **' to 'const void *', please use explicit cast [bugprone-multi-level-implicit-pointer-conversion]
  438 |     std::memcpy(&pointer, &node, sizeof(node));
      |                           ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:462:15: warning: multilevel pointer conversion from 'MemWatchTreeNode **' to 'void *', please use explicit cast [bugprone-multi-level-implicit-pointer-conversion]
  462 |   std::memcpy(&leastDeepNode, &leastDeepNodePtr, sizeof(leastDeepNodePtr));
      |               ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:489:17: warning: multilevel pointer conversion from 'MemWatchTreeNode **' to 'void *', please use explicit cast [bugprone-multi-level-implicit-pointer-conversion]
  489 |     std::memcpy(&srcNode, &nodePtr, sizeof(nodePtr));
      |                 ^
```

The bitwise casts are now applied via `std::bit_cast`.
The one warning was:

```
/w/dolphin-memory-engine/Source/GUI/MemViewer/MemViewer.cpp:954:24: warning: 'signed char' to 'int' conversion; consider casting to 'unsigned char' first. [bugprone-signed-char-misuse]
  954 |   int asciiByte = (int)asciiStr[0];
      |                        ^
```
The warnings were:

```
/w/dolphin-memory-engine/Source/CheatEngineParser/CheatEngineParser.cpp:42:17: warning: unused local variable 'test' of type 'std::string' (aka 'basic_string<char>') [bugprone-unused-local-non-trivial-variable]
   42 |     std::string test = m_xmlReader->name().toString().toStdString();
      |                 ^
/w/dolphin-memory-engine/Source/CheatEngineParser/CheatEngineParser.cpp:74:19: warning: unused local variable 'test' of type 'std::string' (aka 'basic_string<char>') [bugprone-unused-local-non-trivial-variable]
   74 |       std::string test = m_xmlReader->name().toString().toStdString();
      |                   ^
/w/dolphin-memory-engine/Source/CheatEngineParser/CheatEngineParser.cpp:98:19: warning: unused local variable 'test' of type 'std::string' (aka 'basic_string<char>') [bugprone-unused-local-non-trivial-variable]
   98 |       std::string test = m_xmlReader->name().toString().toStdString();
      |                   ^
/w/dolphin-memory-engine/Source/Common/MemoryCommon.cpp:421:25: warning: unused local variable 'byteStream' of type 'std::stringstream' (aka 'basic_stringstream<char>') [bugprone-unused-local-non-trivial-variable]
  421 |       std::stringstream byteStream(i);
      |                         ^
```
The warnings were:

```
/w/dolphin-memory-engine/Source/DolphinProcess/Linux/LinuxDolphinProcess.cpp:166:21: warning: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting]
  166 |   remote.iov_base = (void*)RAMAddress;
      |                     ^
/w/dolphin-memory-engine/Source/DolphinProcess/Linux/LinuxDolphinProcess.cpp:235:21: warning: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting]
  235 |   remote.iov_base = (void*)RAMAddress;
      |                     ^
/w/dolphin-memory-engine/Source/GUI/MemCopy/DlgCopy.cpp:159:23: warning: C-style casts are discouraged; use static_cast [google-readability-casting]
  159 |                       (DlgCopy::ByteStringFormats)m_cmbViewerBytesSeparator->currentIndex())));
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                       static_cast<DlgCopy::ByteStringFormats>(                             )
/w/dolphin-memory-engine/Source/GUI/MemCopy/DlgCopy.cpp:221:12: warning: C-style casts are discouraged; use static_cast [google-readability-casting]
  221 |   output = (u32)u;
      |            ^~~~~
      |            static_cast<u32>( )
/w/dolphin-memory-engine/Source/GUI/MemViewer/MemViewer.cpp:733:75: warning: C-style casts are discouraged; use static_cast [google-readability-casting]
  733 |   u32 offsetToWrite = Common::dolphinAddrToOffset(m_currentFirstAddress + (u32)memoryOffset,
      |                                                                           ^~~~~
      |                                                                           static_cast<u32>()
```
The warnings were:

```
/w/dolphin-memory-engine/Source/Common/MemoryCommon.cpp:160:7: warning: consider replacing 'unsigned long long' with 'uint64' [google-runtime-int]
  160 |       unsigned long long input = 0;
      |       ^
/w/dolphin-memory-engine/Source/Common/MemoryCommon.cpp:198:7: warning: consider replacing 'unsigned long long' with 'uint64' [google-runtime-int]
  198 |       unsigned long long input = 0;
      |       ^
/w/dolphin-memory-engine/Source/Common/MemoryCommon.cpp:234:7: warning: consider replacing 'unsigned long long' with 'uint64' [google-runtime-int]
  234 |       unsigned long long input = 0;
      |       ^
/w/dolphin-memory-engine/Source/Common/MemoryCommon.cpp:272:9: warning: consider replacing 'unsigned long long' with 'uint64' [google-runtime-int]
  272 |         unsigned long long input = 0;
      |         ^
/w/dolphin-memory-engine/Source/Common/MemoryCommon.cpp:325:9: warning: consider replacing 'unsigned long long' with 'uint64' [google-runtime-int]
  325 |         unsigned long long input = 0;
      |         ^
```
The warnings were:

```
/w/dolphin-memory-engine/Source/DolphinProcess/IDolphinProcess.h:13:11: warning: use '= default' to define a trivial destructor [hicpp-use-equals-default]
   13 |   virtual ~IDolphinProcess() {}
      |           ^                  ~~
      |                              = default;
/w/dolphin-memory-engine/Source/DolphinProcess/Linux/LinuxDolphinProcess.h:16:3: warning: use '= default' to define a trivial default constructor [hicpp-use-equals-default]
   16 |   LinuxDolphinProcess() {}
      |   ^                     ~~
      |                         = default;
/w/dolphin-memory-engine/Source/GUI/MemScanner/ResultsListModel.cpp:8:19: warning: use '= default' to define a trivial destructor [hicpp-use-equals-default]
    8 | ResultsListModel::~ResultsListModel()
      |                   ^
    9 | {
      | ~
      | = default;
   10 | }
      | ~
```
The one warning was:

```
/w/dolphin-memory-engine/Source/GUI/MemWatcher/Dialogs/DlgAddWatchEntry.cpp:188:22: warning: use nullptr [hicpp-use-nullptr]
  188 |   txbOffset->setText(0);
      |                      ^
      |                      nullptr
```

`0`, which was equivalent to `nullptr`, was being used to implicitly
construct an empty `QString` that was then passed to `setText()`, which
would do nothing.
The one warning was:

```
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.h:116:19: warning: both sides of operator are equivalent [misc-redundant-expression]
  116 |     if (firstByte != firstByte)
      |                   ^
```
The warnings were:

```
/w/dolphin-memory-engine/Source/Common/MemoryCommon.cpp:165:14: warning: catch handler catches by value; should catch by reference instead [misc-throw-by-value-catch-by-reference]
  165 |       catch (std::invalid_argument)
      |              ^
/w/dolphin-memory-engine/Source/Common/MemoryCommon.cpp:203:14: warning: catch handler catches by value; should catch by reference instead [misc-throw-by-value-catch-by-reference]
  203 |       catch (std::invalid_argument)
      |              ^
/w/dolphin-memory-engine/Source/Common/MemoryCommon.cpp:239:14: warning: catch handler catches by value; should catch by reference instead [misc-throw-by-value-catch-by-reference]
  239 |       catch (std::invalid_argument)
      |              ^
```
The one warning was:

```
/w/dolphin-memory-engine/Source/MemoryWatch/MemWatchTreeNode.cpp:10:56: warning: pass by value and use std::move [modernize-pass-by-value]
    6 |
    7 | #include "../GUI/GUICommon.h"
    8 |
    9 | MemWatchTreeNode::MemWatchTreeNode(MemWatchEntry* entry, MemWatchTreeNode* parent,
   10 |                                    const bool isGroup, const QString& groupName)
      |                                                        ^~~~~~~~~~~~~~
      |                                                        QString
   11 |     : m_entry(entry), m_parent(parent), m_isGroup(isGroup), m_groupName(groupName)
      |
      |                                                                         std::move( )
```
The warnings were:

```
/w/dolphin-memory-engine/Source/Common/CommonTypes.h:5:1: warning: use 'using' instead of 'typedef' [modernize-use-using]
    5 | typedef uint64_t u64;
      | ^~~~~~~~~~~~~~~~~~~~
      | using u64 = uint64_t
/w/dolphin-memory-engine/Source/Common/CommonTypes.h:6:1: warning: use 'using' instead of 'typedef' [modernize-use-using]
    6 | typedef uint32_t u32;
      | ^~~~~~~~~~~~~~~~~~~~
      | using u32 = uint32_t
/w/dolphin-memory-engine/Source/Common/CommonTypes.h:7:1: warning: use 'using' instead of 'typedef' [modernize-use-using]
    7 | typedef uint16_t u16;
      | ^~~~~~~~~~~~~~~~~~~~
      | using u16 = uint16_t
/w/dolphin-memory-engine/Source/Common/CommonTypes.h:8:1: warning: use 'using' instead of 'typedef' [modernize-use-using]
    8 | typedef uint8_t u8;
      | ^~~~~~~~~~~~~~~~~~
      | using u8 = uint8_t
/w/dolphin-memory-engine/Source/Common/CommonTypes.h:10:1: warning: use 'using' instead of 'typedef' [modernize-use-using]
   10 | typedef int64_t s64;
      | ^~~~~~~~~~~~~~~~~~~
      | using s64 = int64_t
/w/dolphin-memory-engine/Source/Common/CommonTypes.h:11:1: warning: use 'using' instead of 'typedef' [modernize-use-using]
   11 | typedef int32_t s32;
      | ^~~~~~~~~~~~~~~~~~~
      | using s32 = int32_t
/w/dolphin-memory-engine/Source/Common/CommonTypes.h:12:1: warning: use 'using' instead of 'typedef' [modernize-use-using]
   12 | typedef int16_t s16;
      | ^~~~~~~~~~~~~~~~~~~
      | using s16 = int16_t
/w/dolphin-memory-engine/Source/Common/CommonTypes.h:13:1: warning: use 'using' instead of 'typedef' [modernize-use-using]
   13 | typedef int8_t s8;
      | ^~~~~~~~~~~~~~~~~
      | using s8 = int8_t
```
The one warning was:

```
/w/dolphin-memory-engine/Source/DolphinProcess/Linux/LinuxDolphinProcess.cpp:39:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
   39 |     for (auto str : lineData)
      |               ^
      |          const  &
```
The warnings were:

```
/w/dolphin-memory-engine/Source/Common/MemoryCommon.cpp:127:46: warning: the const qualified parameter 'inputString' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]
  127 |                            const std::string inputString, const MemBase base, const MemType type,
      |                                              ^
      |                                             &
/w/dolphin-memory-engine/Source/GUI/MemCopy/DlgCopy.cpp:180:42: warning: the parameter 'str' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
  180 | bool DlgCopy::hexStringToU32(std::string str, u32& output)
      |                                          ^
      |                              const      &
/w/dolphin-memory-engine/Source/GUI/MemCopy/DlgCopy.cpp:197:51: warning: the parameter 'str' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
  197 | bool DlgCopy::isUnsignedIntegerString(std::string str)
      |                                                   ^
      |                                       const      &
/w/dolphin-memory-engine/Source/GUI/MemCopy/DlgCopy.cpp:210:43: warning: the parameter 'str' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
  210 | bool DlgCopy::uintStringToU32(std::string str, u32& output)
      |                                           ^
      |                               const      &
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:400:72: warning: the const qualified parameter 'nodes' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]
  400 | MemWatchModel::getLeastDeepNodeFromList(const QList<MemWatchTreeNode*> nodes) const
      |                                                                        ^
      |                                                                       &
/w/dolphin-memory-engine/Source/MemoryWatch/MemWatchEntry.cpp:13:44: warning: the const qualified parameter 'label' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]
   13 | MemWatchEntry::MemWatchEntry(const QString label, const u32 consoleAddress,
      |                                            ^
      |                                           &
/w/dolphin-memory-engine/Source/MemoryWatch/MemWatchTreeNode.cpp:86:16: warning: parameter 'children' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]
    6 |   m_children = children;
      |                ^
      |                std::move( )
```
The one warning was:

```
/w/dolphin-memory-engine/Source/Common/MemoryCommon.cpp:130:7: warning: the 'empty' method should be used to check for emptiness instead of 'length' [readability-container-size-empty]
  130 |   if (inputString.length() == 0)
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~
      |       inputString.empty()
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/basic_string.h:1191:7: note: method 'basic_string'::empty() defined here
 1191 |       empty() const _GLIBCXX_NOEXCEPT
      |       ^
```
The warnings were:

```
/w/dolphin-memory-engine/Source/CheatEngineParser/CheatEngineParser.cpp:365:28: warning: method 'formatImportedEntryBasicInfo' can be made static [readability-convert-member-functions-to-static]
  365 | QString CheatEngineParser::formatImportedEntryBasicInfo(const MemWatchEntry* entry) const
      |                            ^                                                        ~~~~~
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:95:31: warning: method 'getEntryFromIndex' can be made static [readability-convert-member-functions-to-static]
   95 | MemWatchEntry* MemWatchModel::getEntryFromIndex(const QModelIndex& index) const
      |                               ^                                           ~~~~~
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:625:24: warning: method 'getAddressString' can be made static [readability-convert-member-functions-to-static]
  625 | QString MemWatchModel::getAddressString(const MemWatchEntry* entry) const
      |                        ^                                            ~~~~~
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:688:34: warning: method 'getTreeNodeFromIndex' can be made static [readability-convert-member-functions-to-static]
  688 | MemWatchTreeNode* MemWatchModel::getTreeNodeFromIndex(const QModelIndex& index) const
      |                                  ^                                              ~~~~~
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.cpp:476:17: warning: method 'getTermsNumForFilter' can be made static [readability-convert-member-functions-to-static]
  476 | int MemScanner::getTermsNumForFilter(const MemScanner::ScanFiter filter) const
      |                 ^                                                        ~~~~~
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.cpp:488:18: warning: method 'typeSupportsAdditionalOptions' can be made static [readability-convert-member-functions-to-static]
  488 | bool MemScanner::typeSupportsAdditionalOptions(const Common::MemType type) const
      |                  ^                                                         ~~~~~
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.cpp:526:25: warning: method 'addSpacesToBytesArrays' can be made static [readability-convert-member-functions-to-static]
  526 | std::string MemScanner::addSpacesToBytesArrays(const std::string& bytesArray) const
      |                         ^                                                     ~~~~~
```
The warnings were:

```
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.h:132:8: warning: function 'MemScanner::setSearchRangeBegin' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]
    132 |   bool setSearchRangeBegin(u32 beginIndex);
        |        ^
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.cpp:446:18: note: the definition seen here
    446 | bool MemScanner::setSearchRangeBegin(u32 beginRange)
        |                  ^
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.h:132:8: note: differing parameters are named here: ('beginIndex'), in definition: ('beginRange')
    132 |   bool setSearchRangeBegin(u32 beginIndex);
        |        ^                       ~~~~~~~~~~
        |                                beginRange
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.h:133:8: warning: function 'MemScanner::setSearchRangeEnd' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]
    133 |   bool setSearchRangeEnd(u32 endIndex);
        |        ^
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.cpp:461:18: note: the definition seen here
    461 | bool MemScanner::setSearchRangeEnd(u32 endRange)
        |                  ^
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.h:133:8: note: differing parameters are named here: ('endIndex'), in definition: ('endRange')
    133 |   bool setSearchRangeEnd(u32 endIndex);
        |        ^                     ~~~~~~~~
        |                              endRange
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.h:134:8: warning: function 'MemScanner::setSearchRange' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]
    134 |   bool setSearchRange(u32 beginIndex, u32 endIndex);
        |        ^
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.cpp:428:18: note: the definition seen here
    428 | bool MemScanner::setSearchRange(u32 beginRange, u32 endRange)
        |                  ^
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.h:134:8: note: differing parameters are named here: ('beginIndex', 'endIndex'), in definition: ('beginRange', 'endRange')
    134 |   bool setSearchRange(u32 beginIndex, u32 endIndex);
        |        ^                  ~~~~~~~~~~      ~~~~~~~~
        |                           beginRange      endRange
```
The one warning was:
```
/w/dolphin-memory-engine/Source/GUI/MemCopy/DlgCopy.cpp:225:44: warning: pointer parameter 'input' can be pointer to const [readability-non-const-parameter]
  225 | std::string DlgCopy::charToHexString(char* input, size_t count, DlgCopy::ByteStringFormats format)
      |                                            ^
      |                                      const
```
The warnings were:

```
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:60:10: warning: 'auto i' can be declared as 'auto *i' [readability-qualified-auto]
   60 |     for (auto i : children)
      |          ^~~~
      |          auto *
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:84:10: warning: 'auto i' can be declared as 'auto *i' [readability-qualified-auto]
   84 |     for (auto i : children)
      |          ^~~~
      |          auto *
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:424:8: warning: 'auto i' can be declared as 'auto *i' [readability-qualified-auto]
  424 |   for (auto i : nodes)
      |        ^~~~
      |        auto *
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchModel.cpp:634:8: warning: 'auto i' can be declared as 'auto *i' [readability-qualified-auto]
  634 |   for (auto i : parent->getChildren())
      |        ^~~~
      |        auto *
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchWidget.cpp:348:10: warning: 'auto i' can be declared as 'auto *i' [readability-qualified-auto]
  348 |     for (auto i : copiedRootNode->getChildren())
      |          ^~~~
      |          auto *
/w/dolphin-memory-engine/Source/MemoryWatch/MemWatchTreeNode.cpp:193:10: warning: 'auto i' can be declared as 'auto *i' [readability-qualified-auto]
  193 |     for (auto i : m_children)
      |          ^~~~
      |          auto *
/w/dolphin-memory-engine/Source/MemoryWatch/MemWatchTreeNode.cpp:206:12: warning: 'auto i' can be declared as 'auto *i' [readability-qualified-auto]
  206 |       for (auto i : m_children)
      |            ^~~~
      |            auto *
/w/dolphin-memory-engine/Source/MemoryWatch/MemWatchTreeNode.cpp:247:10: warning: 'auto i' can be declared as 'auto *i' [readability-qualified-auto]
  247 |     for (auto i : m_children)
      |          ^~~~
      |          auto *
```
The warnings were:

```
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.h:53:3: warning: function 'convertMemoryToType' has inline specifier but is implicitly inlined [readability-redundant-inline-specifier]
   53 |   inline T convertMemoryToType(const char* memory, bool invert) const
      |   ^~~~~~
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.h:63:3: warning: function 'compareMemoryAsNumbersWithType' has inline specifier but is implicitly inlined [readability-redundant-inline-specifier]
   63 |   inline CompareResult compareMemoryAsNumbersWithType(const char* first, const char* second,
      |   ^~~~~~
```
The one warning was:

```
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.cpp:30:28: warning: initializer for member 'm_resultsConsoleAddr' is redundant [readability-redundant-member-init]
   30 | MemScanner::MemScanner() : m_resultsConsoleAddr(std::vector<u32>())
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
The warnings were:

```
/w/dolphin-memory-engine/Source/GUI/MemCopy/DlgCopy.cpp:230:15: warning: redundant string initialization [readability-redundant-string-init]
  230 |   std::string beforeAll = "";
      |               ^~~~~~~~~~~~~~
      |               beforeAll
/w/dolphin-memory-engine/Source/GUI/MemCopy/DlgCopy.cpp:231:15: warning: redundant string initialization [readability-redundant-string-init]
  231 |   std::string beforeByte = "";
      |               ^~~~~~~~~~~~~~~
      |               beforeByte
/w/dolphin-memory-engine/Source/GUI/MemCopy/DlgCopy.cpp:232:15: warning: redundant string initialization [readability-redundant-string-init]
  232 |   std::string betweenBytes = "";
      |               ^~~~~~~~~~~~~~~~~
      |               betweenBytes
/w/dolphin-memory-engine/Source/GUI/MemCopy/DlgCopy.cpp:233:15: warning: redundant string initialization [readability-redundant-string-init]
  233 |   std::string afterAll = "";
      |               ^~~~~~~~~~~~~
      |               afterAll
```
The warnings were:

```
/w/dolphin-memory-engine/Source/GUI/MemCopy/DlgCopy.cpp:169:3: warning: replace loop by 'std::ranges::all_of()' [readability-use-anyofallof]
  169 |   for (char c : str)
      |   ^
/w/dolphin-memory-engine/Source/GUI/MemCopy/DlgCopy.cpp:200:3: warning: replace loop by 'std::ranges::all_of()' [readability-use-anyofallof]
  200 |   for (char c : str)
      |   ^
```
@cristian64
Copy link
Collaborator Author

Discovered the hard way that std::bit_cast is not available in the C++20 feature subset that GCC 10 implements. I am on GCC 11 in my system, so I didn't notice. A hand-rolled implementation has been added; checks are now passing.

@dreamsyntax
Copy link
Collaborator

dreamsyntax commented May 4, 2024

Do you have a preference on if this is squashed into one commit on merge, or prefer them rebased onto the repo as is?

image

@cristian64
Copy link
Collaborator Author

My preference is to rebase and merge without squashing (it'd be a pity to lose the info I put in the description in each of the commits).

@dreamsyntax dreamsyntax merged commit ae32ba2 into aldelaro5:master May 5, 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