From 94a58e502b47c61a71318b18359d505dfafb639a Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 1 Dec 2021 11:02:29 -0500 Subject: cmLocalGenerator: Remove unused IncludePathStyle infrastructure It is unused since commit c564a3e3ff (Ninja: Always compile sources using absolute paths, 2021-05-19, v3.21.0-rc1~129^2), which left behind a FIXME comment to eventually remove it. --- Source/cmExtraSublimeTextGenerator.cxx | 3 +-- Source/cmLocalGenerator.cxx | 9 +++------ Source/cmLocalGenerator.h | 25 +++++++++---------------- Source/cmLocalNinjaGenerator.cxx | 5 +---- Source/cmLocalNinjaGenerator.h | 4 +--- Source/cmNinjaTargetGenerator.cxx | 11 +++-------- 6 files changed, 18 insertions(+), 39 deletions(-) diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index fa93b04..19e87d5 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -435,8 +435,7 @@ std::string cmExtraSublimeTextGenerator::ComputeIncludes( lg->GetIncludeDirectories(includes, target, language, config); std::string includesString = - lg->GetIncludeFlags(includes, target, language, config, false, - cmLocalGenerator::IncludePathStyle::Absolute); + lg->GetIncludeFlags(includes, target, language, config, false); return includesString; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 5e37fe4..a07e298 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -835,16 +835,14 @@ cmValue cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target, } std::string cmLocalGenerator::ConvertToIncludeReference( - std::string const& path, IncludePathStyle pathStyle, OutputFormat format) + std::string const& path, OutputFormat format) { - static_cast(pathStyle); return this->ConvertToOutputForExisting(path, format); } std::string cmLocalGenerator::GetIncludeFlags( std::vector const& includeDirs, cmGeneratorTarget* target, - std::string const& lang, std::string const& config, bool forResponseFile, - IncludePathStyle pathStyle) + std::string const& lang, std::string const& config, bool forResponseFile) { if (lang.empty()) { return ""; @@ -923,8 +921,7 @@ std::string cmLocalGenerator::GetIncludeFlags( } flagUsed = true; } - std::string includePath = - this->ConvertToIncludeReference(i, pathStyle, shellFormat); + std::string includePath = this->ConvertToIncludeReference(i, shellFormat); if (quotePaths && !includePath.empty() && includePath.front() != '\"') { includeFlags << "\""; } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 3edf5dc..5793f29 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -179,18 +179,12 @@ public: bool AppendLWYUFlags(std::string& flags, const cmGeneratorTarget* target, const std::string& lang); - enum class IncludePathStyle - { - Default, - Absolute, - }; - //! Get the include flags for the current makefile and language - std::string GetIncludeFlags( - std::vector const& includes, cmGeneratorTarget* target, - std::string const& lang, std::string const& config, - bool forResponseFile = false, - IncludePathStyle pathStyle = IncludePathStyle::Default); + std::string GetIncludeFlags(std::vector const& includes, + cmGeneratorTarget* target, + std::string const& lang, + std::string const& config, + bool forResponseFile = false); using GeneratorTargetVector = std::vector>; @@ -526,12 +520,11 @@ public: cmValue GetRuleLauncher(cmGeneratorTarget* target, const std::string& prop); protected: - // The default implementation ignores the IncludePathStyle and always - // uses absolute paths. A generator may override this to use relative - // paths in some cases. + // The default implementation converts to a Windows shortpath to + // help older toolchains handle spaces and such. A generator may + // override this to avoid that conversion. virtual std::string ConvertToIncludeReference( - std::string const& path, IncludePathStyle pathStyle, - cmOutputConverter::OutputFormat format); + std::string const& path, cmOutputConverter::OutputFormat format); //! put all the libraries for a target on into the given stream void OutputLinkLibraries(cmComputeLinkInformation* pcli, diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 8556fe6..106f76b 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -205,11 +205,8 @@ cmGlobalNinjaGenerator* cmLocalNinjaGenerator::GetGlobalNinjaGenerator() // Virtual protected methods. std::string cmLocalNinjaGenerator::ConvertToIncludeReference( - std::string const& path, IncludePathStyle pathStyle, - cmOutputConverter::OutputFormat format) + std::string const& path, cmOutputConverter::OutputFormat format) { - // FIXME: Remove IncludePathStyle infrastructure. It is no longer used. - static_cast(pathStyle); return this->ConvertToOutputFormat(path, format); } diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index 6404037..3118bb4 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -12,7 +12,6 @@ #include "cmListFileCache.h" #include "cmLocalCommonGenerator.h" -#include "cmLocalGenerator.h" #include "cmNinjaTypes.h" #include "cmOutputConverter.h" @@ -93,8 +92,7 @@ public: protected: std::string ConvertToIncludeReference( - std::string const& path, IncludePathStyle pathStyle, - cmOutputConverter::OutputFormat format) override; + std::string const& path, cmOutputConverter::OutputFormat format) override; private: cmGeneratedFileStream& GetImplFileStream(const std::string& config) const; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 231433f..191b428 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -263,10 +263,7 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags, language, config); // Add include directory flags. std::string includeFlags = this->LocalGenerator->GetIncludeFlags( - includes, this->GeneratorTarget, language, config, false, - // full include paths for RC needed by cmcldeps - language == "RC" ? cmLocalGenerator::IncludePathStyle::Absolute - : cmLocalGenerator::IncludePathStyle::Default); + includes, this->GeneratorTarget, language, config, false); if (this->GetGlobalGenerator()->IsGCCOnWindows()) { std::replace(includeFlags.begin(), includeFlags.end(), '\\', '/'); } @@ -325,8 +322,7 @@ std::string cmNinjaTargetGenerator::ComputeIncludes( } std::string includesString = this->LocalGenerator->GetIncludeFlags( - includes, this->GeneratorTarget, language, config, false, - cmLocalGenerator::IncludePathStyle::Absolute); + includes, this->GeneratorTarget, language, config, false); this->LocalGenerator->AppendFlags(includesString, this->GetIncludes(language, config)); @@ -1413,8 +1409,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( cmSystemTools::GetParentDirectory(source->GetFullPath())); std::string sourceDirectoryFlag = this->LocalGenerator->GetIncludeFlags( - sourceDirectory, this->GeneratorTarget, language, config, false, - cmLocalGenerator::IncludePathStyle::Default); + sourceDirectory, this->GeneratorTarget, language, config, false); vars["INCLUDES"] = cmStrCat(sourceDirectoryFlag, ' ', vars["INCLUDES"]); } -- cgit v0.12