summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/FindMPI/test_mpi.c2
-rw-r--r--Modules/FindXercesC.cmake2
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmFunctionBlocker.cxx2
-rw-r--r--Source/cmListFileCache.cxx28
-rw-r--r--Source/cmListFileCache.h122
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Source/cmMakefileTargetGenerator.cxx17
-rw-r--r--Source/cmOutputConverter.cxx30
-rw-r--r--Source/cmStandardLexer.h4
10 files changed, 117 insertions, 94 deletions
diff --git a/Modules/FindMPI/test_mpi.c b/Modules/FindMPI/test_mpi.c
index 70d7e1d..36b5dfd 100644
--- a/Modules/FindMPI/test_mpi.c
+++ b/Modules/FindMPI/test_mpi.c
@@ -7,7 +7,7 @@
#endif
#if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
-const static char mpiver_str[] = { 'I', 'N',
+static const char mpiver_str[] = { 'I', 'N',
'F', 'O',
':', 'M',
'P', 'I',
diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake
index af1b0b4..d39bbf6 100644
--- a/Modules/FindXercesC.cmake
+++ b/Modules/FindXercesC.cmake
@@ -91,11 +91,13 @@ if(NOT XercesC_LIBRARY)
NAMES "xerces-c"
"xerces-c_${XercesC_VERSION_MAJOR}"
"xerces-c-${XercesC_VERSION_MAJOR}.${XercesC_VERSION_MINOR}"
+ NAMES_PER_DIR
DOC "Xerces-C++ libraries (release)")
find_library(XercesC_LIBRARY_DEBUG
NAMES "xerces-cd"
"xerces-c_${XercesC_VERSION_MAJOR}D"
"xerces-c_${XercesC_VERSION_MAJOR}_${XercesC_VERSION_MINOR}D"
+ NAMES_PER_DIR
DOC "Xerces-C++ libraries (debug)")
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
select_library_configurations(XercesC)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 2a580b4..f649f9b 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 22)
-set(CMake_VERSION_PATCH 20220125)
+set(CMake_VERSION_PATCH 20220127)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmFunctionBlocker.cxx b/Source/cmFunctionBlocker.cxx
index d4666d7..40e692d 100644
--- a/Source/cmFunctionBlocker.cxx
+++ b/Source/cmFunctionBlocker.cxx
@@ -27,7 +27,7 @@ bool cmFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
if (!this->ArgumentsMatch(lff, mf)) {
cmListFileContext const& lfc = this->GetStartingContext();
cmListFileContext closingContext =
- cmListFileContext::FromCommandContext(lff, lfc.FilePath);
+ cmListFileContext::FromListFileFunction(lff, lfc.FilePath);
std::ostringstream e;
/* clang-format off */
e << "A logical block opening on the line\n"
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 9f8a18f..3da266d 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -369,68 +369,68 @@ cm::optional<cmListFileContext> cmListFileParser::CheckNesting() const
if (name == "if") {
stack.push_back({
NestingStateEnum::If,
- cmListFileContext::FromCommandContext(func, this->FileName),
+ cmListFileContext::FromListFileFunction(func, this->FileName),
});
} else if (name == "elseif") {
if (!TopIs(stack, NestingStateEnum::If)) {
- return cmListFileContext::FromCommandContext(func, this->FileName);
+ return cmListFileContext::FromListFileFunction(func, this->FileName);
}
stack.back() = {
NestingStateEnum::If,
- cmListFileContext::FromCommandContext(func, this->FileName),
+ cmListFileContext::FromListFileFunction(func, this->FileName),
};
} else if (name == "else") {
if (!TopIs(stack, NestingStateEnum::If)) {
- return cmListFileContext::FromCommandContext(func, this->FileName);
+ return cmListFileContext::FromListFileFunction(func, this->FileName);
}
stack.back() = {
NestingStateEnum::Else,
- cmListFileContext::FromCommandContext(func, this->FileName),
+ cmListFileContext::FromListFileFunction(func, this->FileName),
};
} else if (name == "endif") {
if (!TopIs(stack, NestingStateEnum::If) &&
!TopIs(stack, NestingStateEnum::Else)) {
- return cmListFileContext::FromCommandContext(func, this->FileName);
+ return cmListFileContext::FromListFileFunction(func, this->FileName);
}
stack.pop_back();
} else if (name == "while") {
stack.push_back({
NestingStateEnum::While,
- cmListFileContext::FromCommandContext(func, this->FileName),
+ cmListFileContext::FromListFileFunction(func, this->FileName),
});
} else if (name == "endwhile") {
if (!TopIs(stack, NestingStateEnum::While)) {
- return cmListFileContext::FromCommandContext(func, this->FileName);
+ return cmListFileContext::FromListFileFunction(func, this->FileName);
}
stack.pop_back();
} else if (name == "foreach") {
stack.push_back({
NestingStateEnum::Foreach,
- cmListFileContext::FromCommandContext(func, this->FileName),
+ cmListFileContext::FromListFileFunction(func, this->FileName),
});
} else if (name == "endforeach") {
if (!TopIs(stack, NestingStateEnum::Foreach)) {
- return cmListFileContext::FromCommandContext(func, this->FileName);
+ return cmListFileContext::FromListFileFunction(func, this->FileName);
}
stack.pop_back();
} else if (name == "function") {
stack.push_back({
NestingStateEnum::Function,
- cmListFileContext::FromCommandContext(func, this->FileName),
+ cmListFileContext::FromListFileFunction(func, this->FileName),
});
} else if (name == "endfunction") {
if (!TopIs(stack, NestingStateEnum::Function)) {
- return cmListFileContext::FromCommandContext(func, this->FileName);
+ return cmListFileContext::FromListFileFunction(func, this->FileName);
}
stack.pop_back();
} else if (name == "macro") {
stack.push_back({
NestingStateEnum::Macro,
- cmListFileContext::FromCommandContext(func, this->FileName),
+ cmListFileContext::FromListFileFunction(func, this->FileName),
});
} else if (name == "endmacro") {
if (!TopIs(stack, NestingStateEnum::Macro)) {
- return cmListFileContext::FromCommandContext(func, this->FileName);
+ return cmListFileContext::FromListFileFunction(func, this->FileName);
}
stack.pop_back();
}
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index 4a52876..5d45027 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -23,28 +23,6 @@
class cmMessenger;
-struct cmCommandContext
-{
- struct cmCommandName
- {
- std::string Original;
- std::string Lower;
- cmCommandName() = default;
- cmCommandName(std::string name)
- : Original(std::move(name))
- , Lower(cmSystemTools::LowerCase(this->Original))
- {
- }
- } Name;
- long Line = 0;
- cmCommandContext() = default;
- cmCommandContext(std::string name, long line)
- : Name(std::move(name))
- , Line(line)
- {
- }
-};
-
struct cmListFileArgument
{
enum Delimiter
@@ -70,6 +48,54 @@ struct cmListFileArgument
long Line = 0;
};
+class cmListFileFunction
+{
+public:
+ cmListFileFunction(std::string name, long line,
+ std::vector<cmListFileArgument> args)
+ : Impl{ std::make_shared<Implementation>(std::move(name), line,
+ std::move(args)) }
+ {
+ }
+
+ std::string const& OriginalName() const noexcept
+ {
+ return this->Impl->OriginalName;
+ }
+
+ std::string const& LowerCaseName() const noexcept
+ {
+ return this->Impl->LowerCaseName;
+ }
+
+ long Line() const noexcept { return this->Impl->Line; }
+
+ std::vector<cmListFileArgument> const& Arguments() const noexcept
+ {
+ return this->Impl->Arguments;
+ }
+
+private:
+ struct Implementation
+ {
+ Implementation(std::string name, long line,
+ std::vector<cmListFileArgument> args)
+ : OriginalName{ std::move(name) }
+ , LowerCaseName{ cmSystemTools::LowerCase(this->OriginalName) }
+ , Line{ line }
+ , Arguments{ std::move(args) }
+ {
+ }
+
+ std::string OriginalName;
+ std::string LowerCaseName;
+ long Line = 0;
+ std::vector<cmListFileArgument> Arguments;
+ };
+
+ std::shared_ptr<Implementation const> Impl;
+};
+
class cmListFileContext
{
public:
@@ -99,14 +125,14 @@ public:
{
}
- static cmListFileContext FromCommandContext(
- cmCommandContext const& lfcc, std::string const& fileName,
+ static cmListFileContext FromListFileFunction(
+ cmListFileFunction const& lff, std::string const& fileName,
cm::optional<std::string> deferId = {})
{
cmListFileContext lfc;
lfc.FilePath = fileName;
- lfc.Line = lfcc.Line;
- lfc.Name = lfcc.Name.Original;
+ lfc.Line = lff.Line();
+ lfc.Name = lff.OriginalName();
lfc.DeferId = std::move(deferId);
return lfc;
}
@@ -117,50 +143,6 @@ bool operator<(const cmListFileContext& lhs, const cmListFileContext& rhs);
bool operator==(cmListFileContext const& lhs, cmListFileContext const& rhs);
bool operator!=(cmListFileContext const& lhs, cmListFileContext const& rhs);
-class cmListFileFunction
-{
-public:
- cmListFileFunction(std::string name, long line,
- std::vector<cmListFileArgument> args)
- : Impl{ std::make_shared<Implementation>(std::move(name), line,
- std::move(args)) }
- {
- }
-
- std::string const& OriginalName() const noexcept
- {
- return this->Impl->Name.Original;
- }
-
- std::string const& LowerCaseName() const noexcept
- {
- return this->Impl->Name.Lower;
- }
-
- long Line() const noexcept { return this->Impl->Line; }
-
- std::vector<cmListFileArgument> const& Arguments() const noexcept
- {
- return this->Impl->Arguments;
- }
-
- operator cmCommandContext const&() const noexcept { return *this->Impl; }
-
-private:
- struct Implementation : public cmCommandContext
- {
- Implementation(std::string name, long line,
- std::vector<cmListFileArgument> args)
- : cmCommandContext{ std::move(name), line }
- , Arguments{ std::move(args) }
- {
- }
- std::vector<cmListFileArgument> Arguments;
- };
-
- std::shared_ptr<Implementation const> Impl;
-};
-
// Represent a backtrace (call stack). Provide value semantics
// but use efficient reference-counting underneath to avoid copies.
class cmListFileBacktrace
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index cc687b1..68e61bb 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -339,7 +339,7 @@ public:
cm::optional<std::string> deferId, cmExecutionStatus& status)
: Makefile(mf)
{
- cmListFileContext const& lfc = cmListFileContext::FromCommandContext(
+ cmListFileContext const& lfc = cmListFileContext::FromListFileFunction(
lff, this->Makefile->StateSnapshot.GetExecutionListFile(),
std::move(deferId));
this->Makefile->Backtrace = this->Makefile->Backtrace.Push(lfc);
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 5d306ec..1c92c7f 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -16,6 +16,8 @@
#include <cmext/algorithm>
#include <cmext/string_view>
+#include "cm_codecvt.hxx"
+
#include "cmComputeLinkInformation.h"
#include "cmCustomCommand.h"
#include "cmCustomCommandGenerator.h"
@@ -2077,11 +2079,22 @@ std::string cmMakefileTargetGenerator::CreateResponseFile(
const char* name, std::string const& options,
std::vector<std::string>& makefile_depends)
{
+ // FIXME: Find a better way to determine the response file encoding,
+ // perhaps using tool-specific platform information variables.
+ // For now, use the makefile encoding as a heuristic.
+ codecvt::Encoding responseEncoding =
+ this->GlobalGenerator->GetMakefileEncoding();
+ // Non-MSVC tooling may not understand a BOM.
+ if (responseEncoding == codecvt::UTF8_WITH_BOM &&
+ !this->Makefile->IsOn("MSVC")) {
+ responseEncoding = codecvt::UTF8;
+ }
+
// Create the response file.
std::string responseFileNameFull =
cmStrCat(this->TargetBuildDirectoryFull, '/', name);
- cmGeneratedFileStream responseStream(
- responseFileNameFull, false, this->GlobalGenerator->GetMakefileEncoding());
+ cmGeneratedFileStream responseStream(responseFileNameFull, false,
+ responseEncoding);
responseStream.SetCopyIfDifferent(true);
responseStream << options << "\n";
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index 4503038..b143170 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -8,6 +8,11 @@
#include <set>
#include <vector>
+#ifdef _WIN32
+# include <unordered_map>
+# include <utility>
+#endif
+
#include "cmState.h"
#include "cmStateDirectory.h"
#include "cmStringAlgorithms.h"
@@ -117,17 +122,34 @@ std::string cmOutputConverter::MaybeRelativeToCurBinDir(
std::string cmOutputConverter::ConvertToOutputForExisting(
const std::string& remote, OutputFormat format) const
{
+#ifdef _WIN32
+ // Cache the Short Paths since we only convert the same few paths anyway and
+ // calling `GetShortPathNameW` is really expensive.
+ static std::unordered_map<std::string, std::string> shortPathCache{};
+
// If this is a windows shell, the result has a space, and the path
// already exists, we can use a short-path to reference it without a
// space.
if (this->GetState()->UseWindowsShell() &&
remote.find_first_of(" #") != std::string::npos &&
cmSystemTools::FileExists(remote)) {
- std::string tmp;
- if (cmSystemTools::GetShortPath(remote, tmp)) {
- return this->ConvertToOutputFormat(tmp, format);
- }
+
+ std::string shortPath = [&]() {
+ auto cachedShortPathIt = shortPathCache.find(remote);
+
+ if (cachedShortPathIt != shortPathCache.end()) {
+ return cachedShortPathIt->second;
+ }
+
+ std::string tmp{};
+ cmSystemTools::GetShortPath(remote, tmp);
+ shortPathCache[remote] = tmp;
+ return tmp;
+ }();
+
+ return this->ConvertToOutputFormat(shortPath, format);
}
+#endif
// Otherwise, perform standard conversion.
return this->ConvertToOutputFormat(remote, format);
diff --git a/Source/cmStandardLexer.h b/Source/cmStandardLexer.h
index 417f14d..2722528 100644
--- a/Source/cmStandardLexer.h
+++ b/Source/cmStandardLexer.h
@@ -50,6 +50,10 @@
# endif
#endif
+#if defined(__LCC__)
+# pragma diag_suppress 1873 /* comparison between signed and unsigned */
+#endif
+
#if defined(__NVCOMPILER)
# pragma diag_suppress 111 /* statement is unreachable */
# pragma diag_suppress 550 /* variable set but never used */