From 04dddd699979a0d55b8abc970f65d93ee175d5cc Mon Sep 17 00:00:00 2001 From: Jesse Beder Date: Mon, 5 Aug 2024 15:50:36 -0500 Subject: [PATCH] Revert "Fix compile warning with -Wshadow" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 1f5e971f77cdb3a06185b7e134549cc52906da68. 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. --- include/yaml-cpp/emitterstyle.h | 4 ++-- include/yaml-cpp/node/type.h | 4 ++-- src/singledocparser.cpp | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/yaml-cpp/emitterstyle.h b/include/yaml-cpp/emitterstyle.h index 7497d357e..67bb3981b 100644 --- a/include/yaml-cpp/emitterstyle.h +++ b/include/yaml-cpp/emitterstyle.h @@ -8,8 +8,8 @@ #endif namespace YAML { -namespace EmitterStyle { -enum value { Default, Block, Flow }; +struct EmitterStyle { + enum value { Default, Block, Flow }; }; } diff --git a/include/yaml-cpp/node/type.h b/include/yaml-cpp/node/type.h index cc0901c5c..9d55ca966 100644 --- a/include/yaml-cpp/node/type.h +++ b/include/yaml-cpp/node/type.h @@ -8,8 +8,8 @@ #endif namespace YAML { -namespace NodeType { -enum value { Undefined, Null, Scalar, Sequence, Map }; +struct NodeType { + enum value { Undefined, Null, Scalar, Sequence, Map }; }; } diff --git a/src/singledocparser.cpp b/src/singledocparser.cpp index a8e949c2e..22913d198 100644 --- a/src/singledocparser.cpp +++ b/src/singledocparser.cpp @@ -1,3 +1,4 @@ +#include #include #include @@ -92,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();