Commit Graph

364 Commits

Author SHA1 Message Date
NameSirius
06c3d1db51 fix compile warning(Pull requests #1305)(Issues #1306) 2024-08-06 10:39:36 -05:00
Jesse Beder
04dddd6999 Revert "Fix compile warning with -Wshadow"
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.
2024-08-05 15:50:36 -05:00
NameSirius
1f5e971f77 Fix compile warning with -Wshadow 2024-08-05 09:50:21 -05:00
Simon Gene Gottlieb
b95aa146ec fix: use C locale by default 2024-07-17 13:39:30 -05:00
Jason Beach
96f5c887f3 assign fallback value 2024-01-26 13:28:55 -06:00
Levi Armstrong
94710bb221 Add default destructor to EmitFromEvents 2023-12-28 10:44:52 -06:00
FireWolf
d046eea331 node/convert: Enable the template specialization for std::string_view properly when the library is compiled by MSVC on Windows. (#1227) 2023-09-17 11:58:31 -04:00
Kefu Chai
2383e6d0f2 Revert "node/convert: relax the check for string_view (#1222)" (#1225)
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
2023-09-10 08:28:52 -04:00
Kefu Chai
6262201182 node/convert: relax the check for string_view (#1222) 2023-09-06 07:57:12 -05:00
Kefu Chai
35b4498026 node/convert: support conversion for std::string_view (#1148) 2023-07-24 14:51:05 -05:00
sfalmo
4ae4cb7309 Support conversion for std::valarray (#956) 2022-09-20 00:31:51 -05:00
rdzehtsiar
763b7d6c70 Fix compilation errors in build for Oracle Solaris OS (#1133)
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>
2022-09-20 00:04:18 -05:00
Igor [hyperxor]
190ad502b5 Remove redundant include (#1110) 2022-05-21 07:20:18 -05:00
Sam4uk
26e3b70407 Update old style cast from (T) to static_cast<T>. 2022-02-08 16:06:36 -06:00
Chen
bce601f2bf Support the conversion for std::unordered_map (#932) 2022-01-05 18:12:40 -06:00
Pavel Karelin
2b65c65e1b Partially revert commit 0733aeb4 to make dll.h a non-generated file (#1064)
Partial revert of "Revert "Revert "Hide most of non-public symbols by default (#984)" (#1038)" (#1045)"

This reverts commit 0733aeb451.
2021-11-22 22:40:08 -06:00
PhilipDeegan
4564d9a131 github actions for mac/linux/windows (#1056) 2021-10-31 11:59:40 -05:00
Pino Toscano
0733aeb451 Revert "Revert "Hide most of non-public symbols by default (#984)" (#1038)" (#1045) 2021-10-09 21:48:05 -05:00
Jesse Beder
0d9dbcfe8c Revert "Hide most of non-public symbols by default (#984)" (#1038)
This reverts commit da1c8d360e. and fixes #1036.
2021-09-28 08:41:55 -05:00
Pino Toscano
da1c8d360e Hide most of non-public symbols by default (#984)
* 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.
2021-09-25 12:10:58 -05:00
Snow Pettersen
db6deedcd3 Include name of anchor in invalid anchor error (#1015) 2021-07-23 14:52:21 -05:00
mjvankampen
79aa6d53e5 Add assert to enable compilation with libcxx + gcc (#947) 2021-07-15 16:09:05 -05:00
JBPennington
b591d8ae2a Update node impl.h for GCC unused variable warning (#981)
Removed the variable name in the defaulted function to make GCC happy.
2021-07-10 11:07:12 -05:00
t.t
a6bbe0e50a fix warning of level 4: (#971)
convert.h line130 : warning C4244 conversation from int to T possible loss of data
2021-01-05 07:40:28 -06:00
Kajetan Świerk
bc9874c9ff Reduce std::string copies (#924)
- 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
2020-07-23 08:47:21 -05:00
Kajetan Świerk
06b99f53db Default initialize node's member variable (#923) 2020-07-18 19:34:46 -05:00
Chen
33315286ab Add the support to parsing a null value as std::string.
Fixes #590.
2020-07-16 09:15:39 -05:00
Pavel Karelin
4571e8177a Fix compilation for Qt-projects (#918)
Not use 'emit' as variable name, in Qt Framework it reserved word
2020-07-14 07:44:08 -05:00
Oliver Hamlet
c82d3129dd Add support for JSON-compatible string escapes (#485)
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).
2020-07-13 21:16:34 -05:00
Chen
6d5cfab5fd fix bug from issue298:Emitter stylings settings overridden by node settings. (#915) 2020-07-06 08:16:38 -05:00
Chen
08aa252611 Support kinds of emitter format-setting for YAML::Null. (#906)
* Support kinds of emitter format-setting for YAML::Null.

* update the code and test cases

* add the comment //fallthrough
2020-06-28 23:31:53 -05:00
Dekken
27d8a0e302 Refactor to allow MSVC without #define NOMINMAX (#905) 2020-06-27 20:28:24 -05:00
Dekken
97d1ae547c rm unusued typedef (#901) 2020-06-21 07:58:16 -05:00
Rosen Penev
0b0bf35c48 [clang-tidy] convert several functions to use references (#894)
Found with performance-unnecessary-value-param

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-15 17:34:27 -05:00
Rosen Penev
b2cd008717 partially fix clang compilation (#893)
* 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>
2020-06-15 16:59:27 -05:00
Rosen Penev
41001d1bf9 manual algorithm conversions (#891)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-15 15:10:09 -05:00
Chen
4dbfeb0bbc Support as<uint8_t>/as<int8_t>.
Fix issue 844/848.
2020-06-15 10:31:59 -05:00
Chen
d9c35b6079 Throw an exception when trying to parse a negative number as an unsigned.
Fixing issue 859.
2020-05-19 11:48:22 -05:00
Ted Lyngmo
a98b8af448 Add filename to the BadFile exception (#858)
The BadFile exception which is thrown when failing to open a file now
contains the filename.
2020-05-07 14:46:28 -05:00
Ian Taylor
9fb5153487 implement convert for standard library containers allowing for custom allocators (#855) 2020-04-29 18:29:33 -05:00
Alan Griffiths
4edff1fa5d Fix stack overflow (#807)
Fix stack overflow in HandleNode by explicitly limiting the depth of recursion.
2020-04-09 13:02:10 -05:00
Tindy X
70205f5d88 Fix 'comparison object must be invocable as const' (#846) 2020-04-09 09:38:02 -05:00
Maxim Okhotskiy
6f7ead5171 Maintain order of nodes in sequences (#668) 2020-04-07 11:46:34 -05:00
Victor Mataré
cf93f4c57b Pass a mark to BadSubscript exception (#843)
It's clearly related to an existing node, so it can have a mark and give
an error location.
2020-04-07 11:33:16 -05:00
Romain Deterre
26faac387c Remove uses of std::iterator (deprecated in C++17) (#839) 2020-03-29 17:53:55 -05:00
Dekken
b2f89386d8 Split conversion call that uses std::signbit with unsupported parameters with enable_if (#824) 2020-03-11 08:59:16 -05:00
Anton Onishchenko
de8253fcb0 Fix storing inf and NaN (#817) 2020-02-14 18:03:21 -06:00
JeffWegher
29dcf92f87 Fix Node::size() after removing node from sequence (#820) 2020-02-14 14:38:58 -06:00
Ted Lyngmo
9ab22ef493 Make SettingChange and StreamCharSourcemove constructors and assignment operators noexcept (#808)
The explicitly defaulted or implemented move constructors and assignment
operators are made "noexcept".

Bugfix:
* src/stream.cpp Stream::Stream() char_traits::int_type intro[4] is
  now aggregate-initialized (to zero) to avoid UB.

Minor changes:
* Using std::isinf() and std::signbit() instead of comparing for
  equality with infinity.
* src/streamcharsource.h: Added #include "stream.h".
* src/stream.h: Forward declaring "class StreamCharSource".
* Some implicit casting changed into static_cast's.

Signed-off-by: Ted Lyngmo <ted@lyncon.se>
2020-02-04 16:58:00 -06:00
Ted Lyngmo
1928bca4a4 Move the YAML_CPP_NOEXCEPT macro to include/yaml-cpp/noexcept.h (#813)
This is in preparation for other patches that will make use of the
macro. The patch also removes #undef:ing the macro after its been
used to not make the header inclusion order critical. Otherwise,
the new header would always have to be the last of the yaml-cpp
headers to be included.
2020-02-04 13:24:37 -06:00