diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ea785103..b15b24d20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,7 +64,7 @@ if(MSVC) else() add_compile_options(-Wall -Weffc++ -Wextra) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wglobal-constructors -Wexit-time-destructors -Wweak-vtables -Wvla-extension) + add_compile_options(-Wglobal-constructors -Wexit-time-destructors -Wweak-vtables -Wvla-extension -Wctad-maybe-unsupported) endif() # Improve code security diff --git a/src/inflection/grammar/synthesis/HeGrammarSynthesizer_WithConditionalHyphen.cpp b/src/inflection/grammar/synthesis/HeGrammarSynthesizer_WithConditionalHyphen.cpp index f8408be6c..da39ee628 100644 --- a/src/inflection/grammar/synthesis/HeGrammarSynthesizer_WithConditionalHyphen.cpp +++ b/src/inflection/grammar/synthesis/HeGrammarSynthesizer_WithConditionalHyphen.cpp @@ -8,6 +8,7 @@ #include #include #include +#include namespace inflection::grammar::synthesis { diff --git a/src/inflection/grammar/synthesis/KoGrammarSynthesizer_ParticleResolver.cpp b/src/inflection/grammar/synthesis/KoGrammarSynthesizer_ParticleResolver.cpp index 9bc2e9357..cdb68d03e 100644 --- a/src/inflection/grammar/synthesis/KoGrammarSynthesizer_ParticleResolver.cpp +++ b/src/inflection/grammar/synthesis/KoGrammarSynthesizer_ParticleResolver.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/src/inflection/grammar/synthesis/TrGrammarSynthesizer_TrDisplayFunction.cpp b/src/inflection/grammar/synthesis/TrGrammarSynthesizer_TrDisplayFunction.cpp index e76f6443a..f2265f4f5 100644 --- a/src/inflection/grammar/synthesis/TrGrammarSynthesizer_TrDisplayFunction.cpp +++ b/src/inflection/grammar/synthesis/TrGrammarSynthesizer_TrDisplayFunction.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/src/inflection/lang/StringFilterUtil.cpp b/src/inflection/lang/StringFilterUtil.cpp index a411eb2e4..5d25edc01 100644 --- a/src/inflection/lang/StringFilterUtil.cpp +++ b/src/inflection/lang/StringFilterUtil.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include diff --git a/src/inflection/tokenizer/ControlCleaver.cpp b/src/inflection/tokenizer/ControlCleaver.cpp index efcc59818..d3d50178d 100644 --- a/src/inflection/tokenizer/ControlCleaver.cpp +++ b/src/inflection/tokenizer/ControlCleaver.cpp @@ -11,6 +11,7 @@ #include #include #include +#include namespace inflection::tokenizer { diff --git a/src/inflection/tokenizer/TokenUtil.cpp b/src/inflection/tokenizer/TokenUtil.cpp index 18cc317e1..7aee2ee2e 100644 --- a/src/inflection/tokenizer/TokenUtil.cpp +++ b/src/inflection/tokenizer/TokenUtil.cpp @@ -7,6 +7,7 @@ #include #include #include +#include namespace inflection::tokenizer { diff --git a/src/inflection/util/StringViewUtils.cpp b/src/inflection/util/StringViewUtils.cpp index 0387ca6dd..cc19521d4 100644 --- a/src/inflection/util/StringViewUtils.cpp +++ b/src/inflection/util/StringViewUtils.cpp @@ -11,6 +11,7 @@ #include #include #include +#include namespace inflection::util { diff --git a/src/inflection/util/UnicodeSetUtils.cpp b/src/inflection/util/UnicodeSetUtils.cpp index 72c85a45b..e56305ce7 100644 --- a/src/inflection/util/UnicodeSetUtils.cpp +++ b/src/inflection/util/UnicodeSetUtils.cpp @@ -5,6 +5,7 @@ #include #include #include +#include namespace inflection::util { diff --git a/test/src/inflection/dialog/DialogThreadSafetyTest.cpp b/test/src/inflection/dialog/DialogThreadSafetyTest.cpp index c8ece6ff8..5275747f1 100644 --- a/test/src/inflection/dialog/DialogThreadSafetyTest.cpp +++ b/test/src/inflection/dialog/DialogThreadSafetyTest.cpp @@ -82,8 +82,8 @@ TEST_CASE("DialogThreadSafetyTest#testInflect", "[multithreaded]") } const inflection::dialog::SemanticFeatureModel* currModel = nullptr; - std::atomic finished(false); - std::barrier barrier(processorCount + 1); + std::atomic finished(false); + std::barrier<> barrier(processorCount + 1); for (int32_t count = 0; count < processorCount; count++) { results[count].reserve(minimumNumberOfWords); threads.emplace_back(testInflection, &currModel, &phrases, &constraints, &semanticFeatures, &barrier, &finished, count, &results[count]); diff --git a/test/src/inflection/dictionary/MMappedDictionaryTest.cpp b/test/src/inflection/dictionary/MMappedDictionaryTest.cpp index 61078c2d3..071a95276 100644 --- a/test/src/inflection/dictionary/MMappedDictionaryTest.cpp +++ b/test/src/inflection/dictionary/MMappedDictionaryTest.cpp @@ -156,9 +156,10 @@ TEST_CASE("MMappedDictionaryTest#testCompressedArray") TEST_CASE("MMappedDictionaryTest#readInvalidFiles") { auto temporaryPath = createTemporaryFilePath(); - ::inflection::util::Finally finally([&temporaryPath]() noexcept { + auto cleanup = [&temporaryPath]() noexcept { ::std::filesystem::remove(temporaryPath); - }); + }; + ::inflection::util::Finally finally(cleanup); ::std::u16string uPath; ::inflection::util::StringUtils::convert(&uPath, temporaryPath.string()); diff --git a/tools/buildDictionary/InflectionDictionary.cpp b/tools/buildDictionary/InflectionDictionary.cpp index 85541174f..9107363bf 100644 --- a/tools/buildDictionary/InflectionDictionary.cpp +++ b/tools/buildDictionary/InflectionDictionary.cpp @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -183,12 +184,13 @@ static ParsedInflectionData parseXMLDocument(const std::string& source, LIBXML_TEST_VERSION xmlDocPtr xmlDoc = nullptr; - inflection::util::Finally finally([&xmlDoc]() noexcept { + auto cleanup = [&xmlDoc]() noexcept { if (xmlDoc != nullptr) { xmlFreeDoc(xmlDoc); } xmlCleanupParser(); - }); + }; + inflection::util::Finally finally(cleanup); std::u16string resourceName = inflection::util::StringViewUtils::to_u16string(source); inflection::util::MemoryMappedFile mMapFile(resourceName); auto xmlDocSize = mMapFile.getSize(); @@ -336,7 +338,7 @@ void InflectionDictionary::write(::std::ofstream& writer, DictionaryLogger& logg npc(inflection_Suffixes)->write(writer); logger.logWithOffset(locale.getName() + " inflection_Suffixes number=" + std::to_string(npc(inflection_Suffixes)->size())); - inflection::dictionary::metadata::CompressedArray compressedInflectionsArray(inflectionsArray); + inflection::dictionary::metadata::CompressedArray compressedInflectionsArray(inflectionsArray); compressedInflectionsArray.serialize(writer); logger.logWithOffset(locale.getName() + " inflections number=" + std::to_string(inflectionsArray.size())); diff --git a/tools/buildDictionary/LexicalDictionaryBuilder.cpp b/tools/buildDictionary/LexicalDictionaryBuilder.cpp index 0e50f8471..9fd228b79 100644 --- a/tools/buildDictionary/LexicalDictionaryBuilder.cpp +++ b/tools/buildDictionary/LexicalDictionaryBuilder.cpp @@ -400,7 +400,7 @@ void LexicalDictionaryBuilder::writeDictionary(::std::ofstream& writer, propertyNameToKeyId, propertyValuesStringContainer, propertyValueMapsVector); - inflection::dictionary::metadata::CompressedArray propertyValueMaps(propertyValueMapsVector); + inflection::dictionary::metadata::CompressedArray propertyValueMaps(propertyValueMapsVector); propertyValueMapsVector.clear(); propertyValueMapsVector.shrink_to_fit(); @@ -420,11 +420,11 @@ void LexicalDictionaryBuilder::writeDictionary(::std::ofstream& writer, auto dataSingletonsResult = compressDataSingletons(wordsToData, logger, dictionary.getLocale()); { - CompressedArray dataSingletonsRaw(dataSingletonsResult.dataSingletons); + CompressedArray dataSingletonsRaw(dataSingletonsResult.dataSingletons); dataSingletonsResult.dataSingletons.clear(); dataSingletonsResult.dataSingletons.shrink_to_fit(); - MarisaTrie wordsToDataTrie(dataSingletonsResult.use2Stage ? dataSingletonsResult.wordsToDataSingletons : wordsToData); + MarisaTrie wordsToDataTrie(dataSingletonsResult.use2Stage ? dataSingletonsResult.wordsToDataSingletons : wordsToData); dataSingletonsResult.wordsToDataSingletons.clear(); wordsToData.clear(); diff --git a/tools/buildStringMap/buildStringMap.cpp b/tools/buildStringMap/buildStringMap.cpp index dbdf39ebb..908ce95cd 100644 --- a/tools/buildStringMap/buildStringMap.cpp +++ b/tools/buildStringMap/buildStringMap.cpp @@ -157,11 +157,11 @@ void writeBidirectionalTries(const char* outFileName, ::std::map<::std::u16string_view, int32_t> fromIdMap; convertStringValuesToIdentifiers(fromMap, toSetMap, fromIdMap); - ::inflection::dictionary::metadata::MarisaTrie fromTrie(fromIdMap); + ::inflection::dictionary::metadata::MarisaTrie fromTrie(fromIdMap); ::std::map<::std::u16string_view, int32_t> toIdMap; convertStringValuesToIdentifiers(toMap, fromSetMap, toIdMap); - ::inflection::dictionary::metadata::MarisaTrie toTrie(toIdMap); + ::inflection::dictionary::metadata::MarisaTrie toTrie(toIdMap); std::ofstream out(outFileName, std::ios::binary); if (!out) { @@ -190,7 +190,7 @@ void writeSelfReferencingTrie(const char* outFileName, ::std::map<::std::u16string_view, int32_t> combinedIdMap; convertStringValuesToIdentifiers(fromMap, combinedSetMap, combinedIdMap); convertStringValuesToIdentifiers(toMap, combinedSetMap, combinedIdMap); - ::inflection::dictionary::metadata::MarisaTrie combinedTrie(combinedIdMap); + ::inflection::dictionary::metadata::MarisaTrie combinedTrie(combinedIdMap); std::ofstream out(outFileName, std::ios::binary); if (!out) { @@ -284,11 +284,11 @@ int main(int argc, const char * const argv[]) { ::std::map<::std::u16string_view, int32_t> fromIdMap; convertStringValuesToIdentifiers(fromMap, toSetMap, fromIdMap); - ::inflection::dictionary::metadata::MarisaTrie fromTrie(fromIdMap); + ::inflection::dictionary::metadata::MarisaTrie fromTrie(fromIdMap); ::std::map<::std::u16string_view, int32_t> toIdMap; convertStringValuesToIdentifiers(toMap, fromSetMap, toIdMap); - ::inflection::dictionary::metadata::MarisaTrie toTrie(toIdMap); + ::inflection::dictionary::metadata::MarisaTrie toTrie(toIdMap); std::ofstream out(outFileName, std::ios::binary); if (!out) {