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 compilation errors with Clang v16+. Also includes fixes for compiling with -std=c++23. #498

Merged
merged 1 commit into from
May 1, 2024

Conversation

bdutro
Copy link
Contributor

@bdutro bdutro commented Apr 30, 2024

This PR fixes compilation errors I observed trying to compile with clang v16 and v17, as well as some errors from bumping the C++ standard to C++23.

@bdutro bdutro requested a review from klingaard April 30, 2024 18:24
@@ -187,7 +187,7 @@ namespace sparta::pipeViewer
if(!dat.stringVector[i].empty()){
// We check if we have seen this exact pair, field and value before or not.
if(const auto& [val, str] = std::tie(dat.valueVector[i].first, dat.stringVector[i]);
stringMap.try_emplace(std::make_tuple(dat.pairId, i, val), str).second) {
stringMap.emplace(std::piecewise_construct, std::forward_as_tuple(dat.pairId, i, val), std::forward_as_tuple(str)).second) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Workaround for a Clang bug: llvm/llvm-project#61415

This is essentially what try_emplace does under the hood, so performance shouldn't be affected.

@@ -95,7 +95,7 @@ namespace sparta
*/
struct DataPointer {
private:
typename std::aligned_storage<sizeof(value_type), alignof(value_type)>::type object_memory_;
alignas(value_type) std::byte object_memory_[sizeof(value_type)];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -27,56 +27,56 @@
/*!
* \brief Custom literal for uint64
*/
constexpr inline uint64_t operator "" _u64(unsigned long long i) {
constexpr inline uint64_t operator ""_u64(unsigned long long i) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Clang throws a compiler error if there is a space between the "" and the _

Comment on lines +199 to +207
ArchiveNode::ArchiveNode(const std::string & name) :
name_(name)
{
}

ArchiveNode::~ArchiveNode()
{
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moving these to the .cpp file helps avoid some pitfalls when you use an incomplete type with a smart pointer.

Copy link
Member

Choose a reason for hiding this comment

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

Nice cleanup!

@bdutro bdutro merged commit a0d7ca4 into master May 1, 2024
8 checks passed
@bdutro bdutro deleted the dev/bdutro/latest-clang-fixes branch May 1, 2024 22:16
github-actions bot pushed a commit that referenced this pull request May 1, 2024
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