Skip to content

Conversation

@lrusak
Copy link
Contributor

@lrusak lrusak commented Jun 13, 2024

The call to std::remove also requires using std::vector::erase

see: https://en.cppreference.com/w/cpp/algorithm/remove

This fixes the following warning:

/home/lukas/Documents/git/Gridcoin-Research/src/rpc/server.cpp:935:20: warning: ignoring return value of ‘_FIter std::remove(_FIter, _FIter, const _Tp&) [with _FIter = __gnu_cxx::__normal_iterator<__cxx11::basic_string<char>*, vector<__cxx11::basic_string<char> > >; _Tp = const char*]’, declared with attribute ‘nodiscard’ [-Wunused-result]
  935 |         std::remove(commandList.begin(), commandList.end(), command);
      |         ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/span.h:10,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/uint256.h:10,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/consensus/params.h:9,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/chainparams.h:10,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/main.h:10,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/consensus/tx_verify.h:8,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/wallet/wallet.h:16,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/init.h:9,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/rpc/server.cpp:7:
/usr/include/c++/14/bits/stl_algo.h:788:5: note: declared here
  788 |     remove(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~

The call to std::remove also requires using std::vector::erase

This fixes the following warning:

/home/lukas/Documents/git/Gridcoin-Research/src/rpc/server.cpp:935:20: warning: ignoring return value of ‘_FIter std::remove(_FIter, _FIter, const _Tp&) [with _FIter = __gnu_cxx::__normal_iterator<__cxx11::basic_string<char>*, vector<__cxx11::basic_string<char> > >; _Tp = const char*]’, declared with attribute ‘nodiscard’ [-Wunused-result]
  935 |         std::remove(commandList.begin(), commandList.end(), command);
      |         ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/span.h:10,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/uint256.h:10,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/consensus/params.h:9,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/chainparams.h:10,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/main.h:10,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/consensus/tx_verify.h:8,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/wallet/wallet.h:16,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/init.h:9,
                 from /home/lukas/Documents/git/Gridcoin-Research/src/rpc/server.cpp:7:
/usr/include/c++/14/bits/stl_algo.h:788:5: note: declared here
  788 |     remove(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~

Signed-off-by: Lukas Rusak <[email protected]>
@jamescowens jamescowens self-requested a review June 16, 2024 20:00
@jamescowens jamescowens added this to the Natasha milestone Jun 16, 2024
Copy link
Member

@jamescowens jamescowens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@jamescowens jamescowens merged commit 5644af6 into gridcoin-community:development Jun 16, 2024
wilkart pushed a commit to wilkart/Gridcoin-Research that referenced this pull request Jun 29, 2024
rpc/server: fix removing deprecated commands from command list
jamescowens added a commit that referenced this pull request Feb 16, 2025
Added
 - depends: add cross arm64-darwin support #2775 (@div72)
 - build: add missing randomness checks #2772 (@div72)
 - init, registry: Support -clearallregistryhistory startup parameter #2773 (@jamescowens)

Changed
 - build: omit _FORTIFY_SOURCE on debug #2793 (@div72)
 - doc: cmake is required for Windows depends #2791 (@barton2526)
 - CMake: Set maximum supported Boost version #2788 (@CyberTailor)
 - ci: bump to MacOS 13 #2784 (@div72)
 - build/cmake: disable LevelDB tests #2776 (@div72)
 - util: use XDG_STATE_HOME for datadir on Flatpak #2774 (@div72)
 - util, build: Support miniupnp API version 18+ #2771 (@jamescowens)
 - build: explicitly include FindPkgConfig for CMake #2769 (@jamescowens)
 - ci, cd: bump action versions #2763 (@div72)
 - Sync CMake CI #2762 (@CyberTailor)
 - cpid: Modify CPID local hasher to eliminate compiler warnings on 32 bit archs #2760 (@jamescowens)

Removed
 - refactor, misc: remove CBitcoin(Address|Secret) #2634 (@div72)

Fixed
 - poll, gui: Disable choice add button in poll wizard when choice limit is reached #2792 (@jamescowens)
 - diagnose, rpc: fix compilation with boost 1.87 #2786 (@div72)
 - node: fix build with GCC 15 #2783 (@CyberTailor)
 - ci: use overwrite with brew install on MacOS CMake #2782 (@div72)
 - scraper: Protect access to ConvergedStats.csv.gz with a lock #2779 (@jamescowens)
 - fix build on FreeBSD #2770 (@wilkart)
 - rpc/server: fix removing deprecated commands from command list #2768 (@lrusak)
 - cmake bdb53: disable error for implicit-int with gcc #2767 (@lrusak)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants