Skip to content
Merged
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
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ set(CMAKE_EXE_LINKER_FLAGS_DEBUG "")
# Apply patch on submodules
apply_patch(${CMAKE_CURRENT_SOURCE_DIR}/external/json)
apply_patch(${CMAKE_CURRENT_SOURCE_DIR}/external/json-schema-validator)
apply_patch(${CMAKE_CURRENT_SOURCE_DIR}/external/cxxopts)
apply_patch(${CMAKE_CURRENT_SOURCE_DIR}/external/xerces-c)
apply_patch(${CMAKE_CURRENT_SOURCE_DIR}/external/yaml-cpp)

Expand Down
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ or testing purposes.
| Component | Version | License | Origin | Usage |
| --------- | ------- | ------- | ------ | ----- |
|Google C++ Testing Framework|1.11.0|[BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause)|https://github.com/google/googletest.git| Testing |
|cxxopts|2.2.1|[MIT](https://opensource.org/licenses/MIT)|https://github.com/jarro2783/cxxopts.git| packgen |
|yaml-cpp|0.7.0|[MIT](https://opensource.org/licenses/MIT)|https://github.com/jbeder/yaml-cpp.git| packgen |
|cxxopts|3.3.1|[MIT](https://opensource.org/licenses/MIT)|https://github.com/jarro2783/cxxopts.git| cbuildgen, ctrace, packchk, packgen, projmgr, svdconv |
|yaml-cpp|0.9.0|[MIT](https://opensource.org/licenses/MIT)|https://github.com/jbeder/yaml-cpp.git| YmlTree, YmlSchemaChecker, ctrace, packgen, projmgr |
|OpenCSD|1.8.3|[BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause)|https://github.com/Linaro/OpenCSD.git| ctrace |
|[GetGitRevisionDescription.cmake](./cmake/GetGitRevisionDescription.cmake)||[Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt)||Continuous integration|
|[GetGitRevisionDescription.cmake.in](./cmake/GetGitRevisionDescription.cmake.in)||[Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt)||Continuous integration|
Expand Down
17 changes: 0 additions & 17 deletions external/cxxopts.patch

This file was deleted.

2 changes: 1 addition & 1 deletion external/yaml-cpp
Submodule yaml-cpp updated 336 files
47 changes: 24 additions & 23 deletions external/yaml-cpp.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 46dc180..b746ac1 100644
index 631bfa3..a450934 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
# 3.5 is actually available almost everywhere, but this a good minimum
-cmake_minimum_required(VERSION 3.4)
+cmake_minimum_required(VERSION 3.10)
@@ -1,6 +1,6 @@
# 3.5 is actually available almost everywhere.
# 3.30 as the upper policy limit avoids CMake deprecation warnings.
-cmake_minimum_required(VERSION 3.5...3.30)
+cmake_minimum_required(VERSION 3.10...3.30)

# enable MSVC_RUNTIME_LIBRARY target property
# see https://cmake.org/cmake/help/latest/policy/CMP0091.html
Expand All @@ -22,18 +23,18 @@ index 976d149..ba73a48 100644
// bool manipulators
YesNoBool, // yes, no
diff --git a/include/yaml-cpp/exceptions.h b/include/yaml-cpp/exceptions.h
index f6b2602..a4c5537 100644
index 99e06b2..2a642a4 100644
--- a/include/yaml-cpp/exceptions.h
+++ b/include/yaml-cpp/exceptions.h
@@ -87,6 +87,7 @@ const char* const INVALID_ANCHOR = "invalid anchor";
@@ -89,6 +89,7 @@ const char* const INVALID_ANCHOR = "invalid anchor";
const char* const INVALID_ALIAS = "invalid alias";
const char* const INVALID_TAG = "invalid tag";
const char* const BAD_FILE = "bad file";
+const char* const NON_UNIQUE_MAP_KEY = "map keys must be unique";

template <typename T>
inline const std::string KEY_NOT_FOUND_WITH_KEY(
@@ -298,6 +299,16 @@ class YAML_CPP_API BadFile : public Exception {
@@ -300,6 +301,16 @@ class YAML_CPP_API BadFile : public Exception {
BadFile(const BadFile&) = default;
~BadFile() YAML_CPP_NOEXCEPT override;
};
Expand Down Expand Up @@ -77,19 +78,19 @@ index 07cf81a..ed7d9cd 100644
void convert_sequence_to_map(const shared_memory_holder& pMemory);

diff --git a/src/emitter.cpp b/src/emitter.cpp
index 4d48307..a188cca 100644
index e5fc0ea..f98c605 100644
--- a/src/emitter.cpp
+++ b/src/emitter.cpp
@@ -721,7 +721,7 @@ Emitter& Emitter::Write(const std::string& str) {
@@ -722,7 +722,7 @@ Emitter& Emitter::Write(const char* str, std::size_t size) {

StringEscaping::value stringEscaping = GetStringEscapingStyle(m_pState->GetOutputCharset());

- const StringFormat::value strFormat =
+ const StringFormat::value strFormat = str.compare(0, 2, "|\n") == 0 ? StringFormat::Literal :
Utils::ComputeStringFormat(str, m_pState->GetStringFormat(),
+ const StringFormat::value strFormat = size >= 2 && str[0] == '|' && str[1] == '\n' ? StringFormat::Literal :
Utils::ComputeStringFormat(str, size, m_pState->GetStringFormat(),
m_pState->CurGroupFlowType(), stringEscaping == StringEscaping::NonAscii);

@@ -816,6 +816,8 @@ const char* Emitter::ComputeNullName() const {
@@ -821,6 +821,8 @@ const char* Emitter::ComputeNullName() const {
return "NULL";
case CamelNull:
return "Null";
Expand All @@ -111,18 +112,18 @@ index 3dbe401..0dd0b17 100644
_Set(m_nullFmt, value, scope);
return true;
diff --git a/src/emitterutils.cpp b/src/emitterutils.cpp
index 6cdf6de..b48b7c0 100644
index 1541e17..f64a2ec 100644
--- a/src/emitterutils.cpp
+++ b/src/emitterutils.cpp
@@ -365,7 +365,7 @@ bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str,
@@ -366,7 +366,7 @@ bool WriteDoubleQuotedString(ostream_wrapper& out, const char* str, std::size_t

bool WriteLiteralString(ostream_wrapper& out, const std::string& str,
bool WriteLiteralString(ostream_wrapper& out, const char* str, std::size_t size,
std::size_t indent) {
- out << "|\n";
+ out << (str.compare(0, 2, "|\n") == 0 ? "" : "|\n");
+ out << (size >= 2 && str[0] == '|' && str[1] == '\n' ? "" : "|\n");
int codePoint;
for (std::string::const_iterator i = str.begin();
GetNextCodePointAndAdvance(codePoint, i, str.end());) {
for (const char* i = str;
GetNextCodePointAndAdvance(codePoint, i, str + size);) {
diff --git a/src/exceptions.cpp b/src/exceptions.cpp
index 43a7976..af99fd6 100644
--- a/src/exceptions.cpp
Expand All @@ -147,7 +148,7 @@ index c8837f0..5db3ee4 100644
}
inline const RegEx Comment() {
diff --git a/src/node_data.cpp b/src/node_data.cpp
index 8f5422a..23ad892 100644
index 6653bc1..dbfb941 100644
--- a/src/node_data.cpp
+++ b/src/node_data.cpp
@@ -279,7 +279,12 @@ void node_data::reset_map() {
Expand All @@ -165,13 +166,13 @@ index 8f5422a..23ad892 100644

if (!key.is_defined() || !value.is_defined())
diff --git a/test/integration/load_node_test.cpp b/test/integration/load_node_test.cpp
index 9d0c790..37355aa 100644
index 49f2b61..653c487 100644
--- a/test/integration/load_node_test.cpp
+++ b/test/integration/load_node_test.cpp
@@ -360,5 +360,9 @@ TEST(LoadNodeTest, BlockCRNLEncoded) {
EXPECT_EQ(1, node["followup"].as<int>());
@@ -447,5 +447,9 @@ TEST(LoadNodeTest, BlockCREncoded) {
}


+TEST(LoadNodeTest, NonUniqueMapKey) {
+ EXPECT_THROW(Load("{a: A, b: B, a: A}"), NonUniqueMapKey);
+}
Expand Down
35 changes: 35 additions & 0 deletions libs/ymltree/test/YmlTreeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "RteFsUtils.h"
#include "XmlFormatter.h"
#include "YmlFormatter.h"
#include "yaml-cpp/yaml.h"

#include <vector>
#include <list>
Expand Down Expand Up @@ -55,6 +56,40 @@ class YmlTreeTestF :public ::testing::Test {

};

TEST(YmlTreeTest, PatchedYamlBehavior) {
EXPECT_THROW(YAML::Load("{a: A, b: B, a: A}"), YAML::NonUniqueMapKey);

YAML::Node map(YAML::NodeType::Map);
map.force_insert("key", "first");
EXPECT_NO_THROW(map.force_insert("key", "second"));
EXPECT_EQ(2u, map.size());

YAML::Emitter nullEmitter;
ASSERT_TRUE(nullEmitter.SetNullFormat(YAML::EmptyNull));
nullEmitter << YAML::BeginMap << YAML::Key << "key" << YAML::Value
<< YAML::Null << YAML::EndMap;
EXPECT_STREQ("key: ", nullEmitter.c_str());

YAML::Emitter literalEmitter;
literalEmitter << std::string("|\n first\n second");
EXPECT_STREQ(" |\n first\n second", literalEmitter.c_str());

const std::string literal = "|\n first\n second";
YAML::Emitter literalBufferEmitter;
literalBufferEmitter.Write(literal.data(), literal.size());
EXPECT_STREQ(literalEmitter.c_str(), literalBufferEmitter.c_str());

const char shortBuffer[] = {'|', '\n'};
YAML::Emitter bufferEmitter;
bufferEmitter.Write(shortBuffer, 1);
EXPECT_STREQ("\"|\"", bufferEmitter.c_str());

YAML::Emitter ampersandEmitter;
ampersandEmitter << "A&B";
EXPECT_STREQ("A&B", ampersandEmitter.c_str());
EXPECT_EQ("A&B", YAML::Load(ampersandEmitter.c_str()).as<std::string>());
}

TEST(YmlTreeTest, InvalidInput) {
const string yaml_input ="invalid: 1 : 2";

Expand Down
2 changes: 1 addition & 1 deletion tools/buildmgr/cbuildgen/src/CbuildGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ int CbuildGen::RunCbuildGen(int argc, char **argv, char** envp) {
options.parse_positional({"args"});
parseResult = options.parse(argc, argv);
}
catch (cxxopts::OptionException& e) {
catch (cxxopts::exceptions::exception& e) {
LogMsg("M217", VAL("MSG", e.what()));
console.Usage();
return 1;
Expand Down
8 changes: 4 additions & 4 deletions tools/ctrace/docs/THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ provided in `THIRD_PARTY_LICENSES/OpenCSD-NOTICE.txt`.

| Component | Version | License | Source |
| --------- | ------: | ------------ | -------------------------------------- |
| cxxopts | 3.0.0 | MIT | <https://github.com/jarro2783/cxxopts> |
| yaml-cpp | 0.8.0 | MIT | <https://github.com/jbeder/yaml-cpp> |
| cxxopts | 3.3.1 | MIT | <https://github.com/jarro2783/cxxopts> |
| yaml-cpp | 0.9.0 | MIT | <https://github.com/jbeder/yaml-cpp> |
| OpenCSD | 1.8.3 | BSD-3-Clause | <https://github.com/Linaro/OpenCSD> |

The source revisions used for this notice are pinned by the devtools gitlinks:

- cxxopts: `df229cff0d5b96e146f3f11441f714e8e240cad0`
- yaml-cpp: `f7320141120f720aecc4c32be25586e7da9eb978`
- cxxopts: `44380e5a44706ab7347f400698c703eb2a196202`
- yaml-cpp: `56e3bb550c91fd7005566f19c079cb7a503223cf`
- OpenCSD: `59f15320637ce6e510604e7bed550d7ad109d15d`

GoogleTest is used only to build the test executable and is not incorporated
Expand Down
2 changes: 1 addition & 1 deletion tools/packchk/src/ParseOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ ParseOptions::Result ParseOptions::Parse(int argc, const char** argv)
}
}
}
catch (cxxopts::OptionException& e) {
catch (cxxopts::exceptions::exception& e) {
cerr << fileName << " error: " << e.what() << endl;
return Result::Error;
}
Expand Down
2 changes: 1 addition & 1 deletion tools/packgen/src/PackGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ int PackGen::RunPackGen(int argc, char **argv) {
cout << options.help() << endl;
return 0;
}
} catch (cxxopts::OptionException& e) {
} catch (cxxopts::exceptions::exception& e) {
// Print error
cerr << "packgen error: parsing command line failed!" << endl << e.what() << endl;
return 1;
Expand Down
2 changes: 1 addition & 1 deletion tools/projmgr/src/ProjMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ int ProjMgr::ParseCommandLine(int argc, char** argv) {
m_outputDir = parseResult[key].as<std::string>();
m_outputDir = RteFsUtils::AbsolutePath(m_outputDir).generic_string();
}
} catch (cxxopts::OptionException& e) {
} catch (cxxopts::exceptions::exception& e) {
ProjMgrLogger::Get().Error(e.what());
return ErrorCode::ERROR;
}
Expand Down
7 changes: 4 additions & 3 deletions tools/projmgr/src/ProjMgrYamlParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,8 @@ void ProjMgrYamlParser::ParseInt(const YAML::Node& parent, const string& key, in
void ProjMgrYamlParser::ParseMapOfStrings(const YAML::Node& parent, const string& key, map<string, string>& value) {
if (parent[key].IsDefined() && parent[key].IsMap()) {
for (const auto& item : parent[key]) {
value[item.first.as<string>()] = YAML::IsNullString(item.second.as<string>()) ? "" : item.second.as<string>();
const auto text = item.second.as<string>();
value[item.first.as<string>()] = YAML::IsNullString(text.data(), text.size()) ? "" : text;
}
}
}
Expand Down Expand Up @@ -461,7 +462,7 @@ bool ProjMgrYamlParser::ParseDefine(const YAML::Node& defineNode, vector<string>
if (item.IsMap()) {
const auto& elements = item.as<map<string, string>>();
for (auto element : elements) {
if (YAML::IsNullString(element.second)) {
if (YAML::IsNullString(element.second.data(), element.second.size())) {
element.second = "";
}
success &= ValidateDefineStr(element.second);
Expand Down Expand Up @@ -514,7 +515,7 @@ void ProjMgrYamlParser::ParseVectorOfStringPairs(const YAML::Node& parent, const
// This is a special case used by the CMSIS csolution extension
// and may involve redefinitions
if (element.first != "copied-from") {
if (YAML::IsNullString(element.second)) {
if (YAML::IsNullString(element.second.data(), element.second.size())) {
element.second = "";
}
value.push_back(element);
Expand Down
2 changes: 1 addition & 1 deletion tools/svdconv/SVDConv/src/ParseOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ ParseOptions::Result ParseOptions::ParseOpts(int argc, const char* argv[])
}
}
}
catch (cxxopts::OptionException& e) {
catch (cxxopts::exceptions::exception& e) {
cerr << fileName << " error: " << e.what() << endl;
return Result::Error;
}
Expand Down
Loading