From 99d744d39f71c61ebe7bc26417e6c15a4842e0a1 Mon Sep 17 00:00:00 2001 From: petervwyatt <26521615+petervwyatt@users.noreply.github.com> Date: Fri, 1 Oct 2021 07:10:39 +1000 Subject: [PATCH] Fix AppleClang warnings --- TestGrammar/src/CheckGrammar.cpp | 9 ++++++--- TestGrammar/src/PredicateProcessor.cpp | 2 ++ TestGrammar/src/Utils.cpp | 9 ++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/TestGrammar/src/CheckGrammar.cpp b/TestGrammar/src/CheckGrammar.cpp index bc72fcb5..1265757e 100755 --- a/TestGrammar/src/CheckGrammar.cpp +++ b/TestGrammar/src/CheckGrammar.cpp @@ -407,17 +407,20 @@ void ValidateGrammarFolder(const fs::path& grammar_folder, bool verbose, std::os std::string all_links = remove_link_predicates(vc[TSV_LINK]); if (all_links != "") { std::vector links = split(all_links, ';'); - for (auto& type_link : links) - if ((type_link != "") && (type_link != "[]")) + for (auto& type_link : links) { + if ((type_link != "") && (type_link != "[]")) { if ((type_link[0] == '[') && type_link[type_link.size()-1] == ']') { std::vector direct_links = split(type_link.substr(1, type_link.size() - 2), ','); // strip [ and ] then split by COMMA for (auto& lnk : direct_links) - if (lnk != "") + if (lnk != "") { to_process.push_back(lnk + ".tsv"); + } } else { ofs << "Error: " << gfile << " has bad link '" << type_link << "' - missing enclosing [ ]" << std::endl; } + } + } // for } } // for } diff --git a/TestGrammar/src/PredicateProcessor.cpp b/TestGrammar/src/PredicateProcessor.cpp index 5e400c36..9459bf57 100644 --- a/TestGrammar/src/PredicateProcessor.cpp +++ b/TestGrammar/src/PredicateProcessor.cpp @@ -786,6 +786,8 @@ bool check_key_value(ArlPDFDictionary* dict, const std::wstring& key, const std: if (val == i) return true; break; + default: /* fallthrough */ + break; } // switch } return false; diff --git a/TestGrammar/src/Utils.cpp b/TestGrammar/src/Utils.cpp index 317440b1..3d1b5d0b 100755 --- a/TestGrammar/src/Utils.cpp +++ b/TestGrammar/src/Utils.cpp @@ -368,15 +368,18 @@ bool check_valid_array_definition(const std::string& fname, const std::vector 0); // Trivial cases special-cased - if (keys.size() == 1) - if ((keys[0] == "*") || (keys[0] == "0")) + if (keys.size() == 1) { + if ((keys[0] == "*") || (keys[0] == "0")) { return true; + } else if (keys[0] == "0*") { ofs << "Warning: single element array with '0*' should use '*' " << fname << std::endl; return true; } - else + else { return false; + } + } int idx; int first_wildcard = -1;