This is an automated email from the ASF dual-hosted git repository.
bneradt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 3a11dfeac0 Upgrade yaml-cpp version to 0.8.0 (#10249)
3a11dfeac0 is described below
commit 3a11dfeac0dfcbba5fedbd20b7c183e06c5407f1
Author: Zhengxi Li <[email protected]>
AuthorDate: Sat Aug 19 23:47:15 2023 -0400
Upgrade yaml-cpp version to 0.8.0 (#10249)
Currently we are using yaml-cpp version 0.7.0. This PR bumps our yaml-cpp
version to the just-released 0.8.0. Specifically, the following changes are made
* Fixed the pre-commit hook to properly ignore yaml-cpp source files for
formatting check
* Updated lib/yamlcpp source to 0.8.0
* Updated yaml version in the jsonrpc test and documentation
---
.../api/functions/TSRPCRegister.en.rst | 2 +-
.../jsonrpc/jsonrpc-handler-development.en.rst | 8 +-
lib/yamlcpp/BUILD.bazel | 7 ++
lib/yamlcpp/CMakeLists.txt | 89 +++++++++++++++-------
lib/yamlcpp/CONTRIBUTING.md | 2 +-
lib/yamlcpp/README.md | 51 ++++++-------
lib/yamlcpp/SECURITY.md | 13 ++++
lib/yamlcpp/appveyor.yml | 28 -------
lib/yamlcpp/cmake_uninstall.cmake.in | 21 +++++
lib/yamlcpp/include/yaml-cpp/dll.h | 80 ++++++++++++-------
lib/yamlcpp/include/yaml-cpp/exceptions.h | 2 +-
lib/yamlcpp/include/yaml-cpp/node/convert.h | 79 ++++++++++++++++++-
lib/yamlcpp/include/yaml-cpp/node/detail/node.h | 2 +-
lib/yamlcpp/include/yaml-cpp/node/impl.h | 2 +-
lib/yamlcpp/include/yaml-cpp/node/iterator.h | 3 +
lib/yamlcpp/include/yaml-cpp/node/ptr.h | 1 -
lib/yamlcpp/include/yaml-cpp/traits.h | 4 +-
lib/yamlcpp/src/binary.cpp | 4 +-
lib/yamlcpp/src/contrib/graphbuilderadapter.h | 1 -
lib/yamlcpp/src/directives.cpp | 2 +-
lib/yamlcpp/src/directives.h | 2 +-
lib/yamlcpp/src/emitter.cpp | 3 +-
lib/yamlcpp/src/emitterutils.cpp | 4 +-
lib/yamlcpp/src/exp.h | 6 +-
lib/yamlcpp/src/node_data.cpp | 2 +-
lib/yamlcpp/src/scanner.h | 2 -
lib/yamlcpp/src/singledocparser.cpp | 11 ++-
lib/yamlcpp/src/tag.cpp | 2 +-
lib/yamlcpp/src/tag.h | 2 +-
lib/yamlcpp/test/CMakeLists.txt | 13 +++-
lib/yamlcpp/test/binary_test.cpp | 14 ++++
lib/yamlcpp/test/create-emitter-tests.py | 8 +-
lib/yamlcpp/test/integration/emitter_test.cpp | 58 +++++++++++++-
.../test/integration/error_messages_test.cpp | 8 +-
lib/yamlcpp/test/integration/load_node_test.cpp | 15 ++++
lib/yamlcpp/test/node/node_test.cpp | 80 +++++++++++++++++++
lib/yamlcpp/util/parse.cpp | 15 ----
lib/yamlcpp/yaml-cpp-config.cmake.in | 20 +++--
lib/yamlcpp/yaml-cpp.pc.in | 4 +-
m4/yaml-cpp.m4 | 2 +-
.../jsonrpc/plugins/jsonrpc_plugin_handler_test.cc | 2 +-
tools/git/pre-commit | 2 +-
42 files changed, 495 insertions(+), 181 deletions(-)
diff --git a/doc/developer-guide/api/functions/TSRPCRegister.en.rst
b/doc/developer-guide/api/functions/TSRPCRegister.en.rst
index 8bb2ce3daf..0f4a53c2fe 100644
--- a/doc/developer-guide/api/functions/TSRPCRegister.en.rst
+++ b/doc/developer-guide/api/functions/TSRPCRegister.en.rst
@@ -79,7 +79,7 @@ Description
.. code-block:: cpp
- TSRPCProviderHandle info = TSRPCRegister("FooBar's Plugin!", 16,
"0.7.0", 5);
+ TSRPCProviderHandle info = TSRPCRegister("FooBar's Plugin!", 16,
"0.8.0", 5);
...
TSRPCHandlerOptions opt{{true}};
TSRPCRegisterMethodHandler("my_join_string_handler", 22, func, info,
&opt);
diff --git a/doc/developer-guide/jsonrpc/jsonrpc-handler-development.en.rst
b/doc/developer-guide/jsonrpc/jsonrpc-handler-development.en.rst
index c87f8e455f..18cb9d6813 100644
--- a/doc/developer-guide/jsonrpc/jsonrpc-handler-development.en.rst
+++ b/doc/developer-guide/jsonrpc/jsonrpc-handler-development.en.rst
@@ -202,7 +202,7 @@ RPC method registration and implementation examples
#include <ts/ts.h>
namespace {
- static const std::string MY_YAML_VERSION{"0.7.0"};
+ static const std::string MY_YAML_VERSION{"0.8.0"};
}
void
@@ -231,7 +231,7 @@ RPC method registration and implementation examples
{
...
// Check-in to make sure we are compliant with the YAML version in
TS.
- TSRPCProviderHandle rpcRegistrationInfo = TSRPCRegister("My
plugin's info", "0.7.0");
+ TSRPCProviderHandle rpcRegistrationInfo = TSRPCRegister("My
plugin's info", "0.8.0");
if (rpcRegistrationInfo == nullptr) {
TSError("[%s] RPC handler registration failed, yaml version
not supported.", PLUGIN_NAME);
}
@@ -250,7 +250,7 @@ RPC method registration and implementation examples
#include <ts/ts.h>
namespace {
- static const std::string MY_YAML_VERSION{"0.7.0"};
+ static const std::string MY_YAML_VERSION{"0.8.0"};
}
int
@@ -286,7 +286,7 @@ RPC method registration and implementation examples
{
// ...
// Check-in to make sure we are compliant with the YAML version in
TS.
- TSRPCProviderHandle rpcRegistrationInfo = TSRPCRegister("My
plugin's info", "0.7.0");
+ TSRPCProviderHandle rpcRegistrationInfo = TSRPCRegister("My
plugin's info", "0.8.0");
if (rpcRegistrationInfo == nullptr) {
TSError("[%s] RPC handler registration failed, yaml version
not supported.", PLUGIN_NAME);
}
diff --git a/lib/yamlcpp/BUILD.bazel b/lib/yamlcpp/BUILD.bazel
index b0b9016067..23e847e772 100644
--- a/lib/yamlcpp/BUILD.bazel
+++ b/lib/yamlcpp/BUILD.bazel
@@ -1,3 +1,9 @@
+yaml_cpp_defines = select({
+ # On Windows, ensure static linking is used.
+ "@platforms//os:windows": ["YAML_CPP_STATIC_DEFINE",
"YAML_CPP_NO_CONTRIB"],
+ "//conditions:default": [],
+})
+
cc_library(
name = "yaml-cpp_internal",
visibility = ["//:__subpackages__"],
@@ -11,4 +17,5 @@ cc_library(
includes = ["include"],
hdrs = glob(["include/**/*.h"]),
srcs = glob(["src/**/*.cpp", "src/**/*.h"]),
+ defines = yaml_cpp_defines,
)
diff --git a/lib/yamlcpp/CMakeLists.txt b/lib/yamlcpp/CMakeLists.txt
index 3092e64336..2d26ed1faf 100644
--- a/lib/yamlcpp/CMakeLists.txt
+++ b/lib/yamlcpp/CMakeLists.txt
@@ -7,7 +7,12 @@ if(POLICY CMP0091)
cmake_policy(SET CMP0091 NEW)
endif()
-project(YAML_CPP VERSION 0.7.0 LANGUAGES CXX)
+project(YAML_CPP VERSION 0.8.0 LANGUAGES CXX)
+
+set(YAML_CPP_MAIN_PROJECT OFF)
+if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
+ set(YAML_CPP_MAIN_PROJECT ON)
+endif()
include(CMakePackageConfigHelpers)
include(CMakeDependentOption)
@@ -15,27 +20,28 @@ include(CheckCXXCompilerFlag)
include(GNUInstallDirs)
include(CTest)
-find_program(YAML_CPP_CLANG_FORMAT_EXE NAMES clang-format)
-
option(YAML_CPP_BUILD_CONTRIB "Enable yaml-cpp contrib in library" ON)
option(YAML_CPP_BUILD_TOOLS "Enable parse tools" ON)
option(YAML_BUILD_SHARED_LIBS "Build yaml-cpp shared library"
${BUILD_SHARED_LIBS})
-
+option(YAML_CPP_INSTALL "Enable generation of yaml-cpp install targets"
${YAML_CPP_MAIN_PROJECT})
+option(YAML_CPP_FORMAT_SOURCE "Format source" ON)
cmake_dependent_option(YAML_CPP_BUILD_TESTS
- "Enable yaml-cpp tests" ON
- "BUILD_TESTING;CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
-cmake_dependent_option(YAML_CPP_INSTALL
- "Enable generation of yaml-cpp install targets" ON
- "CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
+ "Enable yaml-cpp tests" OFF
+ "BUILD_TESTING;YAML_CPP_MAIN_PROJECT" OFF)
cmake_dependent_option(YAML_MSVC_SHARED_RT
"MSVC: Build yaml-cpp with shared runtime libs (/MD)" ON
- "MSVC" OFF)
+ "CMAKE_SYSTEM_NAME MATCHES Windows" OFF)
+
+if (YAML_CPP_FORMAT_SOURCE)
+ find_program(YAML_CPP_CLANG_FORMAT_EXE NAMES clang-format)
+endif()
-set(yaml-cpp-type STATIC)
-set(yaml-cpp-label-postfix "static")
if (YAML_BUILD_SHARED_LIBS)
set(yaml-cpp-type SHARED)
set(yaml-cpp-label-postfix "shared")
+else()
+ set(yaml-cpp-type STATIC)
+ set(yaml-cpp-label-postfix "static")
endif()
set(build-shared $<BOOL:${YAML_BUILD_SHARED_LIBS}>)
@@ -78,6 +84,10 @@ set_property(TARGET yaml-cpp
PROPERTY
CXX_STANDARD_REQUIRED ON)
+if (NOT YAML_BUILD_SHARED_LIBS)
+ set_property(TARGET yaml-cpp PROPERTY POSITION_INDEPENDENT_CODE ON)
+endif()
+
target_include_directories(yaml-cpp
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
@@ -91,11 +101,15 @@ if (NOT DEFINED CMAKE_CXX_STANDARD)
CXX_STANDARD 11)
endif()
+if(YAML_CPP_MAIN_PROJECT)
+ target_compile_options(yaml-cpp
+ PRIVATE
+ $<${not-msvc}:-Wall -Wextra -Weffc++ -Wno-long-long>
+ $<${not-msvc}:-pedantic -pedantic-errors>)
+endif()
+
target_compile_options(yaml-cpp
PRIVATE
- $<${not-msvc}:-Wall -Wextra -Weffc++ -Wno-long-long>
- $<${not-msvc}:-pedantic -pedantic-errors>
-
$<$<AND:${backport-msvc-runtime},${msvc-rt-mtd-static}>:-MTd>
$<$<AND:${backport-msvc-runtime},${msvc-rt-mt-static}>:-MT>
$<$<AND:${backport-msvc-runtime},${msvc-rt-mtd-dll}>:-MDd>
@@ -108,6 +122,8 @@ target_compile_options(yaml-cpp
$<$<CXX_COMPILER_ID:MSVC>:/W3 /wd4127 /wd4355>)
target_compile_definitions(yaml-cpp
+ PUBLIC
+ $<$<NOT:$<BOOL:${YAML_BUILD_SHARED_LIBS}>>:YAML_CPP_STATIC_DEFINE>
PRIVATE
$<${build-windows-dll}:${PROJECT_NAME}_DLL>
$<$<NOT:$<BOOL:${YAML_CPP_BUILD_CONTRIB}>>:YAML_CPP_NO_CONTRIB>)
@@ -127,10 +143,14 @@ set_target_properties(yaml-cpp PROPERTIES
PROJECT_LABEL "yaml-cpp ${yaml-cpp-label-postfix}"
DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
+set(CONFIG_EXPORT_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/yaml-cpp")
+set(EXPORT_TARGETS yaml-cpp)
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/yaml-cpp-config.cmake.in"
"${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake"
- INSTALL_DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp")
+ INSTALL_DESTINATION "${CONFIG_EXPORT_DIR}"
+ PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR CONFIG_EXPORT_DIR
YAML_BUILD_SHARED_LIBS)
+unset(EXPORT_TARGETS)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
@@ -139,36 +159,49 @@ write_basic_package_version_file(
configure_file(yaml-cpp.pc.in yaml-cpp.pc @ONLY)
if (YAML_CPP_INSTALL)
- install(TARGETS yaml-cpp
+ install(TARGETS yaml-cpp
EXPORT yaml-cpp-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
- install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
+ install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
- FILES_MATCHING PATTERN "*.h")
+ FILES_MATCHING PATTERN "*.h")
install(EXPORT yaml-cpp-targets
- DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp")
- install(FILES
- "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake"
- "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
- DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp")
+ NAMESPACE yaml-cpp::
+ DESTINATION "${CONFIG_EXPORT_DIR}")
+ install(FILES
+ "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake"
+ "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
+ DESTINATION "${CONFIG_EXPORT_DIR}")
install(FILES "${PROJECT_BINARY_DIR}/yaml-cpp.pc"
- DESTINATION ${CMAKE_INSTALL_DATADIR}/pkgconfig)
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
+unset(CONFIG_EXPORT_DIR)
if(YAML_CPP_BUILD_TESTS)
- add_subdirectory(test)
+ add_subdirectory(test)
endif()
if(YAML_CPP_BUILD_TOOLS)
- add_subdirectory(util)
+ add_subdirectory(util)
endif()
-if (YAML_CPP_CLANG_FORMAT_EXE)
+if (YAML_CPP_FORMAT_SOURCE AND YAML_CPP_CLANG_FORMAT_EXE)
add_custom_target(format
COMMAND clang-format --style=file -i $<TARGET_PROPERTY:yaml-cpp,SOURCES>
COMMAND_EXPAND_LISTS
COMMENT "Running clang-format"
VERBATIM)
endif()
+
+# uninstall target
+if(NOT TARGET uninstall)
+ configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+ IMMEDIATE @ONLY)
+
+ add_custom_target(uninstall
+ COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
+endif()
diff --git a/lib/yamlcpp/CONTRIBUTING.md b/lib/yamlcpp/CONTRIBUTING.md
index cd09a1aca8..5705fe2bcf 100644
--- a/lib/yamlcpp/CONTRIBUTING.md
+++ b/lib/yamlcpp/CONTRIBUTING.md
@@ -17,7 +17,7 @@ Commit messages should be in the imperative mood, as
described in the [Git contr
# Tests
-Please verify the tests pass by running the target `tests/run_tests`.
+Please verify the tests pass by running the target `test/yaml-cpp-tests`.
If you are adding functionality, add tests accordingly.
diff --git a/lib/yamlcpp/README.md b/lib/yamlcpp/README.md
index 627d44125d..70c231445d 100644
--- a/lib/yamlcpp/README.md
+++ b/lib/yamlcpp/README.md
@@ -1,56 +1,52 @@
-# yaml-cpp [](https://travis-ci.org/jbeder/yaml-cpp)
[](https://codedocs.xyz/jbeder/yaml-cpp/)
+# yaml-cpp 
[](https://codedocs.xyz/jbeder/yaml-cpp/)
-yaml-cpp is a [YAML](http://www.yaml.org/) parser and emitter in C++ matching
the [YAML 1.2 spec](http://www.yaml.org/spec/1.2/spec.html).
+`yaml-cpp` is a [YAML](http://www.yaml.org/) parser and emitter in C++
matching the [YAML 1.2 spec](http://www.yaml.org/spec/1.2/spec.html).
-To get a feel for how it can be used, see the
[Tutorial](https://github.com/jbeder/yaml-cpp/wiki/Tutorial) or [How to Emit
YAML](https://github.com/jbeder/yaml-cpp/wiki/How-To-Emit-YAML). For the old
API (version < 0.5.0), see [How To Parse A
Document](https://github.com/jbeder/yaml-cpp/wiki/How-To-Parse-A-Document-(Old-API)).
+## Usage
-# Problems? #
+See [Tutorial](https://github.com/jbeder/yaml-cpp/wiki/Tutorial) and [How to
Emit YAML](https://github.com/jbeder/yaml-cpp/wiki/How-To-Emit-YAML) for
reference. For the old API (until 0.5.0), see [How To Parse A
Document](https://github.com/jbeder/yaml-cpp/wiki/How-To-Parse-A-Document-(Old-API)).
-If you find a bug, post an [issue](https://github.com/jbeder/yaml-cpp/issues)!
If you have questions about how to use yaml-cpp, please post it on
http://stackoverflow.com and tag it
[`yaml-cpp`](http://stackoverflow.com/questions/tagged/yaml-cpp).
+## Any Problems?
-# How to Build #
+If you find a bug, post an [issue](https://github.com/jbeder/yaml-cpp/issues)!
If you have questions about how to use yaml-cpp, please post it on
http://stackoverflow.com and tag it
[`yaml-cpp`](http://stackoverflow.com/questions/tagged/yaml-cpp).
-yaml-cpp uses [CMake](http://www.cmake.org) to support cross-platform
building. The basic steps to build are:
+## How to Build
-1. Download and install [CMake](http://www.cmake.org) (Resources -> Download).
+`yaml-cpp` uses [CMake](http://www.cmake.org) to support cross-platform
building. Install [CMake](http://www.cmake.org) _(Resources -> Download)_
before proceeding. The basic steps to build are:
-**Note:** If you don't use the provided installer for your platform, make sure
that you add CMake's bin folder to your path.
+**Note:** If you don't use the provided installer for your platform, make sure
that you add `CMake`'s bin folder to your path.
-2. Navigate into the source directory, and type:
+#### 1. Navigate into the source directory, create build folder and run
`CMake`:
-```
+```sh
mkdir build
cd build
+cmake [-G generator] [-DYAML_BUILD_SHARED_LIBS=on|OFF] ..
```
-3. Run CMake. The basic syntax is:
-
-```
-cmake [-G generator] [-DYAML_BUILD_SHARED_LIBS=ON|OFF] ..
-```
-
- * The `generator` is whatever type of build system you'd like to use. To see
a full list of generators on your platform, just run `cmake` (with no
arguments). For example:
- * On Windows, you might use "Visual Studio 12 2013" to generate a Visual
Studio 2013 solution or "Visual Studio 14 2015 Win64" to generate a 64-bit
Visual Studio 2015 solution.
- * On OS X, you might use "Xcode" to generate an Xcode project
- * On a UNIX-y system, simply omit the option to generate a makefile
+ * The `generator` option is the build system you'd like to use. Run `cmake`
without arguments to see a full list of available generators.
+ * On Windows, you might use "Visual Studio 12 2013" (VS 2013 32-bits), or
"Visual Studio 14 2015 Win64" (VS 2015 64-bits).
+ * On OS X, you might use "Xcode".
+ * On a UNIX-like system, omit the option (for a Makefile).
- * yaml-cpp defaults to building a static library, but you may build a shared
library by specifying `-DYAML_BUILD_SHARED_LIBS=ON`.
+ * `yaml-cpp` builds a static library by default, you may want to build a
shared library by specifying `-DYAML_BUILD_SHARED_LIBS=ON`.
* For more options on customizing the build, see the
[CMakeLists.txt](https://github.com/jbeder/yaml-cpp/blob/master/CMakeLists.txt)
file.
-4. Build it!
+#### 2. Build it!
+ * The command you'll need to run depends on the generator you chose earlier.
-5. To clean up, just remove the `build` directory.
+**Note:** To clean up, just remove the `build` directory.
-# Recent Release #
+## Recent Releases
-[yaml-cpp
0.6.0](https://github.com/jbeder/yaml-cpp/releases/tag/yaml-cpp-0.6.0) has been
released! This release requires C++11, and no longer depends on Boost.
+[yaml-cpp
0.6.0](https://github.com/jbeder/yaml-cpp/releases/tag/yaml-cpp-0.6.0)
released! This release requires C++11, and no longer depends on Boost.
[yaml-cpp
0.3.0](https://github.com/jbeder/yaml-cpp/releases/tag/release-0.3.0) is still
available if you want the old API.
**The old API will continue to be supported, and will still receive
bugfixes!** The 0.3.x and 0.4.x versions will be old API releases, and 0.5.x
and above will all be new API releases.
-# API Documentation
+# API Documentation
The autogenerated API reference is hosted on
[CodeDocs](https://codedocs.xyz/jbeder/yaml-cpp/index.html)
@@ -59,3 +55,4 @@ The autogenerated API reference is hosted on
[CodeDocs](https://codedocs.xyz/jbe
The following projects are not officially supported:
- [Qt wrapper](https://gist.github.com/brcha/d392b2fe5f1e427cc8a6)
+- [UnrealEngine Wrapper](https://github.com/jwindgassen/UnrealYAML)
diff --git a/lib/yamlcpp/SECURITY.md b/lib/yamlcpp/SECURITY.md
new file mode 100644
index 0000000000..06a17511b9
--- /dev/null
+++ b/lib/yamlcpp/SECURITY.md
@@ -0,0 +1,13 @@
+# Security Policy
+
+## Supported Versions
+
+Security updates are applied only to the latest release.
+
+## Reporting a Vulnerability
+
+If you have discovered a security vulnerability in this project, please report
it privately. **Do not disclose it as a public issue.** This gives us time to
work with you to fix the issue before public exposure, reducing the chance that
the exploit will be used before a patch is released.
+
+Please disclose it at [security
advisory](https://github.com/jbeder/yaml-cpp/security/advisories/new).
+
+This project is maintained by a team of volunteers on a reasonable-effort
basis. As such, vulnerabilities will be disclosed in a best effort base.
diff --git a/lib/yamlcpp/appveyor.yml b/lib/yamlcpp/appveyor.yml
deleted file mode 100644
index 54bcc80c5c..0000000000
--- a/lib/yamlcpp/appveyor.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-version: 1.0.{build}
-
-environment:
- matrix:
- - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- CMAKE_GENERATOR: Visual Studio 14 2015
- CMAKE_PLATFORM: win32
- - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- CMAKE_GENERATOR: Visual Studio 14 2015
- CMAKE_PLATFORM: x64
- - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- CMAKE_GENERATOR: Visual Studio 15 2017
- CMAKE_PLATFORM: win32
- - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- CMAKE_GENERATOR: Visual Studio 15 2017
- CMAKE_PLATFORM: x64
-
-before_build:
- - cmd: mkdir build
- - cmd: cd build
- - cmd: cmake .. -G "%CMAKE_GENERATOR%"
-DCMAKE_GENERATOR_PLATFORM=%CMAKE_PLATFORM%
- - cmd: cd ..
-
-build_script:
- - cmake --build build
-test_script:
- - cmd: cd build
- - ctest
diff --git a/lib/yamlcpp/cmake_uninstall.cmake.in
b/lib/yamlcpp/cmake_uninstall.cmake.in
new file mode 100644
index 0000000000..c2d34d4796
--- /dev/null
+++ b/lib/yamlcpp/cmake_uninstall.cmake.in
@@ -0,0 +1,21 @@
+if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
+ message(FATAL_ERROR "Cannot find install manifest:
@CMAKE_BINARY_DIR@/install_manifest.txt")
+endif()
+
+file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
+string(REGEX REPLACE "\n" ";" files "${files}")
+foreach(file ${files})
+ message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
+ if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+ exec_program(
+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ if(NOT "${rm_retval}" STREQUAL 0)
+ message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
+ endif()
+ else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+ message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
+ endif()
+endforeach()
diff --git a/lib/yamlcpp/include/yaml-cpp/dll.h
b/lib/yamlcpp/include/yaml-cpp/dll.h
index a32c06b2e3..eabdda1d95 100644
--- a/lib/yamlcpp/include/yaml-cpp/dll.h
+++ b/lib/yamlcpp/include/yaml-cpp/dll.h
@@ -1,33 +1,61 @@
#ifndef DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#if defined(_MSC_VER) || \
- (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
- (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
-#pragma once
+// Definition YAML_CPP_STATIC_DEFINE using to building YAML-CPP as static
+// library (definition created by CMake or defined manually)
+
+// Definition yaml_cpp_EXPORTS using to building YAML-CPP as dll/so library
+// (definition created by CMake or defined manually)
+
+#ifdef YAML_CPP_STATIC_DEFINE
+# define YAML_CPP_API
+# define YAML_CPP_NO_EXPORT
+#else
+# if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__)
+# ifndef YAML_CPP_API
+# ifdef yaml_cpp_EXPORTS
+ /* We are building this library */
+# pragma message( "Defining YAML_CPP_API for DLL export" )
+# define YAML_CPP_API __declspec(dllexport)
+# else
+ /* We are using this library */
+# pragma message( "Defining YAML_CPP_API for DLL import" )
+# define YAML_CPP_API __declspec(dllimport)
+# endif
+# endif
+# ifndef YAML_CPP_NO_EXPORT
+# define YAML_CPP_NO_EXPORT
+# endif
+# else /* No _MSC_VER */
+# ifndef YAML_CPP_API
+# ifdef yaml_cpp_EXPORTS
+ /* We are building this library */
+# define YAML_CPP_API __attribute__((visibility("default")))
+# else
+ /* We are using this library */
+# define YAML_CPP_API __attribute__((visibility("default")))
+# endif
+# endif
+# ifndef YAML_CPP_NO_EXPORT
+# define YAML_CPP_NO_EXPORT __attribute__((visibility("hidden")))
+# endif
+# endif /* _MSC_VER */
+#endif /* YAML_CPP_STATIC_DEFINE */
+
+#ifndef YAML_CPP_DEPRECATED
+# ifdef _MSC_VER
+# define YAML_CPP_DEPRECATED __declspec(deprecated)
+# else
+# define YAML_CPP_DEPRECATED __attribute__ ((__deprecated__))
+# endif
#endif
-// The following ifdef block is the standard way of creating macros which make
-// exporting from a DLL simpler. All files within this DLL are compiled with
the
-// yaml_cpp_EXPORTS symbol defined on the command line. This symbol should not
-// be defined on any project that uses this DLL. This way any other project
-// whose source files include this file see YAML_CPP_API functions as being
-// imported from a DLL, whereas this DLL sees symbols defined with this macro
as
-// being exported.
-#undef YAML_CPP_API
+#ifndef YAML_CPP_DEPRECATED_EXPORT
+# define YAML_CPP_DEPRECATED_EXPORT YAML_CPP_API YAML_CPP_DEPRECATED
+#endif
-#ifdef YAML_CPP_DLL // Using or Building YAML-CPP DLL (definition defined
- // manually)
-#ifdef yaml_cpp_EXPORTS // Building YAML-CPP DLL (definition created by CMake
- // or defined manually)
-// #pragma message( "Defining YAML_CPP_API for DLL export" )
-#define YAML_CPP_API __declspec(dllexport)
-#else // yaml_cpp_EXPORTS
-// #pragma message( "Defining YAML_CPP_API for DLL import" )
-#define YAML_CPP_API __declspec(dllimport)
-#endif // yaml_cpp_EXPORTS
-#else // YAML_CPP_DLL
-#define YAML_CPP_API
-#endif // YAML_CPP_DLL
+#ifndef YAML_CPP_DEPRECATED_NO_EXPORT
+# define YAML_CPP_DEPRECATED_NO_EXPORT YAML_CPP_NO_EXPORT YAML_CPP_DEPRECATED
+#endif
-#endif // DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#endif /* DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 */
diff --git a/lib/yamlcpp/include/yaml-cpp/exceptions.h
b/lib/yamlcpp/include/yaml-cpp/exceptions.h
index c3f44747e2..f6b2602ae1 100644
--- a/lib/yamlcpp/include/yaml-cpp/exceptions.h
+++ b/lib/yamlcpp/include/yaml-cpp/exceptions.h
@@ -65,7 +65,7 @@ const char* const ZERO_INDENT_IN_BLOCK =
const char* const CHAR_IN_BLOCK = "unexpected character in block scalar";
const char* const AMBIGUOUS_ANCHOR =
"cannot assign the same alias to multiple nodes";
-const char* const UNKNOWN_ANCHOR = "the referenced anchor is not defined";
+const char* const UNKNOWN_ANCHOR = "the referenced anchor is not defined: ";
const char* const INVALID_NODE =
"invalid node; this may result from using a map iterator as a sequence "
diff --git a/lib/yamlcpp/include/yaml-cpp/node/convert.h
b/lib/yamlcpp/include/yaml-cpp/node/convert.h
index 596898da60..d0eb450f73 100644
--- a/lib/yamlcpp/include/yaml-cpp/node/convert.h
+++ b/lib/yamlcpp/include/yaml-cpp/node/convert.h
@@ -12,10 +12,16 @@
#include <limits>
#include <list>
#include <map>
+#include <unordered_map>
#include <sstream>
#include <type_traits>
+#include <valarray>
#include <vector>
+#if __cplusplus >= 201703L
+#include <string_view>
+#endif
+
#include "yaml-cpp/binary.h"
#include "yaml-cpp/node/impl.h"
#include "yaml-cpp/node/iterator.h"
@@ -87,6 +93,20 @@ struct convert<char[N]> {
static Node encode(const char* rhs) { return Node(rhs); }
};
+#if __cplusplus >= 201703L
+template <>
+struct convert<std::string_view> {
+ static Node encode(std::string_view rhs) { return Node(std::string(rhs)); }
+
+ static bool decode(const Node& node, std::string_view& rhs) {
+ if (!node.IsScalar())
+ return false;
+ rhs = node.Scalar();
+ return true;
+ }
+};
+#endif
+
template <>
struct convert<_Null> {
static Node encode(const _Null& /* rhs */) { return Node(); }
@@ -127,7 +147,7 @@ ConvertStreamTo(std::stringstream& stream, T& rhs) {
if ((stream >> std::noskipws >> num) && (stream >> std::ws).eof()) {
if (num >= (std::numeric_limits<T>::min)() &&
num <= (std::numeric_limits<T>::max)()) {
- rhs = (T)num;
+ rhs = static_cast<T>(num);
return true;
}
}
@@ -251,6 +271,32 @@ struct convert<std::map<K, V, C, A>> {
}
};
+// std::unordered_map
+template <typename K, typename V, typename H, typename P, typename A>
+struct convert<std::unordered_map<K, V, H, P, A>> {
+ static Node encode(const std::unordered_map<K, V, H, P, A>& rhs) {
+ Node node(NodeType::Map);
+ for (const auto& element : rhs)
+ node.force_insert(element.first, element.second);
+ return node;
+ }
+
+ static bool decode(const Node& node, std::unordered_map<K, V, H, P, A>& rhs)
{
+ if (!node.IsMap())
+ return false;
+
+ rhs.clear();
+ for (const auto& element : node)
+#if defined(__GNUC__) && __GNUC__ < 4
+ // workaround for GCC 3:
+ rhs[element.first.template as<K>()] = element.second.template as<V>();
+#else
+ rhs[element.first.as<K>()] = element.second.as<V>();
+#endif
+ return true;
+ }
+};
+
// std::vector
template <typename T, typename A>
struct convert<std::vector<T, A>> {
@@ -336,6 +382,37 @@ struct convert<std::array<T, N>> {
}
};
+
+// std::valarray
+template <typename T>
+struct convert<std::valarray<T>> {
+ static Node encode(const std::valarray<T>& rhs) {
+ Node node(NodeType::Sequence);
+ for (const auto& element : rhs) {
+ node.push_back(element);
+ }
+ return node;
+ }
+
+ static bool decode(const Node& node, std::valarray<T>& rhs) {
+ if (!node.IsSequence()) {
+ return false;
+ }
+
+ rhs.resize(node.size());
+ for (auto i = 0u; i < node.size(); ++i) {
+#if defined(__GNUC__) && __GNUC__ < 4
+ // workaround for GCC 3:
+ rhs[i] = node[i].template as<T>();
+#else
+ rhs[i] = node[i].as<T>();
+#endif
+ }
+ return true;
+ }
+};
+
+
// std::pair
template <typename T, typename U>
struct convert<std::pair<T, U>> {
diff --git a/lib/yamlcpp/include/yaml-cpp/node/detail/node.h
b/lib/yamlcpp/include/yaml-cpp/node/detail/node.h
index b881c2c5ee..acf60ffb6d 100644
--- a/lib/yamlcpp/include/yaml-cpp/node/detail/node.h
+++ b/lib/yamlcpp/include/yaml-cpp/node/detail/node.h
@@ -169,7 +169,7 @@ class node {
using nodes = std::set<node*, less>;
nodes m_dependencies;
size_t m_index;
- static std::atomic<size_t> m_amount;
+ static YAML_CPP_API std::atomic<size_t> m_amount;
};
} // namespace detail
} // namespace YAML
diff --git a/lib/yamlcpp/include/yaml-cpp/node/impl.h
b/lib/yamlcpp/include/yaml-cpp/node/impl.h
index 97dc282d9c..312281f18c 100644
--- a/lib/yamlcpp/include/yaml-cpp/node/impl.h
+++ b/lib/yamlcpp/include/yaml-cpp/node/impl.h
@@ -42,7 +42,7 @@ inline Node::Node(const detail::iterator_value& rhs)
m_pMemory(rhs.m_pMemory),
m_pNode(rhs.m_pNode) {}
-inline Node::Node(const Node& rhs) = default;
+inline Node::Node(const Node&) = default;
inline Node::Node(Zombie)
: m_isValid(false), m_invalidKey{}, m_pMemory{}, m_pNode(nullptr) {}
diff --git a/lib/yamlcpp/include/yaml-cpp/node/iterator.h
b/lib/yamlcpp/include/yaml-cpp/node/iterator.h
index b447238179..1fcf6e400f 100644
--- a/lib/yamlcpp/include/yaml-cpp/node/iterator.h
+++ b/lib/yamlcpp/include/yaml-cpp/node/iterator.h
@@ -15,6 +15,9 @@
#include <utility>
#include <vector>
+// Assert in place so gcc + libc++ combination properly builds
+static_assert(std::is_constructible<YAML::Node, const YAML::Node&>::value,
"Node must be copy constructable");
+
namespace YAML {
namespace detail {
struct iterator_value : public Node, std::pair<Node, Node> {
diff --git a/lib/yamlcpp/include/yaml-cpp/node/ptr.h
b/lib/yamlcpp/include/yaml-cpp/node/ptr.h
index 062d77ea0f..f55d95ed9c 100644
--- a/lib/yamlcpp/include/yaml-cpp/node/ptr.h
+++ b/lib/yamlcpp/include/yaml-cpp/node/ptr.h
@@ -7,7 +7,6 @@
#pragma once
#endif
-#include "yaml-cpp/dll.h"
#include <memory>
namespace YAML {
diff --git a/lib/yamlcpp/include/yaml-cpp/traits.h
b/lib/yamlcpp/include/yaml-cpp/traits.h
index 9a62db257a..ffe9999f19 100644
--- a/lib/yamlcpp/include/yaml-cpp/traits.h
+++ b/lib/yamlcpp/include/yaml-cpp/traits.h
@@ -107,9 +107,9 @@ struct disable_if : public disable_if_c<Cond::value, T> {};
template <typename S, typename T>
struct is_streamable {
- template <typename SS, typename TT>
+ template <typename StreamT, typename ValueT>
static auto test(int)
- -> decltype(std::declval<SS&>() << std::declval<TT>(), std::true_type());
+ -> decltype(std::declval<StreamT&>() << std::declval<ValueT>(),
std::true_type());
template <typename, typename>
static auto test(...) -> std::false_type;
diff --git a/lib/yamlcpp/src/binary.cpp b/lib/yamlcpp/src/binary.cpp
index 4311a2d063..d27762a243 100644
--- a/lib/yamlcpp/src/binary.cpp
+++ b/lib/yamlcpp/src/binary.cpp
@@ -75,11 +75,11 @@ std::vector<unsigned char> DecodeBase64(const std::string
&input) {
unsigned value = 0;
for (std::size_t i = 0, cnt = 0; i < input.size(); i++) {
- if (std::isspace(input[i])) {
+ if (std::isspace(static_cast<unsigned char>(input[i]))) {
// skip newlines
continue;
}
- unsigned char d = decoding[static_cast<unsigned>(input[i])];
+ unsigned char d = decoding[static_cast<unsigned char>(input[i])];
if (d == 255)
return ret_type();
diff --git a/lib/yamlcpp/src/contrib/graphbuilderadapter.h
b/lib/yamlcpp/src/contrib/graphbuilderadapter.h
index 9078cdfdac..c1cbcffdca 100644
--- a/lib/yamlcpp/src/contrib/graphbuilderadapter.h
+++ b/lib/yamlcpp/src/contrib/graphbuilderadapter.h
@@ -13,7 +13,6 @@
#include "yaml-cpp/anchor.h"
#include "yaml-cpp/contrib/anchordict.h"
-#include "yaml-cpp/contrib/graphbuilder.h"
#include "yaml-cpp/emitterstyle.h"
#include "yaml-cpp/eventhandler.h"
diff --git a/lib/yamlcpp/src/directives.cpp b/lib/yamlcpp/src/directives.cpp
index f6e9587c6e..4c1dc201d7 100644
--- a/lib/yamlcpp/src/directives.cpp
+++ b/lib/yamlcpp/src/directives.cpp
@@ -3,7 +3,7 @@
namespace YAML {
Directives::Directives() : version{true, 1, 2}, tags{} {}
-const std::string Directives::TranslateTagHandle(
+std::string Directives::TranslateTagHandle(
const std::string& handle) const {
auto it = tags.find(handle);
if (it == tags.end()) {
diff --git a/lib/yamlcpp/src/directives.h b/lib/yamlcpp/src/directives.h
index 333af26e37..18d14c9c0b 100644
--- a/lib/yamlcpp/src/directives.h
+++ b/lib/yamlcpp/src/directives.h
@@ -19,7 +19,7 @@ struct Version {
struct Directives {
Directives();
- const std::string TranslateTagHandle(const std::string& handle) const;
+ std::string TranslateTagHandle(const std::string& handle) const;
Version version;
std::map<std::string, std::string> tags;
diff --git a/lib/yamlcpp/src/emitter.cpp b/lib/yamlcpp/src/emitter.cpp
index 644b3129b7..4d483075bd 100644
--- a/lib/yamlcpp/src/emitter.cpp
+++ b/lib/yamlcpp/src/emitter.cpp
@@ -533,7 +533,8 @@ void Emitter::BlockMapPrepareNode(EmitterNodeType::value
child) {
if (m_pState->GetMapKeyFormat() == LongKey)
m_pState->SetLongKey();
if (child == EmitterNodeType::BlockSeq ||
- child == EmitterNodeType::BlockMap)
+ child == EmitterNodeType::BlockMap ||
+ child == EmitterNodeType::Property)
m_pState->SetLongKey();
if (m_pState->CurGroupLongKey())
diff --git a/lib/yamlcpp/src/emitterutils.cpp b/lib/yamlcpp/src/emitterutils.cpp
index c6ad5e5d93..6cdf6de7e2 100644
--- a/lib/yamlcpp/src/emitterutils.cpp
+++ b/lib/yamlcpp/src/emitterutils.cpp
@@ -176,11 +176,11 @@ bool IsValidPlainScalar(const std::string& str,
FlowType::value flowType,
static const RegEx& disallowed_flow =
Exp::EndScalarInFlow() | (Exp::BlankOrBreak() + Exp::Comment()) |
Exp::NotPrintable() | Exp::Utf8_ByteOrderMark() | Exp::Break() |
- Exp::Tab();
+ Exp::Tab() | Exp::Ampersand();
static const RegEx& disallowed_block =
Exp::EndScalar() | (Exp::BlankOrBreak() + Exp::Comment()) |
Exp::NotPrintable() | Exp::Utf8_ByteOrderMark() | Exp::Break() |
- Exp::Tab();
+ Exp::Tab() | Exp::Ampersand();
const RegEx& disallowed =
flowType == FlowType::Flow ? disallowed_flow : disallowed_block;
diff --git a/lib/yamlcpp/src/exp.h b/lib/yamlcpp/src/exp.h
index 301449e8f8..c8837f0f82 100644
--- a/lib/yamlcpp/src/exp.h
+++ b/lib/yamlcpp/src/exp.h
@@ -37,7 +37,7 @@ inline const RegEx& Blank() {
return e;
}
inline const RegEx& Break() {
- static const RegEx e = RegEx('\n') | RegEx("\r\n");
+ static const RegEx e = RegEx('\n') | RegEx("\r\n") | RegEx('\r');
return e;
}
inline const RegEx& BlankOrBreak() {
@@ -117,6 +117,10 @@ inline const RegEx& ValueInJSONFlow() {
static const RegEx e = RegEx(':');
return e;
}
+inline const RegEx& Ampersand() {
+ static const RegEx e = RegEx('&');
+ return e;
+}
inline const RegEx Comment() {
static const RegEx e = RegEx('#');
return e;
diff --git a/lib/yamlcpp/src/node_data.cpp b/lib/yamlcpp/src/node_data.cpp
index da2aefce94..8f5422ae6e 100644
--- a/lib/yamlcpp/src/node_data.cpp
+++ b/lib/yamlcpp/src/node_data.cpp
@@ -13,7 +13,7 @@
namespace YAML {
namespace detail {
-std::atomic<size_t> node::m_amount{0};
+YAML_CPP_API std::atomic<size_t> node::m_amount{0};
const std::string& node_data::empty_scalar() {
static const std::string svalue;
diff --git a/lib/yamlcpp/src/scanner.h b/lib/yamlcpp/src/scanner.h
index c653ac69ff..4af938e69c 100644
--- a/lib/yamlcpp/src/scanner.h
+++ b/lib/yamlcpp/src/scanner.h
@@ -9,9 +9,7 @@
#include <cstddef>
#include <ios>
-#include <map>
#include <queue>
-#include <set>
#include <stack>
#include <string>
diff --git a/lib/yamlcpp/src/singledocparser.cpp
b/lib/yamlcpp/src/singledocparser.cpp
index 6bad448d90..22913d198c 100644
--- a/lib/yamlcpp/src/singledocparser.cpp
+++ b/lib/yamlcpp/src/singledocparser.cpp
@@ -93,8 +93,8 @@ void SingleDocParser::HandleNode(EventHandler& eventHandler) {
// add non-specific tags
if (tag.empty())
tag = (token.type == Token::NON_PLAIN_SCALAR ? "!" : "?");
-
- if (token.type == Token::PLAIN_SCALAR
+
+ if (token.type == Token::PLAIN_SCALAR
&& tag.compare("?") == 0 && IsNullString(token.value)) {
eventHandler.OnNull(mark, anchor);
m_scanner.pop();
@@ -424,8 +424,11 @@ anchor_t SingleDocParser::RegisterAnchor(const
std::string& name) {
anchor_t SingleDocParser::LookupAnchor(const Mark& mark,
const std::string& name) const {
auto it = m_anchors.find(name);
- if (it == m_anchors.end())
- throw ParserException(mark, ErrorMsg::UNKNOWN_ANCHOR);
+ if (it == m_anchors.end()) {
+ std::stringstream ss;
+ ss << ErrorMsg::UNKNOWN_ANCHOR << name;
+ throw ParserException(mark, ss.str());
+ }
return it->second;
}
diff --git a/lib/yamlcpp/src/tag.cpp b/lib/yamlcpp/src/tag.cpp
index df8a2cf461..35a1b46560 100644
--- a/lib/yamlcpp/src/tag.cpp
+++ b/lib/yamlcpp/src/tag.cpp
@@ -29,7 +29,7 @@ Tag::Tag(const Token& token)
}
}
-const std::string Tag::Translate(const Directives& directives) {
+std::string Tag::Translate(const Directives& directives) {
switch (type) {
case VERBATIM:
return value;
diff --git a/lib/yamlcpp/src/tag.h b/lib/yamlcpp/src/tag.h
index ac30673b9e..c811f39559 100644
--- a/lib/yamlcpp/src/tag.h
+++ b/lib/yamlcpp/src/tag.h
@@ -23,7 +23,7 @@ struct Tag {
};
Tag(const Token& token);
- const std::string Translate(const Directives& directives);
+ std::string Translate(const Directives& directives);
TYPE type;
std::string handle, value;
diff --git a/lib/yamlcpp/test/CMakeLists.txt b/lib/yamlcpp/test/CMakeLists.txt
index 5ebc1a6b34..351b03f810 100644
--- a/lib/yamlcpp/test/CMakeLists.txt
+++ b/lib/yamlcpp/test/CMakeLists.txt
@@ -5,10 +5,10 @@ set(BUILD_MOCK ON CACHE BOOL "" FORCE)
set(CMAKE_POLICY_DEFAULT_CMP0048 NEW)
add_subdirectory(
- "${CMAKE_CURRENT_SOURCE_DIR}/gtest-1.10.0"
+ "${CMAKE_CURRENT_SOURCE_DIR}/gtest-1.11.0"
"${CMAKE_CURRENT_BINARY_DIR}/prefix")
-include_directories(SYSTEM
"${CMAKE_CURRENT_SOURCE_DIR}/gtest-1.10.0/googletest/include")
+include_directories(SYSTEM
"${CMAKE_CURRENT_SOURCE_DIR}/gtest-1.11.0/googletest/include")
set(test-new-api-pattern "new-api/*.cpp")
set(test-source-pattern "*.cpp" "integration/*.cpp" "node/*.cpp")
@@ -46,4 +46,11 @@ if (NOT DEFINED CMAKE_CXX_STANDARD)
endif()
-add_test(yaml-cpp::test yaml-cpp-tests)
+add_test(NAME yaml-cpp::test COMMAND yaml-cpp-tests)
+
+if (build-windows-dll)
+ add_custom_command(
+ TARGET yaml-cpp-tests
+ POST_BUILD COMMAND ${CMAKE_COMMAND} -E
+ copy_if_different "$<TARGET_FILE:yaml-cpp>"
"$<TARGET_FILE_DIR:yaml-cpp-tests>")
+endif()
diff --git a/lib/yamlcpp/test/binary_test.cpp b/lib/yamlcpp/test/binary_test.cpp
new file mode 100644
index 0000000000..7b17823f89
--- /dev/null
+++ b/lib/yamlcpp/test/binary_test.cpp
@@ -0,0 +1,14 @@
+#include "gtest/gtest.h"
+#include <yaml-cpp/binary.h>
+
+TEST(BinaryTest, DecodingSimple) {
+ std::string input{90, 71, 86, 104, 90, 71, 74, 108, 90, 87, 89, 61};
+ const std::vector<unsigned char> &result = YAML::DecodeBase64(input);
+ EXPECT_EQ(std::string(result.begin(), result.end()), "deadbeef");
+}
+
+TEST(BinaryTest, DecodingNoCrashOnNegative) {
+ std::string input{-58, -1, -99, 109};
+ const std::vector<unsigned char> &result = YAML::DecodeBase64(input);
+ EXPECT_TRUE(result.empty());
+}
diff --git a/lib/yamlcpp/test/create-emitter-tests.py
b/lib/yamlcpp/test/create-emitter-tests.py
index eb753791ec..7295544f1b 100644
--- a/lib/yamlcpp/test/create-emitter-tests.py
+++ b/lib/yamlcpp/test/create-emitter-tests.py
@@ -133,7 +133,7 @@ def expand(template):
for car in expand(template[:1]):
for cdr in expand(template[1:]):
yield car + cdr
-
+
def gen_events():
for template in gen_templates():
@@ -153,7 +153,7 @@ class Writer(object):
def __init__(self, out):
self.out = out
self.indent = 0
-
+
def writeln(self, s):
self.out.write('%s%s\n' % (' ' * self.indent, s))
@@ -166,14 +166,14 @@ class Scope(object):
def __enter__(self):
self.writer.writeln('%s {' % self.name)
self.writer.indent += self.indent
-
+
def __exit__(self, type, value, traceback):
self.writer.indent -= self.indent
self.writer.writeln('}')
def create_emitter_tests(out):
out = Writer(out)
-
+
includes = [
'handler_test.h',
'yaml-cpp/yaml.h',
diff --git a/lib/yamlcpp/test/integration/emitter_test.cpp
b/lib/yamlcpp/test/integration/emitter_test.cpp
index 0ddc67006d..b277d57171 100644
--- a/lib/yamlcpp/test/integration/emitter_test.cpp
+++ b/lib/yamlcpp/test/integration/emitter_test.cpp
@@ -431,6 +431,38 @@ TEST_F(EmitterTest, BlockMapAsKey) {
ExpectEmit("? key: value\n next key: next value\n: total value");
}
+TEST_F(EmitterTest, TaggedBlockMapAsKey) {
+ out << BeginMap;
+ out << Key;
+ out << LocalTag("innerMap");
+ out << BeginMap;
+ out << Key << "key" << Value << "value";
+ out << EndMap;
+ out << Value;
+ out << "outerValue";
+ out << EndMap;
+
+ ExpectEmit(R"(? !innerMap
+ key: value
+: outerValue)");
+}
+
+TEST_F(EmitterTest, TaggedBlockListAsKey) {
+ out << BeginMap;
+ out << Key;
+ out << LocalTag("innerList");
+ out << BeginSeq;
+ out << "listItem";
+ out << EndSeq;
+ out << Value;
+ out << "outerValue";
+ out << EndMap;
+
+ ExpectEmit(R"(? !innerList
+ - listItem
+: outerValue)");
+}
+
TEST_F(EmitterTest, AliasAndAnchor) {
out << BeginSeq;
out << Anchor("fred");
@@ -520,7 +552,7 @@ TEST_F(EmitterTest, VerbatimTagInBlockMap) {
out << Value << VerbatimTag("!waz") << "baz";
out << EndMap;
- ExpectEmit("!<!foo> bar: !<!waz> baz");
+ ExpectEmit("? !<!foo> bar\n: !<!waz> baz");
}
TEST_F(EmitterTest, VerbatimTagInFlowMap) {
@@ -899,7 +931,7 @@ TEST_F(EmitterTest, Unicode) {
TEST_F(EmitterTest, DoubleQuotedUnicode) {
out << DoubleQuoted << "\x24 \xC2\xA2 \xE2\x82\xAC \xF0\xA4\xAD\xA2";
- ExpectEmit("\"\x24 \xC2\xA2 \xE2\x82\xAC \xF0\xA4\xAD\xA2\"");
+ ExpectEmit("\"\x24 \xC2\xA2 \xE2\x82\xAC \xF0\xA4\xAD\xA2\"");
}
TEST_F(EmitterTest, EscapedJsonString) {
@@ -918,7 +950,7 @@ TEST_F(EmitterTest, EscapedJsonString) {
}
TEST_F(EmitterTest, EscapedCharacters) {
- out << BeginSeq
+ out << BeginSeq
<< '\x00'
<< '\x0C'
<< '\x0D'
@@ -968,6 +1000,14 @@ TEST_F(EmitterTest, UserType) {
ExpectEmit("- x: 5\n bar: hello\n- x: 3\n bar: goodbye");
}
+TEST_F(EmitterTest, UserType2) {
+ out << BeginSeq;
+ out << Foo(5, "\r");
+ out << EndSeq;
+
+ ExpectEmit("- x: 5\n bar: \"\\r\"");
+}
+
TEST_F(EmitterTest, UserTypeInContainer) {
std::vector<Foo> fv;
fv.push_back(Foo(5, "hello"));
@@ -1398,7 +1438,7 @@ TEST_F(EmitterTest, NaN) {
"bar: .nan");
}
-TEST_F(EmitterTest, ComplexFlowSeqEmbeddingAMapWithNewLine) {
+TEST_F(EmitterTest, ComplexFlowSeqEmbeddingAMapWithNewLine) {
out << YAML::BeginMap;
out << YAML::Key << "NodeA" << YAML::Value << YAML::BeginMap;
@@ -1616,6 +1656,15 @@ NodeB:
k: [*k0, *k1])");
}
+TEST_F(EmitterTest, AnchorEncoding) {
+ Node node;
+ node["--- &$ [*$]1"] = 1;
+ out << node;
+ ExpectEmit("\"--- &$ [*$]1\": 1");
+ Node reparsed = YAML::Load(out.c_str());
+ EXPECT_EQ(reparsed["--- &$ [*$]1"].as<int>(), 1);
+}
+
class EmitterErrorTest : public ::testing::Test {
protected:
void ExpectEmitError(const std::string& expectedError) {
@@ -1686,5 +1735,6 @@ TEST_F(EmitterErrorTest, InvalidAlias) {
ExpectEmitError(ErrorMsg::INVALID_ALIAS);
}
+
} // namespace
} // namespace YAML
diff --git a/lib/yamlcpp/test/integration/error_messages_test.cpp
b/lib/yamlcpp/test/integration/error_messages_test.cpp
index 16d51c7104..64ab6b9e5e 100644
--- a/lib/yamlcpp/test/integration/error_messages_test.cpp
+++ b/lib/yamlcpp/test/integration/error_messages_test.cpp
@@ -23,7 +23,7 @@ TEST(ErrorMessageTest, BadSubscriptErrorMessage) {
// Test that printable key is part of error message
EXPECT_THROW_EXCEPTION(YAML::BadSubscript, doc["first"]["second"]["fourth"],
"operator[] call on a scalar (key: \"fourth\")");
-
+
EXPECT_THROW_EXCEPTION(YAML::BadSubscript, doc["first"]["second"][37],
"operator[] call on a scalar (key: \"37\")");
@@ -47,15 +47,15 @@ TEST(ErrorMessageTest, Ex9_1_InvalidNodeErrorMessage) {
// Test that printable key is part of error message
EXPECT_THROW_EXCEPTION(YAML::InvalidNode, doc["first"]["fourth"].as<int>(),
"invalid node; first invalid key: \"fourth\"");
-
+
EXPECT_THROW_EXCEPTION(YAML::InvalidNode, doc["first"][37].as<int>(),
"invalid node; first invalid key: \"37\"");
-
+
// Non-printable key is not included in error message
EXPECT_THROW_EXCEPTION(YAML::InvalidNode,
doc["first"][std::vector<int>()].as<int>(),
"invalid node; this may result from using a map "
"iterator as a sequence iterator, or vice-versa");
}
-}
+}
}
diff --git a/lib/yamlcpp/test/integration/load_node_test.cpp
b/lib/yamlcpp/test/integration/load_node_test.cpp
index 958e735121..9d0c790fd1 100644
--- a/lib/yamlcpp/test/integration/load_node_test.cpp
+++ b/lib/yamlcpp/test/integration/load_node_test.cpp
@@ -345,5 +345,20 @@ TEST(NodeTest, LoadTagWithNullScalar) {
EXPECT_TRUE(node.IsNull());
}
+TEST(LoadNodeTest, BlockCRNLEncoded) {
+ Node node = Load(
+ "blockText: |\r\n"
+ " some arbitrary text \r\n"
+ " spanning some \r\n"
+ " lines, that are split \r\n"
+ " by CR and NL\r\n"
+ "followup: 1");
+ EXPECT_EQ(
+ "some arbitrary text \nspanning some \nlines, that are split \nby CR and
"
+ "NL\n",
+ node["blockText"].as<std::string>());
+ EXPECT_EQ(1, node["followup"].as<int>());
+}
+
} // namespace
} // namespace YAML
diff --git a/lib/yamlcpp/test/node/node_test.cpp
b/lib/yamlcpp/test/node/node_test.cpp
index 4f577c8461..5f41ef2556 100644
--- a/lib/yamlcpp/test/node/node_test.cpp
+++ b/lib/yamlcpp/test/node/node_test.cpp
@@ -40,6 +40,7 @@ class CustomAllocator : public std::allocator<T> {
template <class T> using CustomVector = std::vector<T,CustomAllocator<T>>;
template <class T> using CustomList = std::list<T,CustomAllocator<T>>;
template <class K, class V, class C=std::less<K>> using CustomMap =
std::map<K,V,C,CustomAllocator<std::pair<const K,V>>>;
+template <class K, class V, class H=std::hash<K>, class P=std::equal_to<K>>
using CustomUnorderedMap =
std::unordered_map<K,V,H,P,CustomAllocator<std::pair<const K,V>>>;
} // anonymous namespace
@@ -322,6 +323,47 @@ TEST(NodeTest, IteratorOnConstUndefinedNode) {
}
EXPECT_EQ(0, count);
}
+
+TEST(NodeTest, InteratorOnSequence) {
+ Node node;
+ node[0] = "a";
+ node[1] = "b";
+ node[2] = "c";
+ EXPECT_TRUE(node.IsSequence());
+
+ std::size_t count = 0;
+ for (iterator it = node.begin(); it != node.end(); ++it)
+ {
+ EXPECT_FALSE(it->IsNull());
+ count++;
+ }
+ EXPECT_EQ(3, count);
+}
+
+TEST(NodeTest, ConstInteratorOnSequence) {
+ Node node;
+ node[0] = "a";
+ node[1] = "b";
+ node[2] = "c";
+ EXPECT_TRUE(node.IsSequence());
+
+ std::size_t count = 0;
+ for (const_iterator it = node.begin(); it != node.end(); ++it)
+ {
+ EXPECT_FALSE(it->IsNull());
+ count++;
+ }
+ EXPECT_EQ(3, count);
+}
+
+#if __cplusplus >= 201703L
+TEST(NodeTest, StdStringViewAsKey) {
+ Node node;
+ std::string_view key = "username";
+ node[key] = "monkey";
+ EXPECT_EQ("monkey", node[key].as<std::string>());
+}
+#endif
TEST(NodeTest, SimpleSubkeys) {
Node node;
@@ -351,6 +393,16 @@ TEST(NodeTest, StdArrayWrongSize) {
(node["evens"].as<std::array<int, 5>>()), ErrorMsg::BAD_CONVERSION);
}
+TEST(NodeTest, StdValrray) {
+ std::valarray<int> evens{{2, 4, 6, 8, 10}};
+ Node node;
+ node["evens"] = evens;
+ std::valarray<int> actualEvens = node["evens"].as<std::valarray<int>>();
+ for (int i = 0; i < evens.size(); ++i) {
+ EXPECT_EQ(evens[i], actualEvens[i]);
+ }
+}
+
TEST(NodeTest, StdVector) {
std::vector<int> primes;
primes.push_back(2);
@@ -435,6 +487,34 @@ TEST(NodeTest, StdMapWithCustomAllocator) {
EXPECT_EQ(squares, actualSquares);
}
+TEST(NodeTest, StdUnorderedMap) {
+ std::unordered_map<int, int> squares;
+ squares[0] = 0;
+ squares[1] = 1;
+ squares[2] = 4;
+ squares[3] = 9;
+ squares[4] = 16;
+
+ Node node;
+ node["squares"] = squares;
+ std::unordered_map<int, int> actualSquares =
node["squares"].as<std::unordered_map<int, int>>();
+ EXPECT_EQ(squares, actualSquares);
+}
+
+TEST(NodeTest, StdUnorderedMapWithCustomAllocator) {
+ CustomUnorderedMap<int,int> squares;
+ squares[0] = 0;
+ squares[1] = 1;
+ squares[2] = 4;
+ squares[3] = 9;
+ squares[4] = 16;
+
+ Node node;
+ node["squares"] = squares;
+ CustomUnorderedMap<int,int> actualSquares =
node["squares"].as<CustomUnorderedMap<int,int>>();
+ EXPECT_EQ(squares, actualSquares);
+}
+
TEST(NodeTest, StdPair) {
std::pair<int, std::string> p;
p.first = 5;
diff --git a/lib/yamlcpp/util/parse.cpp b/lib/yamlcpp/util/parse.cpp
index f3f0279ce5..ea4295a67a 100644
--- a/lib/yamlcpp/util/parse.cpp
+++ b/lib/yamlcpp/util/parse.cpp
@@ -5,19 +5,6 @@
#include "yaml-cpp/eventhandler.h"
#include "yaml-cpp/yaml.h" // IWYU pragma: keep
-struct Params {
- bool hasFile;
- std::string fileName;
-};
-
-Params ParseArgs(int argc, char** argv) {
- Params p;
-
- std::vector<std::string> args(argv + 1, argv + argc);
-
- return p;
-}
-
class NullEventHandler : public YAML::EventHandler {
public:
void OnDocumentStart(const YAML::Mark&) override {}
@@ -47,8 +34,6 @@ void parse(std::istream& input) {
}
int main(int argc, char** argv) {
- Params p = ParseArgs(argc, argv);
-
if (argc > 1) {
std::ifstream fin;
fin.open(argv[1]);
diff --git a/lib/yamlcpp/yaml-cpp-config.cmake.in
b/lib/yamlcpp/yaml-cpp-config.cmake.in
index 7b41e3f30c..799b9b4180 100644
--- a/lib/yamlcpp/yaml-cpp-config.cmake.in
+++ b/lib/yamlcpp/yaml-cpp-config.cmake.in
@@ -1,14 +1,22 @@
# - Config file for the yaml-cpp package
# It defines the following variables
-# YAML_CPP_INCLUDE_DIR - include directory
-# YAML_CPP_LIBRARIES - libraries to link against
+# YAML_CPP_INCLUDE_DIR - include directory
+# YAML_CPP_LIBRARY_DIR - directory containing libraries
+# YAML_CPP_SHARED_LIBS_BUILT - whether we have built shared libraries or not
+# YAML_CPP_LIBRARIES - libraries to link against
-# Compute paths
-get_filename_component(YAML_CPP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
-set(YAML_CPP_INCLUDE_DIR "@CONFIG_INCLUDE_DIRS@")
+@PACKAGE_INIT@
+
+set_and_check(YAML_CPP_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
+set_and_check(YAML_CPP_LIBRARY_DIR "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
+
+# Are we building shared libraries?
+set(YAML_CPP_SHARED_LIBS_BUILT "@PACKAGE_YAML_BUILD_SHARED_LIBS@")
# Our library dependencies (contains definitions for IMPORTED targets)
-include("${YAML_CPP_CMAKE_DIR}/yaml-cpp-targets.cmake")
+include(@PACKAGE_CONFIG_EXPORT_DIR@/yaml-cpp-targets.cmake)
# These are IMPORTED targets created by yaml-cpp-targets.cmake
set(YAML_CPP_LIBRARIES "@EXPORT_TARGETS@")
+
+check_required_components(@EXPORT_TARGETS@)
diff --git a/lib/yamlcpp/yaml-cpp.pc.in b/lib/yamlcpp/yaml-cpp.pc.in
index f713de636a..d02dc9e569 100644
--- a/lib/yamlcpp/yaml-cpp.pc.in
+++ b/lib/yamlcpp/yaml-cpp.pc.in
@@ -1,7 +1,7 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
-libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
Name: Yaml-cpp
Description: A YAML parser and emitter for C++
diff --git a/m4/yaml-cpp.m4 b/m4/yaml-cpp.m4
index 2f618f442a..baf36fa8fa 100644
--- a/m4/yaml-cpp.m4
+++ b/m4/yaml-cpp.m4
@@ -82,7 +82,7 @@ fi
AC_SUBST([YAMLCPP_INCLUDES])
AC_SUBST([YAMLCPP_LIBS])
AC_SUBST([YAMLCPP_LDFLAGS])
-AC_DEFINE([YAMLCPP_LIB_VERSION], ["0.7.0"], [yamlcpp library version])
+AC_DEFINE([YAMLCPP_LIB_VERSION], ["0.8.0"], [yamlcpp library version])
])
diff --git a/tests/gold_tests/jsonrpc/plugins/jsonrpc_plugin_handler_test.cc
b/tests/gold_tests/jsonrpc/plugins/jsonrpc_plugin_handler_test.cc
index f90dee016e..8a8dbe52bf 100644
--- a/tests/gold_tests/jsonrpc/plugins/jsonrpc_plugin_handler_test.cc
+++ b/tests/gold_tests/jsonrpc/plugins/jsonrpc_plugin_handler_test.cc
@@ -38,7 +38,7 @@ namespace
{
constexpr char PLUGIN_NAME[] = "jsonrpc_plugin_handler_test";
-const std::string MY_YAML_VERSION{"0.7.0"};
+const std::string MY_YAML_VERSION{"0.8.0"};
const std::string RPC_PROVIDER_NAME{"RPC Plugin test"};
} // namespace
diff --git a/tools/git/pre-commit b/tools/git/pre-commit
index 701cecbee6..40a05119be 100755
--- a/tools/git/pre-commit
+++ b/tools/git/pre-commit
@@ -56,7 +56,7 @@ autopep8_patch_file=$(mktemp -t autopep8.XXXXXXXXXX)
trap "rm -f $clang_patch_file $autopep8_patch_file" 0 1 2 3 5 15
# Loop over all files that are changed, and produce a diff file
-git diff-index --cached --diff-filter=ACMR --name-only HEAD | grep -vE
"lib/(?:yamlcpp|swoc)" | while read file; do
+git diff-index --cached --diff-filter=ACMR --name-only HEAD | grep -vE
"lib/(yamlcpp|swoc)" | while read file; do
case "$file" in
*.cc | *.c | *.h | *.h.in)
${FORMAT} "$file" | diff -u "$file" - >>"$clang_patch_file"