This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, next has been updated via c974715fbd90bafcc7c639545e748d5a5dca7886 (commit) via 67303794f0bd36912cd9e7e7d0402c3c6fc85a11 (commit) via d23a0196844f066047aa6942b69c6e591462df38 (commit) via 1afbe7d2cca61ecf483f7697b0141a233508603d (commit) from 6fc28b4e5a902faba2cac49158c003d67c3ca1c4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c974715fbd90bafcc7c639545e748d5a5dca7886 commit c974715fbd90bafcc7c639545e748d5a5dca7886 Merge: 6fc28b4 6730379 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue Nov 29 14:43:35 2016 -0500 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Tue Nov 29 14:43:35 2016 -0500 Merge topic 'end-commands' into next 67303794 Combine all unexpected commands to a single class d23a0196 Set the error after argument expansion in end commands 1afbe7d2 Make error message of standalone endwhile command consistent https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=67303794f0bd36912cd9e7e7d0402c3c6fc85a11 commit 67303794f0bd36912cd9e7e7d0402c3c6fc85a11 Author: Daniel Pfeifer <dan...@pfeifer-mail.de> AuthorDate: Sun Nov 27 20:38:57 2016 +0100 Commit: Brad King <brad.k...@kitware.com> CommitDate: Tue Nov 29 13:53:29 2016 -0500 Combine all unexpected commands to a single class diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index f7e0944..5b381b4 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -440,24 +440,10 @@ set(SRCS cmCreateTestSourceList.h cmDefinePropertyCommand.cxx cmDefinePropertyCommand.h - cmElseCommand.cxx - cmElseCommand.h - cmElseIfCommand.cxx - cmElseIfCommand.h cmEnableLanguageCommand.cxx cmEnableLanguageCommand.h cmEnableTestingCommand.cxx cmEnableTestingCommand.h - cmEndForEachCommand.cxx - cmEndForEachCommand.h - cmEndFunctionCommand.cxx - cmEndFunctionCommand.h - cmEndIfCommand.cxx - cmEndIfCommand.h - cmEndMacroCommand.cxx - cmEndMacroCommand.h - cmEndWhileCommand.cxx - cmEndWhileCommand.h cmExecProgramCommand.cxx cmExecProgramCommand.h cmExecuteProcessCommand.cxx @@ -612,6 +598,8 @@ set(SRCS cmTryCompileCommand.h cmTryRunCommand.cxx cmTryRunCommand.h + cmUnexpectedCommand.cxx + cmUnexpectedCommand.h cmUnsetCommand.cxx cmUnsetCommand.h cmUseMangledMesaCommand.cxx diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index 103e72c..4c5b093 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -18,14 +18,8 @@ #include "cmContinueCommand.h" #include "cmCreateTestSourceList.h" #include "cmDefinePropertyCommand.h" -#include "cmElseCommand.h" #include "cmEnableLanguageCommand.h" #include "cmEnableTestingCommand.h" -#include "cmEndForEachCommand.h" -#include "cmEndFunctionCommand.h" -#include "cmEndIfCommand.h" -#include "cmEndMacroCommand.h" -#include "cmEndWhileCommand.h" #include "cmExecProgramCommand.h" #include "cmExecuteProcessCommand.h" #include "cmFileCommand.h" @@ -74,6 +68,7 @@ #include "cmTargetLinkLibrariesCommand.h" #include "cmTryCompileCommand.h" #include "cmTryRunCommand.h" +#include "cmUnexpectedCommand.h" #include "cmUnsetCommand.h" #include "cmWhileCommand.h" @@ -82,7 +77,6 @@ #include "cmAuxSourceDirectoryCommand.h" #include "cmBuildNameCommand.h" #include "cmCMakeHostSystemInformationCommand.h" -#include "cmElseIfCommand.h" #include "cmExportCommand.h" #include "cmExportLibraryDependenciesCommand.h" #include "cmFLTKWrapUICommand.h" @@ -130,14 +124,8 @@ std::vector<cmCommand*> GetPredefinedCommands() commands.push_back(new cmContinueCommand); commands.push_back(new cmCreateTestSourceList); commands.push_back(new cmDefinePropertyCommand); - commands.push_back(new cmElseCommand); commands.push_back(new cmEnableLanguageCommand); commands.push_back(new cmEnableTestingCommand); - commands.push_back(new cmEndForEachCommand); - commands.push_back(new cmEndFunctionCommand); - commands.push_back(new cmEndIfCommand); - commands.push_back(new cmEndMacroCommand); - commands.push_back(new cmEndWhileCommand); commands.push_back(new cmExecProgramCommand); commands.push_back(new cmExecuteProcessCommand); commands.push_back(new cmFileCommand); @@ -189,12 +177,39 @@ std::vector<cmCommand*> GetPredefinedCommands() commands.push_back(new cmUnsetCommand); commands.push_back(new cmWhileCommand); + commands.push_back(new cmUnexpectedCommand( + "else", "An ELSE command was found outside of a proper " + "IF ENDIF structure. Or its arguments did not match " + "the opening IF command.")); + commands.push_back(new cmUnexpectedCommand( + "elseif", "An ELSEIF command was found outside of a proper " + "IF ENDIF structure.")); + commands.push_back(new cmUnexpectedCommand( + "endforeach", "An ENDFOREACH command was found outside of a proper " + "FOREACH ENDFOREACH structure. Or its arguments did " + "not match the opening FOREACH command.")); + commands.push_back(new cmUnexpectedCommand( + "endfunction", "An ENDFUNCTION command was found outside of a proper " + "FUNCTION ENDFUNCTION structure. Or its arguments did not " + "match the opening FUNCTION command.")); + commands.push_back(new cmUnexpectedCommand( + "endif", "An ENDIF command was found outside of a proper " + "IF ENDIF structure. Or its arguments did not match " + "the opening IF command.")); + commands.push_back(new cmUnexpectedCommand( + "endmacro", "An ENDMACRO command was found outside of a proper " + "MACRO ENDMACRO structure. Or its arguments did not " + "match the opening MACRO command.")); + commands.push_back(new cmUnexpectedCommand( + "endwhile", "An ENDWHILE command was found outside of a proper " + "WHILE ENDWHILE structure. Or its arguments did not " + "match the opening WHILE command.")); + #if defined(CMAKE_BUILD_WITH_CMAKE) commands.push_back(new cmAddCompileOptionsCommand); commands.push_back(new cmAuxSourceDirectoryCommand); commands.push_back(new cmBuildNameCommand); commands.push_back(new cmCMakeHostSystemInformationCommand); - commands.push_back(new cmElseIfCommand); commands.push_back(new cmExportCommand); commands.push_back(new cmExportLibraryDependenciesCommand); commands.push_back(new cmFLTKWrapUICommand); diff --git a/Source/cmElseCommand.cxx b/Source/cmElseCommand.cxx deleted file mode 100644 index 207777e..0000000 --- a/Source/cmElseCommand.cxx +++ /dev/null @@ -1,14 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmElseCommand.h" - -class cmExecutionStatus; - -bool cmElseCommand::InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) -{ - this->SetError("An ELSE command was found outside of a proper " - "IF ENDIF structure. Or its arguments did not match " - "the opening IF command."); - return false; -} diff --git a/Source/cmElseCommand.h b/Source/cmElseCommand.h deleted file mode 100644 index c0162ad..0000000 --- a/Source/cmElseCommand.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmElseCommand_h -#define cmElseCommand_h - -#include <cmConfigure.h> -#include <string> -#include <vector> - -#include "cmCommand.h" - -class cmExecutionStatus; - -/** \class cmElseCommand - * \brief ends an if block - * - * cmElseCommand ends an if block - */ -class cmElseCommand : public cmCommand -{ -public: - /** - * This is a virtual constructor for the command. - */ - cmCommand* Clone() CM_OVERRIDE { return new cmElseCommand; } - - /** - * This is called when the command is first encountered in - * the CMakeLists.txt file. - */ - bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; - - /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** - * The name of the command as specified in CMakeList.txt. - */ - std::string GetName() const CM_OVERRIDE { return "else"; } -}; - -#endif diff --git a/Source/cmElseIfCommand.cxx b/Source/cmElseIfCommand.cxx deleted file mode 100644 index 1c32248..0000000 --- a/Source/cmElseIfCommand.cxx +++ /dev/null @@ -1,13 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmElseIfCommand.h" - -class cmExecutionStatus; - -bool cmElseIfCommand::InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) -{ - this->SetError("An ELSEIF command was found outside of a proper " - "IF ENDIF structure."); - return false; -} diff --git a/Source/cmElseIfCommand.h b/Source/cmElseIfCommand.h deleted file mode 100644 index 3f1ddde..0000000 --- a/Source/cmElseIfCommand.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmElseIfCommand_h -#define cmElseIfCommand_h - -#include <cmConfigure.h> -#include <string> -#include <vector> - -#include "cmCommand.h" - -class cmExecutionStatus; - -/** \class cmElseIfCommand - * \brief ends an if block - * - * cmElseIfCommand ends an if block - */ -class cmElseIfCommand : public cmCommand -{ -public: - /** - * This is a virtual constructor for the command. - */ - cmCommand* Clone() CM_OVERRIDE { return new cmElseIfCommand; } - - /** - * This is called when the command is first encountered in - * the CMakeLists.txt file. - */ - bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; - - /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** - * The name of the command as specified in CMakeList.txt. - */ - std::string GetName() const CM_OVERRIDE { return "elseif"; } -}; - -#endif diff --git a/Source/cmEndForEachCommand.cxx b/Source/cmEndForEachCommand.cxx deleted file mode 100644 index 81a37c3..0000000 --- a/Source/cmEndForEachCommand.cxx +++ /dev/null @@ -1,14 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmEndForEachCommand.h" - -class cmExecutionStatus; - -bool cmEndForEachCommand::InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) -{ - this->SetError("An ENDFOREACH command was found outside of a proper " - "FOREACH ENDFOREACH structure. Or its arguments did " - "not match the opening FOREACH command."); - return false; -} diff --git a/Source/cmEndForEachCommand.h b/Source/cmEndForEachCommand.h deleted file mode 100644 index e480e72..0000000 --- a/Source/cmEndForEachCommand.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmEndForEachCommand_h -#define cmEndForEachCommand_h - -#include <cmConfigure.h> -#include <string> -#include <vector> - -#include "cmCommand.h" - -class cmExecutionStatus; - -/** \class cmEndForEachCommand - * \brief ends an if block - * - * cmEndForEachCommand ends an if block - */ -class cmEndForEachCommand : public cmCommand -{ -public: - /** - * This is a virtual constructor for the command. - */ - cmCommand* Clone() CM_OVERRIDE { return new cmEndForEachCommand; } - - /** - * This is called when the command is first encountered in - * the CMakeLists.txt file. - */ - bool InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) CM_OVERRIDE; - - /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** - * The name of the command as specified in CMakeList.txt. - */ - std::string GetName() const CM_OVERRIDE { return "endforeach"; } -}; - -#endif diff --git a/Source/cmEndFunctionCommand.cxx b/Source/cmEndFunctionCommand.cxx deleted file mode 100644 index 2d6b192..0000000 --- a/Source/cmEndFunctionCommand.cxx +++ /dev/null @@ -1,14 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmEndFunctionCommand.h" - -class cmExecutionStatus; - -bool cmEndFunctionCommand::InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) -{ - this->SetError("An ENDFUNCTION command was found outside of a proper " - "FUNCTION ENDFUNCTION structure. Or its arguments did not " - "match the opening FUNCTION command."); - return false; -} diff --git a/Source/cmEndFunctionCommand.h b/Source/cmEndFunctionCommand.h deleted file mode 100644 index b3cf8e6..0000000 --- a/Source/cmEndFunctionCommand.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmEndFunctionCommand_h -#define cmEndFunctionCommand_h - -#include <cmConfigure.h> -#include <string> -#include <vector> - -#include "cmCommand.h" - -class cmExecutionStatus; - -/** \class cmEndFunctionCommand - * \brief ends an if block - * - * cmEndFunctionCommand ends an if block - */ -class cmEndFunctionCommand : public cmCommand -{ -public: - /** - * This is a virtual constructor for the command. - */ - cmCommand* Clone() CM_OVERRIDE { return new cmEndFunctionCommand; } - - /** - * This is called when the command is first encountered in - * the CMakeLists.txt file. - */ - bool InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) CM_OVERRIDE; - - /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** - * The name of the command as specified in CMakeList.txt. - */ - std::string GetName() const CM_OVERRIDE { return "endfunction"; } -}; - -#endif diff --git a/Source/cmEndIfCommand.cxx b/Source/cmEndIfCommand.cxx deleted file mode 100644 index 50c2b42..0000000 --- a/Source/cmEndIfCommand.cxx +++ /dev/null @@ -1,24 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmEndIfCommand.h" - -#include <stdlib.h> // required for atof - -#include "cmMakefile.h" - -class cmExecutionStatus; - -bool cmEndIfCommand::InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) -{ - const char* versionValue = - this->Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION"); - if (!versionValue || (atof(versionValue) <= 1.4)) { - return true; - } - - this->SetError("An ENDIF command was found outside of a proper " - "IF ENDIF structure. Or its arguments did not match " - "the opening IF command."); - return false; -} diff --git a/Source/cmEndIfCommand.h b/Source/cmEndIfCommand.h deleted file mode 100644 index dfd6049..0000000 --- a/Source/cmEndIfCommand.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmEndIfCommand_h -#define cmEndIfCommand_h - -#include <cmConfigure.h> -#include <string> -#include <vector> - -#include "cmCommand.h" - -class cmExecutionStatus; - -/** \class cmEndIfCommand - * \brief ends an if block - * - * cmEndIfCommand ends an if block - */ -class cmEndIfCommand : public cmCommand -{ -public: - /** - * This is a virtual constructor for the command. - */ - cmCommand* Clone() CM_OVERRIDE { return new cmEndIfCommand; } - - /** - * This is called when the command is first encountered in - * the CMakeLists.txt file. - */ - bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) CM_OVERRIDE; - - /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** - * The name of the command as specified in CMakeList.txt. - */ - std::string GetName() const CM_OVERRIDE { return "endif"; } -}; - -#endif diff --git a/Source/cmEndMacroCommand.cxx b/Source/cmEndMacroCommand.cxx deleted file mode 100644 index 6429d7c..0000000 --- a/Source/cmEndMacroCommand.cxx +++ /dev/null @@ -1,14 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmEndMacroCommand.h" - -class cmExecutionStatus; - -bool cmEndMacroCommand::InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) -{ - this->SetError("An ENDMACRO command was found outside of a proper " - "MACRO ENDMACRO structure. Or its arguments did not " - "match the opening MACRO command."); - return false; -} diff --git a/Source/cmEndMacroCommand.h b/Source/cmEndMacroCommand.h deleted file mode 100644 index bd7cdbd..0000000 --- a/Source/cmEndMacroCommand.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmEndMacroCommand_h -#define cmEndMacroCommand_h - -#include <cmConfigure.h> -#include <string> -#include <vector> - -#include "cmCommand.h" - -class cmExecutionStatus; - -/** \class cmEndMacroCommand - * \brief ends an if block - * - * cmEndMacroCommand ends an if block - */ -class cmEndMacroCommand : public cmCommand -{ -public: - /** - * This is a virtual constructor for the command. - */ - cmCommand* Clone() CM_OVERRIDE { return new cmEndMacroCommand; } - - /** - * This is called when the command is first encountered in - * the CMakeLists.txt file. - */ - bool InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) CM_OVERRIDE; - - /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** - * The name of the command as specified in CMakeList.txt. - */ - std::string GetName() const CM_OVERRIDE { return "endmacro"; } -}; - -#endif diff --git a/Source/cmEndWhileCommand.cxx b/Source/cmEndWhileCommand.cxx deleted file mode 100644 index 9c65bbe..0000000 --- a/Source/cmEndWhileCommand.cxx +++ /dev/null @@ -1,14 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmEndWhileCommand.h" - -class cmExecutionStatus; - -bool cmEndWhileCommand::InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) -{ - this->SetError("An ENDWHILE command was found outside of a proper " - "WHILE ENDWHILE structure. Or its arguments did not " - "match the opening WHILE command."); - return false; -} diff --git a/Source/cmEndWhileCommand.h b/Source/cmEndWhileCommand.h deleted file mode 100644 index 484d7c7..0000000 --- a/Source/cmEndWhileCommand.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmEndWhileCommand_h -#define cmEndWhileCommand_h - -#include <cmConfigure.h> -#include <string> -#include <vector> - -#include "cmCommand.h" - -class cmExecutionStatus; - -/** \class cmEndWhileCommand - * \brief ends a while loop - * - * cmEndWhileCommand ends a while loop - */ -class cmEndWhileCommand : public cmCommand -{ -public: - /** - * This is a virtual constructor for the command. - */ - cmCommand* Clone() CM_OVERRIDE { return new cmEndWhileCommand; } - - /** - * This is called when the command is first encountered in - * the CMakeLists.txt file. - */ - bool InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) CM_OVERRIDE; - - /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** - * The name of the command as specified in CMakeList.txt. - */ - std::string GetName() const CM_OVERRIDE { return "endwhile"; } -}; - -#endif diff --git a/Source/cmUnexpectedCommand.cxx b/Source/cmUnexpectedCommand.cxx new file mode 100644 index 0000000..a8de9e6 --- /dev/null +++ b/Source/cmUnexpectedCommand.cxx @@ -0,0 +1,22 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmUnexpectedCommand.h" + +#include <stdlib.h> + +#include "cmMakefile.h" + +class cmExecutionStatus; + +bool cmUnexpectedCommand::InitialPass(std::vector<std::string> const&, + cmExecutionStatus&) +{ + const char* versionValue = + this->Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION"); + if (this->Name == "endif" && (!versionValue || atof(versionValue) <= 1.4)) { + return true; + } + + this->SetError(this->Error); + return false; +} diff --git a/Source/cmUnexpectedCommand.h b/Source/cmUnexpectedCommand.h new file mode 100644 index 0000000..897dfb6 --- /dev/null +++ b/Source/cmUnexpectedCommand.h @@ -0,0 +1,40 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmUnexpectedCommand_h +#define cmUnexpectedCommand_h + +#include <cmConfigure.h> +#include <string> +#include <vector> + +#include "cmCommand.h" + +class cmExecutionStatus; + +class cmUnexpectedCommand : public cmCommand +{ +public: + cmUnexpectedCommand(std::string const& name, const char* error) + : Name(name) + , Error(error) + { + } + + cmCommand* Clone() CM_OVERRIDE + { + return new cmUnexpectedCommand(this->Name, this->Error); + } + + bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus& status) CM_OVERRIDE; + + bool IsScriptable() const CM_OVERRIDE { return true; } + + std::string GetName() const CM_OVERRIDE { return this->Name; } + +private: + std::string Name; + const char* Error; +}; + +#endif diff --git a/bootstrap b/bootstrap index ec081fa..8063edb 100755 --- a/bootstrap +++ b/bootstrap @@ -277,14 +277,8 @@ CMAKE_CXX_SOURCES="\ cmDepends \ cmDependsC \ cmDocumentationFormatter \ - cmElseCommand \ cmEnableLanguageCommand \ cmEnableTestingCommand \ - cmEndForEachCommand \ - cmEndFunctionCommand \ - cmEndIfCommand \ - cmEndMacroCommand \ - cmEndWhileCommand \ cmExecProgramCommand \ cmExecuteProcessCommand \ cmExpandedCommandArgument \ @@ -406,6 +400,7 @@ CMAKE_CXX_SOURCES="\ cmTimestamp \ cmTryCompileCommand \ cmTryRunCommand \ + cmUnexpectedCommand \ cmUnsetCommand \ cmVersion \ cmWhileCommand \ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d23a0196844f066047aa6942b69c6e591462df38 commit d23a0196844f066047aa6942b69c6e591462df38 Author: Daniel Pfeifer <dan...@pfeifer-mail.de> AuthorDate: Sun Nov 27 20:38:57 2016 +0100 Commit: Brad King <brad.k...@kitware.com> CommitDate: Tue Nov 29 13:53:29 2016 -0500 Set the error after argument expansion in end commands The current code is optimized for rare error cases. Simplify the code and remove these optimizations. diff --git a/Source/cmEndForEachCommand.cxx b/Source/cmEndForEachCommand.cxx index fe6a7f3..81a37c3 100644 --- a/Source/cmEndForEachCommand.cxx +++ b/Source/cmEndForEachCommand.cxx @@ -3,10 +3,9 @@ #include "cmEndForEachCommand.h" class cmExecutionStatus; -struct cmListFileArgument; -bool cmEndForEachCommand::InvokeInitialPass( - std::vector<cmListFileArgument> const&, cmExecutionStatus&) +bool cmEndForEachCommand::InitialPass(std::vector<std::string> const&, + cmExecutionStatus&) { this->SetError("An ENDFOREACH command was found outside of a proper " "FOREACH ENDFOREACH structure. Or its arguments did " diff --git a/Source/cmEndForEachCommand.h b/Source/cmEndForEachCommand.h index 772a139..e480e72 100644 --- a/Source/cmEndForEachCommand.h +++ b/Source/cmEndForEachCommand.h @@ -10,7 +10,6 @@ #include "cmCommand.h" class cmExecutionStatus; -struct cmListFileArgument; /** \class cmEndForEachCommand * \brief ends an if block @@ -26,21 +25,11 @@ public: cmCommand* Clone() CM_OVERRIDE { return new cmEndForEachCommand; } /** - * Override cmCommand::InvokeInitialPass to get arguments before - * expansion. - */ - bool InvokeInitialPass(std::vector<cmListFileArgument> const&, - cmExecutionStatus&) CM_OVERRIDE; - - /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) CM_OVERRIDE - { - return false; - } + cmExecutionStatus&) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmEndFunctionCommand.cxx b/Source/cmEndFunctionCommand.cxx index 6adb42b..2d6b192 100644 --- a/Source/cmEndFunctionCommand.cxx +++ b/Source/cmEndFunctionCommand.cxx @@ -3,10 +3,9 @@ #include "cmEndFunctionCommand.h" class cmExecutionStatus; -struct cmListFileArgument; -bool cmEndFunctionCommand::InvokeInitialPass( - std::vector<cmListFileArgument> const&, cmExecutionStatus&) +bool cmEndFunctionCommand::InitialPass(std::vector<std::string> const&, + cmExecutionStatus&) { this->SetError("An ENDFUNCTION command was found outside of a proper " "FUNCTION ENDFUNCTION structure. Or its arguments did not " diff --git a/Source/cmEndFunctionCommand.h b/Source/cmEndFunctionCommand.h index 2599637..b3cf8e6 100644 --- a/Source/cmEndFunctionCommand.h +++ b/Source/cmEndFunctionCommand.h @@ -10,7 +10,6 @@ #include "cmCommand.h" class cmExecutionStatus; -struct cmListFileArgument; /** \class cmEndFunctionCommand * \brief ends an if block @@ -26,21 +25,11 @@ public: cmCommand* Clone() CM_OVERRIDE { return new cmEndFunctionCommand; } /** - * Override cmCommand::InvokeInitialPass to get arguments before - * expansion. - */ - bool InvokeInitialPass(std::vector<cmListFileArgument> const&, - cmExecutionStatus&) CM_OVERRIDE; - - /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) CM_OVERRIDE - { - return false; - } + cmExecutionStatus&) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmEndMacroCommand.cxx b/Source/cmEndMacroCommand.cxx index 046b0af..6429d7c 100644 --- a/Source/cmEndMacroCommand.cxx +++ b/Source/cmEndMacroCommand.cxx @@ -3,10 +3,9 @@ #include "cmEndMacroCommand.h" class cmExecutionStatus; -struct cmListFileArgument; -bool cmEndMacroCommand::InvokeInitialPass( - std::vector<cmListFileArgument> const&, cmExecutionStatus&) +bool cmEndMacroCommand::InitialPass(std::vector<std::string> const&, + cmExecutionStatus&) { this->SetError("An ENDMACRO command was found outside of a proper " "MACRO ENDMACRO structure. Or its arguments did not " diff --git a/Source/cmEndMacroCommand.h b/Source/cmEndMacroCommand.h index 3c462d4..bd7cdbd 100644 --- a/Source/cmEndMacroCommand.h +++ b/Source/cmEndMacroCommand.h @@ -10,7 +10,6 @@ #include "cmCommand.h" class cmExecutionStatus; -struct cmListFileArgument; /** \class cmEndMacroCommand * \brief ends an if block @@ -26,21 +25,11 @@ public: cmCommand* Clone() CM_OVERRIDE { return new cmEndMacroCommand; } /** - * Override cmCommand::InvokeInitialPass to get arguments before - * expansion. - */ - bool InvokeInitialPass(std::vector<cmListFileArgument> const&, - cmExecutionStatus&) CM_OVERRIDE; - - /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) CM_OVERRIDE - { - return false; - } + cmExecutionStatus&) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmEndWhileCommand.cxx b/Source/cmEndWhileCommand.cxx index 7201569..9c65bbe 100644 --- a/Source/cmEndWhileCommand.cxx +++ b/Source/cmEndWhileCommand.cxx @@ -3,10 +3,9 @@ #include "cmEndWhileCommand.h" class cmExecutionStatus; -struct cmListFileArgument; -bool cmEndWhileCommand::InvokeInitialPass( - std::vector<cmListFileArgument> const&, cmExecutionStatus&) +bool cmEndWhileCommand::InitialPass(std::vector<std::string> const&, + cmExecutionStatus&) { this->SetError("An ENDWHILE command was found outside of a proper " "WHILE ENDWHILE structure. Or its arguments did not " diff --git a/Source/cmEndWhileCommand.h b/Source/cmEndWhileCommand.h index d4e97b4..484d7c7 100644 --- a/Source/cmEndWhileCommand.h +++ b/Source/cmEndWhileCommand.h @@ -10,7 +10,6 @@ #include "cmCommand.h" class cmExecutionStatus; -struct cmListFileArgument; /** \class cmEndWhileCommand * \brief ends a while loop @@ -26,21 +25,11 @@ public: cmCommand* Clone() CM_OVERRIDE { return new cmEndWhileCommand; } /** - * Override cmCommand::InvokeInitialPass to get arguments before - * expansion. - */ - bool InvokeInitialPass(std::vector<cmListFileArgument> const& args, - cmExecutionStatus& status) CM_OVERRIDE; - - /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) CM_OVERRIDE - { - return false; - } + cmExecutionStatus&) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1afbe7d2cca61ecf483f7697b0141a233508603d commit 1afbe7d2cca61ecf483f7697b0141a233508603d Author: Daniel Pfeifer <dan...@pfeifer-mail.de> AuthorDate: Sun Nov 27 20:38:57 2016 +0100 Commit: Brad King <brad.k...@kitware.com> CommitDate: Tue Nov 29 13:53:29 2016 -0500 Make error message of standalone endwhile command consistent with the error messages of endforeach, endmacro, endfunction, etc. diff --git a/Source/cmEndWhileCommand.cxx b/Source/cmEndWhileCommand.cxx index 5623f33..7201569 100644 --- a/Source/cmEndWhileCommand.cxx +++ b/Source/cmEndWhileCommand.cxx @@ -2,21 +2,14 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmEndWhileCommand.h" -#include "cmListFileCache.h" - class cmExecutionStatus; +struct cmListFileArgument; bool cmEndWhileCommand::InvokeInitialPass( - std::vector<cmListFileArgument> const& args, cmExecutionStatus&) + std::vector<cmListFileArgument> const&, cmExecutionStatus&) { - if (args.empty()) { - this->SetError("An ENDWHILE command was found outside of a proper " - "WHILE ENDWHILE structure."); - } else { - this->SetError("An ENDWHILE command was found outside of a proper " - "WHILE ENDWHILE structure. Or its arguments did not " - "match the opening WHILE command."); - } - + this->SetError("An ENDWHILE command was found outside of a proper " + "WHILE ENDWHILE structure. Or its arguments did not " + "match the opening WHILE command."); return false; } diff --git a/Tests/RunCMake/while/EndAlone-stderr.txt b/Tests/RunCMake/while/EndAlone-stderr.txt index cd98687..5fe6655 100644 --- a/Tests/RunCMake/while/EndAlone-stderr.txt +++ b/Tests/RunCMake/while/EndAlone-stderr.txt @@ -1,5 +1,5 @@ ^CMake Error at EndAlone.cmake:1 \(endwhile\): endwhile An ENDWHILE command was found outside of a proper WHILE ENDWHILE - structure. + structure. Or its arguments did not match the opening WHILE command. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ ----------------------------------------------------------------------- Summary of changes: Source/CMakeLists.txt | 16 +----- Source/cmCommands.cxx | 43 ++++++++++----- Source/cmElseCommand.cxx | 14 ----- Source/cmElseCommand.h | 45 ---------------- Source/cmElseIfCommand.cxx | 13 ----- Source/cmElseIfCommand.h | 45 ---------------- Source/cmEndForEachCommand.cxx | 15 ------ Source/cmEndForEachCommand.h | 56 -------------------- Source/cmEndFunctionCommand.cxx | 15 ------ Source/cmEndFunctionCommand.h | 56 -------------------- Source/cmEndIfCommand.cxx | 24 --------- Source/cmEndIfCommand.h | 45 ---------------- Source/cmEndMacroCommand.cxx | 15 ------ Source/cmEndMacroCommand.h | 56 -------------------- Source/cmEndWhileCommand.cxx | 22 -------- Source/cmEndWhileCommand.h | 56 -------------------- Source/cmUnexpectedCommand.cxx | 22 ++++++++ ...eMangledMesaCommand.h => cmUnexpectedCommand.h} | 28 +++++++--- Tests/RunCMake/while/EndAlone-stderr.txt | 2 +- bootstrap | 7 +-- 20 files changed, 76 insertions(+), 519 deletions(-) delete mode 100644 Source/cmElseCommand.cxx delete mode 100644 Source/cmElseCommand.h delete mode 100644 Source/cmElseIfCommand.cxx delete mode 100644 Source/cmElseIfCommand.h delete mode 100644 Source/cmEndForEachCommand.cxx delete mode 100644 Source/cmEndForEachCommand.h delete mode 100644 Source/cmEndFunctionCommand.cxx delete mode 100644 Source/cmEndFunctionCommand.h delete mode 100644 Source/cmEndIfCommand.cxx delete mode 100644 Source/cmEndIfCommand.h delete mode 100644 Source/cmEndMacroCommand.cxx delete mode 100644 Source/cmEndMacroCommand.h delete mode 100644 Source/cmEndWhileCommand.cxx delete mode 100644 Source/cmEndWhileCommand.h create mode 100644 Source/cmUnexpectedCommand.cxx copy Source/{cmUseMangledMesaCommand.h => cmUnexpectedCommand.h} (51%) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits