diff options
author | Brad King <brad.king@kitware.com> | 2021-12-02 16:49:39 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-12-02 16:49:52 (GMT) |
commit | ec8e7ead281eca4a246a2f97abfc06acb237ea84 (patch) | |
tree | f413c20f506a0fee4e35adf0a4c49c831c524815 | |
parent | b2ad2ab37bf4453b364293eeaeafbd4f091937eb (diff) | |
parent | 4b548c10285d80b8781e5572c5cbd706d6c1fe91 (diff) | |
download | CMake-ec8e7ead281eca4a246a2f97abfc06acb237ea84.zip CMake-ec8e7ead281eca4a246a2f97abfc06acb237ea84.tar.gz CMake-ec8e7ead281eca4a246a2f97abfc06acb237ea84.tar.bz2 |
Merge topic 'semi-warnings'
4b548c1028 Source: Fix -Wmissing-variable-declarations warning
29ffa5f48c Source: fix -Wextra-semi-stmt warnings
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6758
-rw-r--r-- | Source/cmCMakePresetsFile.cxx | 46 | ||||
-rw-r--r-- | Source/cmCMakePresetsFileInternal.h | 4 | ||||
-rw-r--r-- | Source/cm_codecvt.cxx | 5 | ||||
-rw-r--r-- | Source/cm_utf8.h | 2 | ||||
-rw-r--r-- | Source/cmake.cxx | 2 |
5 files changed, 29 insertions, 30 deletions
diff --git a/Source/cmCMakePresetsFile.cxx b/Source/cmCMakePresetsFile.cxx index 538b668..4a0742a 100644 --- a/Source/cmCMakePresetsFile.cxx +++ b/Source/cmCMakePresetsFile.cxx @@ -18,7 +18,7 @@ #include "cmSystemTools.h" #define CHECK_EXPAND(out, field, expanders, version) \ - { \ + do { \ switch (ExpandMacros(field, expanders, version)) { \ case ExpandMacroResult::Error: \ return false; \ @@ -28,7 +28,7 @@ case ExpandMacroResult::Ok: \ break; \ } \ - } + } while (false) namespace { enum class CycleStatus @@ -96,7 +96,7 @@ ReadFileResult VisitPreset( return ReadFileResult::INVALID_PRESET; } - CHECK_OK(preset.VisitPresetBeforeInherit()) + CHECK_OK(preset.VisitPresetBeforeInherit()); for (auto const& i : preset.Inherits) { auto parent = presets.find(i); @@ -114,7 +114,7 @@ ReadFileResult VisitPreset( return result; } - CHECK_OK(preset.VisitPresetInherit(parentPreset)) + CHECK_OK(preset.VisitPresetInherit(parentPreset)); for (auto const& v : parentPreset.Environment) { preset.Environment.insert(v); @@ -129,7 +129,7 @@ ReadFileResult VisitPreset( preset.ConditionEvaluator.reset(); } - CHECK_OK(preset.VisitPresetAfterInherit(file.GetVersion(preset))) + CHECK_OK(preset.VisitPresetAfterInherit(file.GetVersion(preset))); cycleStatus[preset.Name] = CycleStatus::Verified; return ReadFileResult::READ_OK; @@ -195,7 +195,7 @@ bool ExpandMacros(const cmCMakePresetsFile& file, const std::vector<MacroExpander>& macroExpanders) { std::string binaryDir = preset.BinaryDir; - CHECK_EXPAND(out, binaryDir, macroExpanders, file.GetVersion(preset)) + CHECK_EXPAND(out, binaryDir, macroExpanders, file.GetVersion(preset)); if (!binaryDir.empty()) { if (!cmSystemTools::FileIsFullPath(binaryDir)) { @@ -207,7 +207,7 @@ bool ExpandMacros(const cmCMakePresetsFile& file, if (!preset.InstallDir.empty()) { std::string installDir = preset.InstallDir; - CHECK_EXPAND(out, installDir, macroExpanders, file.GetVersion(preset)) + CHECK_EXPAND(out, installDir, macroExpanders, file.GetVersion(preset)); if (!cmSystemTools::FileIsFullPath(installDir)) { installDir = cmStrCat(file.SourceDir, '/', installDir); @@ -218,14 +218,14 @@ bool ExpandMacros(const cmCMakePresetsFile& file, if (!preset.ToolchainFile.empty()) { std::string toolchain = preset.ToolchainFile; - CHECK_EXPAND(out, toolchain, macroExpanders, file.GetVersion(preset)) + CHECK_EXPAND(out, toolchain, macroExpanders, file.GetVersion(preset)); out->ToolchainFile = toolchain; } for (auto& variable : out->CacheVariables) { if (variable.second) { CHECK_EXPAND(out, variable.second->Value, macroExpanders, - file.GetVersion(preset)) + file.GetVersion(preset)); } } @@ -237,12 +237,12 @@ bool ExpandMacros(const cmCMakePresetsFile& file, const BuildPreset& preset, const std::vector<MacroExpander>& macroExpanders) { for (auto& target : out->Targets) { - CHECK_EXPAND(out, target, macroExpanders, file.GetVersion(preset)) + CHECK_EXPAND(out, target, macroExpanders, file.GetVersion(preset)); } for (auto& nativeToolOption : out->NativeToolOptions) { CHECK_EXPAND(out, nativeToolOption, macroExpanders, - file.GetVersion(preset)) + file.GetVersion(preset)); } return true; @@ -258,15 +258,15 @@ bool ExpandMacros(const cmCMakePresetsFile& file, const TestPreset& preset, if (out->Output) { CHECK_EXPAND(out, out->Output->OutputLogFile, macroExpanders, - file.GetVersion(preset)) + file.GetVersion(preset)); } if (out->Filter) { if (out->Filter->Include) { CHECK_EXPAND(out, out->Filter->Include->Name, macroExpanders, - file.GetVersion(preset)) + file.GetVersion(preset)); CHECK_EXPAND(out, out->Filter->Include->Label, macroExpanders, - file.GetVersion(preset)) + file.GetVersion(preset)); if (out->Filter->Include->Index) { CHECK_EXPAND(out, out->Filter->Include->Index->IndexFile, @@ -276,24 +276,24 @@ bool ExpandMacros(const cmCMakePresetsFile& file, const TestPreset& preset, if (out->Filter->Exclude) { CHECK_EXPAND(out, out->Filter->Exclude->Name, macroExpanders, - file.GetVersion(preset)) + file.GetVersion(preset)); CHECK_EXPAND(out, out->Filter->Exclude->Label, macroExpanders, - file.GetVersion(preset)) + file.GetVersion(preset)); if (out->Filter->Exclude->Fixtures) { CHECK_EXPAND(out, out->Filter->Exclude->Fixtures->Any, macroExpanders, - file.GetVersion(preset)) + file.GetVersion(preset)); CHECK_EXPAND(out, out->Filter->Exclude->Fixtures->Setup, - macroExpanders, file.GetVersion(preset)) + macroExpanders, file.GetVersion(preset)); CHECK_EXPAND(out, out->Filter->Exclude->Fixtures->Cleanup, - macroExpanders, file.GetVersion(preset)) + macroExpanders, file.GetVersion(preset)); } } } if (out->Execution) { CHECK_EXPAND(out, out->Execution->ResourceSpecFile, macroExpanders, - file.GetVersion(preset)) + file.GetVersion(preset)); } return true; @@ -898,9 +898,9 @@ cmCMakePresetsFile::ReadProjectPresetsInternal(bool allowNoFiles) : ReadFileResult::FILE_NOT_FOUND; } - CHECK_OK(ComputePresetInheritance(this->ConfigurePresets, *this)) - CHECK_OK(ComputePresetInheritance(this->BuildPresets, *this)) - CHECK_OK(ComputePresetInheritance(this->TestPresets, *this)) + CHECK_OK(ComputePresetInheritance(this->ConfigurePresets, *this)); + CHECK_OK(ComputePresetInheritance(this->BuildPresets, *this)); + CHECK_OK(ComputePresetInheritance(this->TestPresets, *this)); for (auto& it : this->ConfigurePresets) { if (!ExpandMacros(*this, it.second.Unexpanded, it.second.Expanded)) { diff --git a/Source/cmCMakePresetsFileInternal.h b/Source/cmCMakePresetsFileInternal.h index 3269276..afb00ce 100644 --- a/Source/cmCMakePresetsFileInternal.h +++ b/Source/cmCMakePresetsFileInternal.h @@ -5,11 +5,11 @@ #include "cmCMakePresetsFile.h" #define CHECK_OK(expr) \ - { \ + do { \ auto _result = expr; \ if (_result != ReadFileResult::READ_OK) \ return _result; \ - } + } while (false) namespace cmCMakePresetsFileInternal { enum class ExpandMacroResult diff --git a/Source/cm_codecvt.cxx b/Source/cm_codecvt.cxx index ddee968..8115306 100644 --- a/Source/cm_codecvt.cxx +++ b/Source/cm_codecvt.cxx @@ -9,11 +9,8 @@ # include <windows.h> # undef max # include "cmsys/Encoding.hxx" -#endif -#if defined(_WIN32) -/* Number of leading ones before a zero in the byte (see cm_utf8.c). */ -extern "C" unsigned char const cm_utf8_ones[256]; +# include "cm_utf8.h" #endif codecvt::codecvt(Encoding e) diff --git a/Source/cm_utf8.h b/Source/cm_utf8.h index fa9ed3a..67f3d3f 100644 --- a/Source/cm_utf8.h +++ b/Source/cm_utf8.h @@ -6,6 +6,8 @@ extern "C" { #endif +extern unsigned char const cm_utf8_ones[256]; + /** Decode one UTF-8 character from the input byte range. On success, stores the unicode character number in *pc and returns the first position not extracted. On failure, returns 0. */ diff --git a/Source/cmake.cxx b/Source/cmake.cxx index fda7900..8c6a2ec 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -205,7 +205,7 @@ cmake::cmake(Role role, cmState::Mode mode, cmState::ProjectKind projectKind) exts.ordered.reserve(extList.size()); for (cm::string_view ext : extList) { exts.ordered.emplace_back(ext); - }; + } // Fill unordered set exts.unordered.insert(exts.ordered.begin(), exts.ordered.end()); }; |