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 warning preventing compilation with gcc 8.2.0 #6

Open
wants to merge 2 commits into
base: master
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
11 changes: 5 additions & 6 deletions include/yaml-cpp/emitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,12 @@ inline Emitter& Emitter::WriteStreamable(T value) {
std::isnan(value)) {
special = true;
stream << ".nan";
} else if (std::numeric_limits<T>::has_infinity) {
if (value == std::numeric_limits<T>::infinity()) {
special = true;
stream << ".inf";
} else if (value == -std::numeric_limits<T>::infinity()) {
special = true;
} else if (std::numeric_limits<T>::has_infinity && std::isinf(value)) {
special = true;
if (std::signbit(value)) {
stream << "-.inf";
} else {
stream << ".inf";
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions include/yaml-cpp/node/detail/impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ inline node* node_data::get(const Key& key,
return pNode;
return NULL;
case NodeType::Scalar:
default:
throw BadSubscript(key);
}

Expand Down Expand Up @@ -143,6 +144,7 @@ inline node& node_data::get(const Key& key, shared_memory_holder pMemory) {
convert_to_map(pMemory);
break;
case NodeType::Scalar:
default:
throw BadSubscript(key);
}

Expand Down
6 changes: 6 additions & 0 deletions include/yaml-cpp/node/detail/node_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ class node_iterator_base
return m_seqIt == rhs.m_seqIt;
case iterator_type::Map:
return m_mapIt == rhs.m_mapIt;
default:
break;
}
return true;
}
Expand All @@ -131,6 +133,8 @@ class node_iterator_base
++m_mapIt;
m_mapIt = increment_until_defined(m_mapIt);
break;
default:
break;
}
return *this;
}
Expand All @@ -149,6 +153,8 @@ class node_iterator_base
return value_type(**m_seqIt);
case iterator_type::Map:
return value_type(*m_mapIt->first, *m_mapIt->second);
default:
break;
}
return value_type();
}
Expand Down