summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2016-09-16 20:45:24 (GMT)
committerDaniel Pfeifer <daniel@pfeifer-mail.de>2016-09-16 20:45:24 (GMT)
commit516f8edb2e061749c56b6f9a58332fbf59e45a1a (patch)
tree82ebe3f38b5248ef0b78586019ac1dca44ce2370 /Source/cmFileCommand.cxx
parentd9f5d3c50fe376423382d6445f7fb2906a43469e (diff)
downloadCMake-516f8edb2e061749c56b6f9a58332fbf59e45a1a.zip
CMake-516f8edb2e061749c56b6f9a58332fbf59e45a1a.tar.gz
CMake-516f8edb2e061749c56b6f9a58332fbf59e45a1a.tar.bz2
Avoid else after return
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx58
1 files changed, 34 insertions, 24 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index c10f426..8356fc7 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -104,19 +104,25 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args,
std::string subCommand = args[0];
if (subCommand == "WRITE") {
return this->HandleWriteCommand(args, false);
- } else if (subCommand == "APPEND") {
+ }
+ if (subCommand == "APPEND") {
return this->HandleWriteCommand(args, true);
- } else if (subCommand == "DOWNLOAD") {
+ }
+ if (subCommand == "DOWNLOAD") {
return this->HandleDownloadCommand(args);
- } else if (subCommand == "UPLOAD") {
+ }
+ if (subCommand == "UPLOAD") {
return this->HandleUploadCommand(args);
- } else if (subCommand == "READ") {
+ }
+ if (subCommand == "READ") {
return this->HandleReadCommand(args);
- } else if (subCommand == "MD5" || subCommand == "SHA1" ||
- subCommand == "SHA224" || subCommand == "SHA256" ||
- subCommand == "SHA384" || subCommand == "SHA512") {
+ }
+ if (subCommand == "MD5" || subCommand == "SHA1" || subCommand == "SHA224" ||
+ subCommand == "SHA256" || subCommand == "SHA384" ||
+ subCommand == "SHA512") {
return this->HandleHashCommand(args);
- } else if (subCommand == "STRINGS") {
+ }
+ if (subCommand == "STRINGS") {
return this->HandleStringsCommand(args);
} else if (subCommand == "GLOB") {
return this->HandleGlobCommand(args, false);
@@ -1408,11 +1414,14 @@ bool cmFileCopier::Install(const char* fromFile, const char* toFile)
if (cmSystemTools::SameFile(fromFile, toFile)) {
return true;
- } else if (cmSystemTools::FileIsSymlink(fromFile)) {
+ }
+ if (cmSystemTools::FileIsSymlink(fromFile)) {
return this->InstallSymlink(fromFile, toFile);
- } else if (cmSystemTools::FileIsDirectory(fromFile)) {
+ }
+ if (cmSystemTools::FileIsDirectory(fromFile)) {
return this->InstallDirectory(fromFile, toFile, match_properties);
- } else if (cmSystemTools::FileExists(fromFile)) {
+ }
+ if (cmSystemTools::FileExists(fromFile)) {
return this->InstallFile(fromFile, toFile, match_properties);
}
return this->ReportMissing(fromFile);
@@ -3129,20 +3138,20 @@ bool cmFileCommand::HandleLockCommand(std::vector<std::string> const& args)
if (i >= args.size()) {
this->Makefile->IssueMessage(cmake::FATAL_ERROR, merr);
return false;
+ }
+ if (args[i] == "FUNCTION") {
+ guard = GUARD_FUNCTION;
+ } else if (args[i] == "FILE") {
+ guard = GUARD_FILE;
+ } else if (args[i] == "PROCESS") {
+ guard = GUARD_PROCESS;
} else {
- if (args[i] == "FUNCTION") {
- guard = GUARD_FUNCTION;
- } else if (args[i] == "FILE") {
- guard = GUARD_FILE;
- } else if (args[i] == "PROCESS") {
- guard = GUARD_PROCESS;
- } else {
- std::ostringstream e;
- e << merr << ", but got:\n \"" << args[i] << "\".";
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
- return false;
- }
+ std::ostringstream e;
+ e << merr << ", but got:\n \"" << args[i] << "\".";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return false;
}
+
} else if (args[i] == "RESULT_VARIABLE") {
++i;
if (i >= args.size()) {
@@ -3259,7 +3268,8 @@ bool cmFileCommand::HandleTimestampCommand(
if (args.size() < 3) {
this->SetError("sub-command TIMESTAMP requires at least two arguments.");
return false;
- } else if (args.size() > 5) {
+ }
+ if (args.size() > 5) {
this->SetError("sub-command TIMESTAMP takes at most four arguments.");
return false;
}