This reverts commit 1f5e971f77.
See #1306; the previous commit caused an error with -Wpedantic:
yaml-cpp/include/yaml-cpp/emitterstyle.h:13:2: error: extra ‘;’ [-Wpedantic]
Since the original commit was to resolve warnings, reverting and the OP can produce a new one that fixes this issue.
This reverts commit 6262201182.
in 62622011, we wanted address the needs to use the `string_view`
converter in C++98, but that requirement was based on wrong
preconditions. `std::string_view` was introduced in C++17, and
popular standard libraries like libstdc++ and libc++ both provide
`std::string_view` when the source is built with C++17.
furthermore 62622011 is buggy. because it uses `<version>` to tell
the feature set provided by the standard library. but `<version>`
is a part of C++20. so this defeats the purpose of the change of
62622011.
Fixes#1223
1) A new macro YAML_CPP_NORETURN to annotate functions as not returning in dll.h
2) A new function YAML_throw<ExceptionType>(args...) in exception.h
this function will throw an exception unless exceptions are disabled in the compiler,
detected by checking the pre-defined macro __cpp_exceptions
In this case the exception class will be instantiated, and the user-provided function
YAML::handle_exception(const char*) will be called on the exception's what() method
3) if exceptions are disabled,and the library's user does not provide YAML::handle_exception,
there will be a linker error
4) all other files have been changed automatedly by running the following sed commands
sed -i "s/throw \([A-Za-z]*\)(\(.*\))/YAML_throw<\1>(\2)/g" # throw statements for non-templated exceptions
sed -i "s/throw \(.*\)<\(.*\)>(/YAML_throw<\1<\2> >(/g" # throw statements for templated exceptions
On Oracle Solaris the following statement is declared in file /usr/include/sys/regset.h:
#define SS 18 /* only stored on a privilege transition */
Because of this template type name SS is substituted by numeric literal, which results in a compilation error:
error: expected nested-name-specifier before numeric constant
Fixed by renaming template type names.
Co-authored-by: Roman Degtyar <Roman.Degtyar@veeam.com>
* Export YAML::detail::node::m_amount
The internal header node/detail/node.h is included by public headers;
YAML::detail::node is implemented in the header itself, and thus it gets
inlined... except for its static m_amount class member, which is
instantiated in the library only. Right now all the symbols of yaml-cpp
are exported (nothing is hidden), so the linker will find node::m_amount
in the yaml-cpp library.
As solution/workaround, explicitly export YAML::detail::node::m_amount.
* CMake: use GenerateExportHeader
Make use of the GenerateExportHeader CMake module to generate the dll.h
header with export macros.
While the produced dll.h is different, the result should be the same,
i.e. nothing changes for yaml-cpp or its users.
* CMake: hide all the symbols by default
Hide all the symbols that are not explicitly exported with YAML_CPP_API.
This way the ABI will be way smaller, and only actually exposing the
public classes/functions.
- Don't eagerly convert key to std::string
- Make const char* keys streamable when exception is thrown
- Don't create a temporary string when comparing a const char* key
For completeness I've implemented escaping for characters outside the
basic multilingual plane, but it doesn't get used (as there's no
EscapeAsAsciiJson emitter option implemented).
* partially fix clang compilation
Missing header and mistaken algorithm usage.
Also removed it name from range loops. It's not correct.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
* run through clang's -Wrange-loop-analysis
Some range loops should not use references as they need to copy.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
* manual range loop conversions
Signed-off-by: Rosen Penev <rosenp@gmail.com>