mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 14:08:35 +08:00
cmSystemTools::Error(): remove const char* overload
This commit is contained in:

committed by
Brad King

parent
01b6a2c4ee
commit
e884b1b693
@@ -447,7 +447,8 @@ int cmCTestScriptHandler::ExtractVariables()
|
|||||||
if (updateVal) {
|
if (updateVal) {
|
||||||
if (this->UpdateCmd.empty()) {
|
if (this->UpdateCmd.empty()) {
|
||||||
cmSystemTools::Error(
|
cmSystemTools::Error(
|
||||||
updateVar, " specified without specifying CTEST_CVS_COMMAND.");
|
std::string(updateVar) +
|
||||||
|
" specified without specifying CTEST_CVS_COMMAND.");
|
||||||
return 12;
|
return 12;
|
||||||
}
|
}
|
||||||
this->ExtraUpdates.emplace_back(updateVal);
|
this->ExtraUpdates.emplace_back(updateVal);
|
||||||
|
@@ -83,7 +83,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cmStateEnums::UNINITIALIZED:
|
case cmStateEnums::UNINITIALIZED:
|
||||||
cmSystemTools::Error("Found an undefined variable: ", key.c_str());
|
cmSystemTools::Error("Found an undefined variable: " + key);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// TODO : put warning message here
|
// TODO : put warning message here
|
||||||
|
@@ -167,8 +167,8 @@ void CCONV cmAddLinkDirectoryForTarget(void* arg, const char* tgt,
|
|||||||
cmTarget* t = mf->FindLocalNonAliasTarget(tgt);
|
cmTarget* t = mf->FindLocalNonAliasTarget(tgt);
|
||||||
if (!t) {
|
if (!t) {
|
||||||
cmSystemTools::Error(
|
cmSystemTools::Error(
|
||||||
"Attempt to add link directories to non-existent target: ", tgt,
|
"Attempt to add link directories to non-existent target: " +
|
||||||
" for directory ", d);
|
std::string(tgt) + " for directory " + std::string(d));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
t->InsertLinkDirectory(d, mf->GetBacktrace());
|
t->InsertLinkDirectory(d, mf->GetBacktrace());
|
||||||
|
@@ -308,8 +308,7 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger)
|
|||||||
if (!ce.Initialized) {
|
if (!ce.Initialized) {
|
||||||
/*
|
/*
|
||||||
// This should be added in, but is not for now.
|
// This should be added in, but is not for now.
|
||||||
cmSystemTools::Error("Cache entry \"", (*i).first.c_str(),
|
cmSystemTools::Error("Cache entry \"" + i.first + "\" is uninitialized");
|
||||||
"\" is uninitialized");
|
|
||||||
*/
|
*/
|
||||||
} else if (t != cmStateEnums::INTERNAL) {
|
} else if (t != cmStateEnums::INTERNAL) {
|
||||||
// Format is key:type=value
|
// Format is key:type=value
|
||||||
|
@@ -1798,10 +1798,10 @@ int cmGlobalGenerator::Build(
|
|||||||
output += "\n";
|
output += "\n";
|
||||||
if (workdir.Failed()) {
|
if (workdir.Failed()) {
|
||||||
cmSystemTools::SetRunCommandHideConsole(hideconsole);
|
cmSystemTools::SetRunCommandHideConsole(hideconsole);
|
||||||
cmSystemTools::Error("Failed to change directory: ",
|
std::string err = "Failed to change directory: ";
|
||||||
std::strerror(workdir.GetLastResult()));
|
err += std::strerror(workdir.GetLastResult());
|
||||||
output += "Failed to change directory: ";
|
cmSystemTools::Error(err);
|
||||||
output += std::strerror(workdir.GetLastResult());
|
output += err;
|
||||||
output += "\n";
|
output += "\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@@ -44,7 +44,7 @@ void cmInstallExportAndroidMKGenerator::GenerateScript(std::ostream& os)
|
|||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
e << "INSTALL(EXPORT) given unknown export \"" << ExportSet->GetName()
|
e << "INSTALL(EXPORT) given unknown export \"" << ExportSet->GetName()
|
||||||
<< "\"";
|
<< "\"";
|
||||||
cmSystemTools::Error(e.str().c_str());
|
cmSystemTools::Error(e.str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -501,8 +501,11 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
|
|||||||
{
|
{
|
||||||
// Make sure there is a target.
|
// Make sure there is a target.
|
||||||
if (target.empty()) {
|
if (target.empty()) {
|
||||||
cmSystemTools::Error("No target for WriteMakeRule! called with comment: ",
|
std::string err("No target for WriteMakeRule! called with comment: ");
|
||||||
comment);
|
if (comment) {
|
||||||
|
err += comment;
|
||||||
|
}
|
||||||
|
cmSystemTools::Error(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -249,26 +249,6 @@ std::string cmSystemTools::TrimWhitespace(const std::string& s)
|
|||||||
return std::string(start, stop + 1);
|
return std::string(start, stop + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmSystemTools::Error(const char* m1, const char* m2, const char* m3,
|
|
||||||
const char* m4)
|
|
||||||
{
|
|
||||||
std::string message = "CMake Error: ";
|
|
||||||
if (m1) {
|
|
||||||
message += m1;
|
|
||||||
}
|
|
||||||
if (m2) {
|
|
||||||
message += m2;
|
|
||||||
}
|
|
||||||
if (m3) {
|
|
||||||
message += m3;
|
|
||||||
}
|
|
||||||
if (m4) {
|
|
||||||
message += m4;
|
|
||||||
}
|
|
||||||
cmSystemTools::s_ErrorOccured = true;
|
|
||||||
cmSystemTools::Message(message, "Error");
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmSystemTools::Error(const std::string& m)
|
void cmSystemTools::Error(const std::string& m)
|
||||||
{
|
{
|
||||||
std::string message = "CMake Error: " + m;
|
std::string message = "CMake Error: " + m;
|
||||||
@@ -1746,6 +1726,16 @@ void list_item_verbose(FILE* out, struct archive_entry* entry)
|
|||||||
fflush(out);
|
fflush(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ArchiveError(const char* m1, struct archive* a)
|
||||||
|
{
|
||||||
|
std::string message(m1);
|
||||||
|
const char* m2 = archive_error_string(a);
|
||||||
|
if (m2) {
|
||||||
|
message += m2;
|
||||||
|
}
|
||||||
|
cmSystemTools::Error(message);
|
||||||
|
}
|
||||||
|
|
||||||
bool la_diagnostic(struct archive* ar, __LA_SSIZE_T r)
|
bool la_diagnostic(struct archive* ar, __LA_SSIZE_T r)
|
||||||
{
|
{
|
||||||
// See archive.h definition of ARCHIVE_OK for return values.
|
// See archive.h definition of ARCHIVE_OK for return values.
|
||||||
@@ -1815,8 +1805,7 @@ bool extract_tar(const char* outFileName, bool verbose, bool extract)
|
|||||||
struct archive_entry* entry;
|
struct archive_entry* entry;
|
||||||
int r = cm_archive_read_open_file(a, outFileName, 10240);
|
int r = cm_archive_read_open_file(a, outFileName, 10240);
|
||||||
if (r) {
|
if (r) {
|
||||||
cmSystemTools::Error("Problem with archive_read_open_file(): ",
|
ArchiveError("Problem with archive_read_open_file(): ", a);
|
||||||
archive_error_string(a));
|
|
||||||
archive_write_free(ext);
|
archive_write_free(ext);
|
||||||
archive_read_close(a);
|
archive_read_close(a);
|
||||||
return false;
|
return false;
|
||||||
@@ -1827,8 +1816,7 @@ bool extract_tar(const char* outFileName, bool verbose, bool extract)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (r != ARCHIVE_OK) {
|
if (r != ARCHIVE_OK) {
|
||||||
cmSystemTools::Error("Problem with archive_read_next_header(): ",
|
ArchiveError("Problem with archive_read_next_header(): ", a);
|
||||||
archive_error_string(a));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
@@ -1846,8 +1834,7 @@ bool extract_tar(const char* outFileName, bool verbose, bool extract)
|
|||||||
if (extract) {
|
if (extract) {
|
||||||
r = archive_write_disk_set_options(ext, ARCHIVE_EXTRACT_TIME);
|
r = archive_write_disk_set_options(ext, ARCHIVE_EXTRACT_TIME);
|
||||||
if (r != ARCHIVE_OK) {
|
if (r != ARCHIVE_OK) {
|
||||||
cmSystemTools::Error("Problem with archive_write_disk_set_options(): ",
|
ArchiveError("Problem with archive_write_disk_set_options(): ", ext);
|
||||||
archive_error_string(ext));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1858,8 +1845,7 @@ bool extract_tar(const char* outFileName, bool verbose, bool extract)
|
|||||||
}
|
}
|
||||||
r = archive_write_finish_entry(ext);
|
r = archive_write_finish_entry(ext);
|
||||||
if (r != ARCHIVE_OK) {
|
if (r != ARCHIVE_OK) {
|
||||||
cmSystemTools::Error("Problem with archive_write_finish_entry(): ",
|
ArchiveError("Problem with archive_write_finish_entry(): ", ext);
|
||||||
archive_error_string(ext));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1871,8 +1857,7 @@ bool extract_tar(const char* outFileName, bool verbose, bool extract)
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
else {
|
else {
|
||||||
cmSystemTools::Error("Problem with archive_write_header(): ",
|
ArchiveError("Problem with archive_write_header(): ", ext);
|
||||||
archive_error_string(ext));
|
|
||||||
cmSystemTools::Error("Current file: " +
|
cmSystemTools::Error("Current file: " +
|
||||||
cm_archive_entry_pathname(entry));
|
cm_archive_entry_pathname(entry));
|
||||||
break;
|
break;
|
||||||
|
@@ -100,8 +100,6 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Display an error message.
|
* Display an error message.
|
||||||
*/
|
*/
|
||||||
static void Error(const char* m, const char* m2 = nullptr,
|
|
||||||
const char* m3 = nullptr, const char* m4 = nullptr);
|
|
||||||
static void Error(const std::string& m);
|
static void Error(const std::string& m);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user