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 build with clang19 #895

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libraries/libfc/include/fc/io/datastream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ class datastream<Streambuf, typename std::enable_if_t<std::is_base_of_v<std::str

size_t read(char* data, size_t n) { return buf.sgetn(data, n); }
size_t write(const char* data, size_t n) { return buf.sputn(data, n); }
size_t tellp() { return this->pubseekoff(0, std::ios::cur); }
bool skip(size_t p) { this->pubseekoff(p, std::ios::cur); return true; }
size_t tellp() { return buf.pubseekoff(0, std::ios::cur); }
bool skip(size_t p) { buf.pubseekoff(p, std::ios::cur); return true; }
Copy link
Member Author

Choose a reason for hiding this comment

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

This is wild how it was never detected before.

Copy link
Contributor

@greg7mdp greg7mdp Oct 4, 2024

Choose a reason for hiding this comment

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

Probably because we never create a datastream with a class inheriting from std::streambuf.

Also, I believe that the way we use enable_if_t here is wrong, see the notes here. actually, on second thought, maybe it is fine.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah I was a little worried the reason it was being flagged now was because something with the enable_if is goofed up and this was now being improperly selected.. but I couldn't find evidence of that actually occurring.

bool get(char& c) {
c = buf.sbumpc();
return true;
Expand Down
6 changes: 3 additions & 3 deletions tests/ship_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ BOOST_DATA_TEST_CASE(non_prune_to_prune, bdata::xrange(2) * bdata::xrange(2), en

//upgrade to pruned...
t.conf = eosio::state_history::prune_config{ .prune_blocks = 4 };
t.template check_n_bounce([]() {});
t.check_n_bounce([]() {});
Copy link
Member Author

Choose a reason for hiding this comment

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

For these, clang19 is more strict: these function calls need to be formatted as template foo<>(). But in all cases here we didn't need the template anyways.


t.check_n_bounce([&]() {
t.check_range_present(6, 9);
Expand Down Expand Up @@ -410,7 +410,7 @@ BOOST_DATA_TEST_CASE(prune_to_non_prune, bdata::xrange(2) * bdata::xrange(2), en

//no more pruned
t.conf = std::monostate{};
t.template check_n_bounce([]() {});
t.check_n_bounce([]() {});

t.check_n_bounce([&]() {
t.check_range_present(6, 9);
Expand Down Expand Up @@ -450,7 +450,7 @@ BOOST_DATA_TEST_CASE(prune_to_partitioned, bdata::xrange(2) * bdata::xrange(2),
.stride = 5
};

t.template check_n_bounce([]() {});
t.check_n_bounce([]() {});

t.check_n_bounce([&]() {
t.check_range_present(6, 9);
Expand Down
4 changes: 2 additions & 2 deletions unittests/auth_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( update_auths, TESTER, validating_testers ) { try
BOOST_TEST(trading->name == name("trading"));
BOOST_TEST(spending->name == name("spending"));
BOOST_TEST(spending->parent == trading->id);
BOOST_TEST(chain.template get(trading->parent).owner == name("alice"));
BOOST_TEST(chain.template get(trading->parent).name == name("active"));
BOOST_TEST(chain.get(trading->parent).owner == name("alice"));
BOOST_TEST(chain.get(trading->parent).name == name("active"));

}

Expand Down