Apply formatting/style tweaks to comply with compile time diagnostics for g++ and clang++ (#686)

* Add compilation flags: -Wshadow -Weffc++ -pedantic -pedantic-errors
* Delete implicit copy & move constructors & assignment operators
  in classes with pointer data members.
* An exception to the above: Add default copy & move constructors &
  assignment operators for the Binary class.
* Convert boolean RegEx operators to binary operators.
* Initialize all members in all classes in ctors.
* Let default ctor delegate to the converting ctor in
  Binary and RegEx
* Don't change any tests except regex_test (as a result of the change
  to binary operators).

Note: https://bugzilla.redhat.com/show_bug.cgi?id=1544675 makes
-Weffc++ report a false positive in "include/yaml-cpp/node/impl.h".
This commit is contained in:
Ted Lyngmo
2019-03-13 23:18:34 +01:00
committed by Jesse Beder
parent eca9cfd648
commit 0d5c57150c
40 changed files with 285 additions and 241 deletions

View File

@@ -7,7 +7,6 @@
#pragma once
#endif
#include "yaml-cpp/noncopyable.h"
#include <cstddef>
namespace YAML {
@@ -16,6 +15,9 @@ class StreamCharSource {
StreamCharSource(const Stream& stream) : m_offset(0), m_stream(stream) {}
StreamCharSource(const StreamCharSource& source)
: m_offset(source.m_offset), m_stream(source.m_stream) {}
StreamCharSource(StreamCharSource&&) = default;
StreamCharSource& operator=(const StreamCharSource&) = delete;
StreamCharSource& operator=(StreamCharSource&&) = delete;
~StreamCharSource() {}
operator bool() const;
@@ -27,8 +29,6 @@ class StreamCharSource {
private:
std::size_t m_offset;
const Stream& m_stream;
StreamCharSource& operator=(const StreamCharSource&); // non-assignable
};
inline StreamCharSource::operator bool() const {
@@ -43,6 +43,6 @@ inline const StreamCharSource StreamCharSource::operator+(int i) const {
source.m_offset = 0;
return source;
}
}
} // namespace YAML
#endif // STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66