diff options
Diffstat (limited to 'Source')
192 files changed, 9074 insertions, 6400 deletions
diff --git a/Source/.gitattributes b/Source/.gitattributes index 1cec8a3..f69ad9d 100644 --- a/Source/.gitattributes +++ b/Source/.gitattributes @@ -17,5 +17,4 @@ /cmListFileLexer.c generated # Do not format third-party sources. -/bindexplib.* -format.clang-format /kwsys/** -format.clang-format diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 2835ee6..59920f8 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -344,6 +344,8 @@ set(SRCS cmPropertyDefinitionMap.h cmPropertyMap.cxx cmPropertyMap.h + cmQtAutoGeneratorCommon.cxx + cmQtAutoGeneratorCommon.h cmQtAutoGeneratorInitializer.cxx cmQtAutoGeneratorInitializer.h cmQtAutoGenerators.cxx @@ -381,6 +383,8 @@ set(SRCS cmVariableWatch.h cmVersion.cxx cmVersion.h + cmWorkingDirectory.cxx + cmWorkingDirectory.h cmXMLParser.cxx cmXMLParser.h cmXMLSafe.cxx @@ -440,6 +444,8 @@ set(SRCS cmCreateTestSourceList.h cmDefinePropertyCommand.cxx cmDefinePropertyCommand.h + cmDisallowedCommand.cxx + cmDisallowedCommand.h cmEnableLanguageCommand.cxx cmEnableLanguageCommand.h cmEnableTestingCommand.cxx @@ -637,6 +643,7 @@ if(APPLE) set(SRCS ${SRCS} cmXCodeObject.cxx cmXCode21Object.cxx + cmXCodeScheme.cxx cmGlobalXCodeGenerator.cxx cmGlobalXCodeGenerator.h cmLocalXCodeGenerator.cxx diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 65e7b5d..08baa99 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 8) -set(CMake_VERSION_PATCH 0) -#set(CMake_VERSION_RC 0) +set(CMake_VERSION_PATCH 20170410) +#set(CMake_VERSION_RC 1) diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx index b159e64..aeabde9 100644 --- a/Source/CPack/OSXScriptLauncher.cxx +++ b/Source/CPack/OSXScriptLauncher.cxx @@ -20,7 +20,6 @@ int main(int argc, char* argv[]) { // if ( cmsys::SystemTools::FileExists( - std::string cwd = cmsys::SystemTools::GetCurrentWorkingDirectory(); cmsys::ofstream ofs("/tmp/output.txt"); CFStringRef fileName; diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 2bccf2e..39586de 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -437,8 +437,8 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() directoryDefinitions.AddAttribute("Name", "SourceDir"); size_t installRootSize = - directoryDefinitions.BeginInstallationPrefixDirectory( - GetProgramFilesFolderId(), installRoot); + directoryDefinitions.BeginInstallationPrefixDirectory(GetRootFolderId(), + installRoot); std::string fileDefinitionsFilename = this->CPackTopLevel + "/files.wxs"; @@ -570,16 +570,26 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() return this->Patch->CheckForUnappliedFragments(); } -std::string cmCPackWIXGenerator::GetProgramFilesFolderId() const +std::string cmCPackWIXGenerator::GetRootFolderId() const { if (cmSystemTools::IsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER"))) { return ""; } + + std::string result = "ProgramFiles<64>Folder"; + + const char* rootFolderId = GetOption("CPACK_WIX_ROOT_FOLDER_ID"); + if (rootFolderId) { + result = rootFolderId; + } + if (GetArchitecture() == "x86") { - return "ProgramFilesFolder"; + cmSystemTools::ReplaceString(result, "<64>", ""); } else { - return "ProgramFiles64Folder"; + cmSystemTools::ReplaceString(result, "<64>", "64"); } + + return result; } bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate() diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h index fc0994c..36647d8 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.h +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -65,7 +65,7 @@ private: bool CreateWiXSourceFiles(); - std::string GetProgramFilesFolderId() const; + std::string GetRootFolderId() const; bool GenerateMainSourceFileFromTemplate(); diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx index a471d26..3158343 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx @@ -9,9 +9,7 @@ #include <cmSystemTools.h> #include <cmUuid.h> -#include <sys/types.h> -// include sys/stat.h after sys/types.h -#include <sys/stat.h> +#include "cm_sys_stat.h" cmWIXFilesSourceWriter::cmWIXFilesSourceWriter(cmCPackLog* logger, std::string const& filename, diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 9d9cd66..cc01b0c 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -7,6 +7,7 @@ #include "cmCPackLog.h" #include "cmGeneratedFileStream.h" #include "cmSystemTools.h" +#include "cmWorkingDirectory.h" #include <map> #include <ostream> @@ -37,9 +38,8 @@ int cmCPackArchiveGenerator::addOneComponentToArchive( // Add the files of this component to the archive std::string localToplevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY")); localToplevel += "/" + component->Name; - std::string dir = cmSystemTools::GetCurrentWorkingDirectory(); // Change to local toplevel - cmSystemTools::ChangeDirectory(localToplevel); + cmWorkingDirectory workdir(localToplevel); std::string filePrefix; if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY")) { filePrefix = this->GetOption("CPACK_PACKAGE_FILE_NAME"); @@ -64,8 +64,6 @@ int cmCPackArchiveGenerator::addOneComponentToArchive( return 0; } } - // Go back to previous dir - cmSystemTools::ChangeDirectory(dir); return 1; } @@ -227,8 +225,7 @@ int cmCPackArchiveGenerator::PackageFiles() // CASE 3 : NON COMPONENT package. DECLARE_AND_OPEN_ARCHIVE(packageFileNames[0], archive); std::vector<std::string>::const_iterator fileIt; - std::string dir = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(toplevel); + cmWorkingDirectory workdir(toplevel); for (fileIt = files.begin(); fileIt != files.end(); ++fileIt) { // Get the relative path to the file std::string rp = @@ -241,7 +238,6 @@ int cmCPackArchiveGenerator::PackageFiles() return 0; } } - cmSystemTools::ChangeDirectory(dir); // The destructor of cmArchiveWrite will close and finish the write return 1; } diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h index f955daf..510adc2 100644 --- a/Source/CPack/cmCPackComponentGroup.h +++ b/Source/CPack/cmCPackComponentGroup.h @@ -78,6 +78,10 @@ public: /// contains the files that are part of this component. std::string ArchiveFile; + /// The file to pass to --component-plist when using the + /// productbuild generator. + std::string Plist; + /// The components that this component depends on. std::vector<cmCPackComponent*> Dependencies; diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.cxx b/Source/CPack/cmCPackCygwinSourceGenerator.cxx index 92475d9..bd22cec 100644 --- a/Source/CPack/cmCPackCygwinSourceGenerator.cxx +++ b/Source/CPack/cmCPackCygwinSourceGenerator.cxx @@ -15,7 +15,7 @@ // system tools because it is not implemented robustly enough to move // files across directories. #ifdef _WIN32 -#include <sys/stat.h> +#include "cm_sys_stat.h" #include <windows.h> #endif diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 5c50da8..ed87238 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -8,6 +8,7 @@ #include "cmCPackLog.h" #include "cmGeneratedFileStream.h" #include "cmSystemTools.h" +#include "cm_sys_stat.h" #include <cmsys/Glob.hxx> #include <limits.h> @@ -16,7 +17,6 @@ #include <set> #include <stdio.h> #include <string.h> -#include <sys/stat.h> #include <utility> // NOTE: diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index fd67df9..ec5fc88 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -390,6 +390,8 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, bool remount_image = !cpack_package_icon.empty() || !cpack_dmg_ds_store_setup_script.empty(); + std::string temp_image_format = "UDZO"; + // Create 1 MB dummy padding file in staging area when we need to remount // image, so we have enough space for storing changes ... if (remount_image) { @@ -401,6 +403,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, return 0; } + temp_image_format = "UDRW"; } // Create a temporary read-write disk image ... @@ -413,7 +416,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, temp_image_command << " -ov"; temp_image_command << " -srcfolder \"" << staging.str() << "\""; temp_image_command << " -volname \"" << cpack_dmg_volume_name << "\""; - temp_image_command << " -format UDRW"; + temp_image_command << " -format " << temp_image_format; temp_image_command << " \"" << temp_image << "\""; if (!this->RunCommand(temp_image_command)) { @@ -632,29 +635,33 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, return 0; } - // convert to UDCO - std::string temp_udco = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); - temp_udco += "/temp-udco.dmg"; + if (temp_image_format != "UDZO") { + temp_image_format = "UDZO"; + // convert to UDZO to enable unflatten/flatten + std::string temp_udzo = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); + temp_udzo += "/temp-udzo.dmg"; - std::ostringstream udco_image_command; - udco_image_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); - udco_image_command << " convert \"" << temp_image << "\""; - udco_image_command << " -format UDCO"; - udco_image_command << " -ov -o \"" << temp_udco << "\""; + std::ostringstream udco_image_command; + udco_image_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); + udco_image_command << " convert \"" << temp_image << "\""; + udco_image_command << " -format UDZO"; + udco_image_command << " -ov -o \"" << temp_udzo << "\""; - if (!this->RunCommand(udco_image_command, &error)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Error converting to UDCO dmg for adding SLA." - << std::endl - << error << std::endl); - return 0; + if (!this->RunCommand(udco_image_command, &error)) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error converting to UDCO dmg for adding SLA." + << std::endl + << error << std::endl); + return 0; + } + temp_image = temp_udzo; } // unflatten dmg std::ostringstream unflatten_command; unflatten_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); unflatten_command << " unflatten "; - unflatten_command << "\"" << temp_udco << "\""; + unflatten_command << "\"" << temp_image << "\""; if (!this->RunCommand(unflatten_command, &error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -673,7 +680,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, } embed_sla_command << " \"" << sla_r << "\""; embed_sla_command << " -a -o "; - embed_sla_command << "\"" << temp_udco << "\""; + embed_sla_command << "\"" << temp_image << "\""; if (!this->RunCommand(embed_sla_command, &error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error adding SLA." << std::endl @@ -686,7 +693,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, std::ostringstream flatten_command; flatten_command << this->GetOption("CPACK_COMMAND_HDIUTIL"); flatten_command << " flatten "; - flatten_command << "\"" << temp_udco << "\""; + flatten_command << "\"" << temp_image << "\""; if (!this->RunCommand(flatten_command, &error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -695,8 +702,6 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, << std::endl); return 0; } - - temp_image = temp_udco; } // Create the final compressed read-only disk image ... diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 21eda79..f6ea8cf 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -16,6 +16,7 @@ #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmStateSnapshot.h" +#include "cmWorkingDirectory.h" #include "cmXMLSafe.h" #include "cm_auto_ptr.hxx" #include "cmake.h" @@ -383,7 +384,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( goToDir += "/" + subdir; cmCPackLogger(cmCPackLog::LOG_DEBUG, "Change dir to: " << goToDir << std::endl); - cmSystemTools::ChangeDirectory(goToDir); + cmWorkingDirectory workdir(goToDir); for (symlinkedIt = symlinkedFiles.begin(); symlinkedIt != symlinkedFiles.end(); ++symlinkedIt) { cmCPackLogger(cmCPackLog::LOG_DEBUG, "Will create a symlink: " @@ -408,7 +409,6 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( } cmCPackLogger(cmCPackLog::LOG_DEBUG, "Going back to: " << curDir << std::endl); - cmSystemTools::ChangeDirectory(curDir); } } } @@ -1396,6 +1396,11 @@ cmCPackComponent* cmCPackGenerator::GetComponent( component->ArchiveFile = archiveFile; } + const char* plist = this->GetOption(macroPrefix + "_PLIST"); + if (plist && *plist) { + component->Plist = plist; + } + const char* groupName = this->GetOption(macroPrefix + "_GROUP"); if (groupName && *groupName) { component->Group = GetComponentGroup(projectName, groupName); diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 5354fca..39fd2cc 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -13,25 +13,10 @@ #include "cmCPackComponentGroup.h" #include "cmSystemTools.h" -class cmCPackGenerator; class cmCPackLog; class cmInstalledFile; class cmMakefile; -#define cmCPackTypeMacro(klass, superclass) \ - typedef superclass Superclass; \ - const char* GetNameOfClass() CM_OVERRIDE { return #klass; } \ - static cmCPackGenerator* CreateGenerator() { return new klass; } \ - class cmCPackTypeMacro_UseTrailingSemicolon - -#define cmCPackLogger(logType, msg) \ - do { \ - std::ostringstream cmCPackLog_msg; \ - cmCPackLog_msg << msg; \ - this->Logger->Log(logType, __FILE__, __LINE__, \ - cmCPackLog_msg.str().c_str()); \ - } while (false) - /** \class cmCPackGenerator * \brief A superclass of all CPack Generators * @@ -312,4 +297,18 @@ private: cmMakefile* MakefileMap; }; +#define cmCPackTypeMacro(klass, superclass) \ + typedef superclass Superclass; \ + const char* GetNameOfClass() CM_OVERRIDE { return #klass; } \ + static cmCPackGenerator* CreateGenerator() { return new klass; } \ + class cmCPackTypeMacro_UseTrailingSemicolon + +#define cmCPackLogger(logType, msg) \ + do { \ + std::ostringstream cmCPackLog_msg; \ + cmCPackLog_msg << msg; \ + this->Logger->Log(logType, __FILE__, __LINE__, \ + cmCPackLog_msg.str().c_str()); \ + } while (false) + #endif diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index 0d8dc48..8ea88a8 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -3,12 +3,12 @@ #include "cmCPackOSXX11Generator.h" #include <sstream> -#include <sys/stat.h> #include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmGeneratedFileStream.h" #include "cmSystemTools.h" +#include "cm_sys_stat.h" cmCPackOSXX11Generator::cmCPackOSXX11Generator() { diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx index a5a18dc..1389eaa 100644 --- a/Source/CPack/cmCPackProductBuildGenerator.cxx +++ b/Source/CPack/cmCPackProductBuildGenerator.cxx @@ -59,12 +59,25 @@ int cmCPackProductBuildGenerator::PackageFiles() } } - // Copy or create all of the resource files we need. std::string resDir = packageDirFileName + "/Contents"; + + if (this->IsSet("CPACK_PRODUCTBUILD_RESOURCES_DIR")) { + std::string userResDir = + this->GetOption("CPACK_PRODUCTBUILD_RESOURCES_DIR"); + + if (!cmSystemTools::CopyADirectory(userResDir, resDir)) { + cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying the resource files" + << std::endl); + return 0; + } + } + + // Copy or create all of the resource files we need. if (!this->CopyCreateResourceFile("License", resDir) || !this->CopyCreateResourceFile("ReadMe", resDir) || !this->CopyCreateResourceFile("Welcome", resDir)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying the resource files" + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem copying the License, ReadMe and Welcome files" << std::endl); return 0; } @@ -223,6 +236,10 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( : " --keychain \"" + keychainPath + "\"") << " \"" << packageFile << "\""; + if (component && !component->Plist.empty()) { + pkgCmd << " --component-plist \"" << component->Plist << "\""; + } + // Run ProductBuild return RunProductBuild(pkgCmd.str()); } diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index 682394e..2765e2a 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -8,13 +8,10 @@ #include <string> #include <vector> -#include <sys/types.h> -// include sys/stat.h after sys/types.h -#include <sys/stat.h> - #include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmSystemTools.h" +#include "cm_sys_stat.h" cmCPackSTGZGenerator::cmCPackSTGZGenerator() { diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index b42953b..6769ee5 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -151,22 +151,24 @@ std::string cmCTestBZR::LoadInfo() return rev; } -void cmCTestBZR::NoteOldRevision() +bool cmCTestBZR::NoteOldRevision() { this->OldRevision = this->LoadInfo(); this->Log << "Revision before update: " << this->OldRevision << "\n"; cmCTestLog(this->CTest, HANDLER_OUTPUT, " Old revision of repository is: " << this->OldRevision << "\n"); this->PriorRev.Rev = this->OldRevision; + return true; } -void cmCTestBZR::NoteNewRevision() +bool cmCTestBZR::NoteNewRevision() { this->NewRevision = this->LoadInfo(); this->Log << "Revision after update: " << this->NewRevision << "\n"; cmCTestLog(this->CTest, HANDLER_OUTPUT, " New revision of repository is: " << this->NewRevision << "\n"); this->Log << "URL = " << this->URL << "\n"; + return true; } class cmCTestBZR::LogParser : public cmCTestVC::OutputLogger, @@ -386,7 +388,7 @@ bool cmCTestBZR::UpdateImpl() return this->RunUpdateCommand(&bzr_update[0], &out, &err); } -void cmCTestBZR::LoadRevisions() +bool cmCTestBZR::LoadRevisions() { cmCTestLog(this->CTest, HANDLER_OUTPUT, " Gathering version information (one . per revision):\n" @@ -400,7 +402,7 @@ void cmCTestBZR::LoadRevisions() // DoRevision takes care of discarding the information about OldRevision revs = this->OldRevision + ".." + this->NewRevision; } else { - return; + return true; } // Run "bzr log" to get all global revisions of interest. @@ -415,6 +417,7 @@ void cmCTestBZR::LoadRevisions() this->RunChild(bzr_log, &out, &err); } cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl); + return true; } class cmCTestBZR::StatusParser : public cmCTestVC::LineParser @@ -460,7 +463,7 @@ private: } }; -void cmCTestBZR::LoadModifications() +bool cmCTestBZR::LoadModifications() { // Run "bzr status" which reports local modifications. const char* bzr = this->CommandLineTool.c_str(); @@ -468,4 +471,5 @@ void cmCTestBZR::LoadModifications() StatusParser out(this, "status-out> "); OutputLogger err(this->Log, "status-err> "); this->RunChild(bzr_status, &out, &err); + return true; } diff --git a/Source/CTest/cmCTestBZR.h b/Source/CTest/cmCTestBZR.h index e7af90b..0b62582 100644 --- a/Source/CTest/cmCTestBZR.h +++ b/Source/CTest/cmCTestBZR.h @@ -26,16 +26,16 @@ public: private: // Implement cmCTestVC internal API. - void NoteOldRevision() CM_OVERRIDE; - void NoteNewRevision() CM_OVERRIDE; + bool NoteOldRevision() CM_OVERRIDE; + bool NoteNewRevision() CM_OVERRIDE; bool UpdateImpl() CM_OVERRIDE; // URL of repository directory checked out in the working tree. std::string URL; std::string LoadInfo(); - void LoadModifications() CM_OVERRIDE; - void LoadRevisions() CM_OVERRIDE; + bool LoadModifications() CM_OVERRIDE; + bool LoadRevisions() CM_OVERRIDE; // Parsing helper classes. class InfoParser; diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 6780a0e..6f81429 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -6,6 +6,7 @@ #include "cmCTestTestHandler.h" #include "cmGlobalGenerator.h" #include "cmSystemTools.h" +#include "cmWorkingDirectory.h" #include "cmake.h" #include <cmsys/Process.h> @@ -42,7 +43,7 @@ int cmCTestBuildAndTestHandler::ProcessHandler() int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, std::ostringstream& out, std::string& cmakeOutString, - std::string& cwd, cmake* cm) + cmake* cm) { unsigned int k; std::vector<std::string> args; @@ -85,8 +86,6 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, if (cm->Run(args) != 0) { out << "Error: cmake execution failed\n"; out << cmakeOutString << "\n"; - // return to the original directory - cmSystemTools::ChangeDirectory(cwd); if (outstring) { *outstring = out.str(); } else { @@ -99,8 +98,6 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, if (cm->Run(args) != 0) { out << "Error: cmake execution failed\n"; out << cmakeOutString << "\n"; - // return to the original directory - cmSystemTools::ChangeDirectory(cwd); if (outstring) { *outstring = out.str(); } else { @@ -199,13 +196,12 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) double clock_start = cmSystemTools::GetTime(); // make sure the binary dir is there - std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); out << "Internal cmake changing into directory: " << this->BinaryDir << std::endl; if (!cmSystemTools::FileIsDirectory(this->BinaryDir)) { cmSystemTools::MakeDirectory(this->BinaryDir.c_str()); } - cmSystemTools::ChangeDirectory(this->BinaryDir); + cmWorkingDirectory workdir(this->BinaryDir); if (this->BuildNoCMake) { // Make the generator available for the Build call below. @@ -217,7 +213,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) cm.LoadCache(this->BinaryDir); } else { // do the cmake step, no timeout here since it is not a sub process - if (this->RunCMake(outstring, out, cmakeOutString, cwd, &cm)) { + if (this->RunCMake(outstring, out, cmakeOutString, &cm)) { return 1; } } @@ -304,8 +300,6 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) } else { cmCTestLog(this->CTest, ERROR_MESSAGE, out.str()); } - // return to the original directory - cmSystemTools::ChangeDirectory(cwd); return 1; } diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h index 5885738..af082a3 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.h +++ b/Source/CTest/cmCTestBuildAndTestHandler.h @@ -46,7 +46,7 @@ protected: ///! Run CMake and build a test and then run it as a single test. int RunCMakeAndTest(std::string* output); int RunCMake(std::string* outstring, std::ostringstream& out, - std::string& cmakeOutString, std::string& cwd, cmake* cm); + std::string& cmakeOutString, cmake* cm); std::string Output; diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 989c096..120c5d9 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -12,6 +12,7 @@ #include "cmParseJacocoCoverage.h" #include "cmParsePHPCoverage.h" #include "cmSystemTools.h" +#include "cmWorkingDirectory.h" #include "cmXMLWriter.h" #include "cmake.h" @@ -969,9 +970,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( std::string testingDir = this->CTest->GetBinaryDir() + "/Testing"; std::string tempDir = testingDir + "/CoverageInfo"; - std::string currentDirectory = cmSystemTools::GetCurrentWorkingDirectory(); cmSystemTools::MakeDirectory(tempDir.c_str()); - cmSystemTools::ChangeDirectory(tempDir); + cmWorkingDirectory workdir(tempDir); int gcovStyle = 0; @@ -1294,7 +1294,6 @@ int cmCTestCoverageHandler::HandleGCovCoverage( } } - cmSystemTools::ChangeDirectory(currentDirectory); return file_count; } @@ -1340,7 +1339,6 @@ int cmCTestCoverageHandler::HandleLCovCoverage( return 0; } std::string testingDir = this->CTest->GetBinaryDir(); - std::string currentDirectory = cmSystemTools::GetCurrentWorkingDirectory(); std::set<std::string> missingFiles; @@ -1362,7 +1360,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage( cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "." << std::flush, this->Quiet); std::string fileDir = cmSystemTools::GetFilenamePath(*it); - cmSystemTools::ChangeDirectory(fileDir); + cmWorkingDirectory workdir(fileDir); std::string command = "\"" + lcovCommand + "\" " + lcovExtraFlags + " "; cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, @@ -1552,7 +1550,6 @@ int cmCTestCoverageHandler::HandleLCovCoverage( } } - cmSystemTools::ChangeDirectory(currentDirectory); return file_count; } @@ -1591,13 +1588,8 @@ bool cmCTestCoverageHandler::FindLCovFiles(std::vector<std::string>& files) gl.RecurseOff(); // No need of recurse if -prof_dir${BUILD_DIR} flag is // used while compiling. gl.RecurseThroughSymlinksOff(); - std::string prevBinaryDir; std::string buildDir = this->CTest->GetCTestConfiguration("BuildDirectory"); - if (cmSystemTools::ChangeDirectory(buildDir)) { - cmCTestLog(this->CTest, ERROR_MESSAGE, "Error changing directory to " - << buildDir << std::endl); - return false; - } + cmWorkingDirectory workdir(buildDir); // Run profmerge to merge all *.dyn files into dpi files if (!cmSystemTools::RunSingleCommand("profmerge")) { @@ -1605,11 +1597,9 @@ bool cmCTestCoverageHandler::FindLCovFiles(std::vector<std::string>& files) return false; } - prevBinaryDir = cmSystemTools::GetCurrentWorkingDirectory(); - // DPI file should appear in build directory std::string daGlob; - daGlob = prevBinaryDir; + daGlob = buildDir; daGlob += "/*.dpi"; cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " looking for dpi files in: " << daGlob << std::endl, @@ -1646,11 +1636,7 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( std::string testingDir = this->CTest->GetBinaryDir() + "/Testing"; std::string tempDir = testingDir + "/CoverageInfo"; - std::string currentDirectory = cmSystemTools::GetCurrentWorkingDirectory(); cmSystemTools::MakeDirectory(tempDir.c_str()); - cmSystemTools::ChangeDirectory(tempDir); - - cmSystemTools::ChangeDirectory(currentDirectory); std::vector<std::string>::iterator fileIt; int file_count = 0; @@ -1737,7 +1723,6 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( } ++file_count; } - cmSystemTools::ChangeDirectory(currentDirectory); return file_count; } diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index d30f6b3..9c53aa1 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -67,19 +67,21 @@ std::string cmCTestGIT::GetWorkingRevision() return rev; } -void cmCTestGIT::NoteOldRevision() +bool cmCTestGIT::NoteOldRevision() { this->OldRevision = this->GetWorkingRevision(); cmCTestLog(this->CTest, HANDLER_OUTPUT, " Old revision of repository is: " << this->OldRevision << "\n"); this->PriorRev.Rev = this->OldRevision; + return true; } -void cmCTestGIT::NoteNewRevision() +bool cmCTestGIT::NoteNewRevision() { this->NewRevision = this->GetWorkingRevision(); cmCTestLog(this->CTest, HANDLER_OUTPUT, " New revision of repository is: " << this->NewRevision << "\n"); + return true; } std::string cmCTestGIT::FindGitDir() @@ -607,7 +609,7 @@ private: char const cmCTestGIT::CommitParser::SectionSep[SectionCount] = { '\n', '\n', '\0' }; -void cmCTestGIT::LoadRevisions() +bool cmCTestGIT::LoadRevisions() { // Use 'git rev-list ... | git diff-tree ...' to get revisions. std::string range = this->OldRevision + ".." + this->NewRevision; @@ -634,9 +636,10 @@ void cmCTestGIT::LoadRevisions() out.Process("", 1); cmsysProcess_Delete(cp); + return true; } -void cmCTestGIT::LoadModifications() +bool cmCTestGIT::LoadModifications() { const char* git = this->CommandLineTool.c_str(); @@ -660,4 +663,5 @@ void cmCTestGIT::LoadModifications() ci != out.Changes.end(); ++ci) { this->DoModification(PathModified, ci->Path); } + return true; } diff --git a/Source/CTest/cmCTestGIT.h b/Source/CTest/cmCTestGIT.h index a655502..d5a1ee3 100644 --- a/Source/CTest/cmCTestGIT.h +++ b/Source/CTest/cmCTestGIT.h @@ -28,8 +28,8 @@ private: unsigned int CurrentGitVersion; unsigned int GetGitVersion(); std::string GetWorkingRevision(); - void NoteOldRevision() CM_OVERRIDE; - void NoteNewRevision() CM_OVERRIDE; + bool NoteOldRevision() CM_OVERRIDE; + bool NoteNewRevision() CM_OVERRIDE; bool UpdateImpl() CM_OVERRIDE; std::string FindGitDir(); @@ -39,8 +39,8 @@ private: bool UpdateByCustom(std::string const& custom); bool UpdateInternal(); - void LoadRevisions() CM_OVERRIDE; - void LoadModifications() CM_OVERRIDE; + bool LoadRevisions() CM_OVERRIDE; + bool LoadModifications() CM_OVERRIDE; // "public" needed by older Sun compilers public: diff --git a/Source/CTest/cmCTestGlobalVC.cxx b/Source/CTest/cmCTestGlobalVC.cxx index 08af179..25294b5 100644 --- a/Source/CTest/cmCTestGlobalVC.cxx +++ b/Source/CTest/cmCTestGlobalVC.cxx @@ -102,14 +102,15 @@ void cmCTestGlobalVC::WriteXMLGlobal(cmXMLWriter& xml) bool cmCTestGlobalVC::WriteXMLUpdates(cmXMLWriter& xml) { + bool result = true; cmCTestLog(this->CTest, HANDLER_OUTPUT, " Gathering version information (one . per revision):\n" " " << std::flush); - this->LoadRevisions(); + result = this->LoadRevisions() && result; cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl); - this->LoadModifications(); + result = this->LoadModifications() && result; this->WriteXMLGlobal(xml); @@ -119,5 +120,5 @@ bool cmCTestGlobalVC::WriteXMLUpdates(cmXMLWriter& xml) this->WriteXMLDirectory(xml, di->first, di->second); } - return true; + return result; } diff --git a/Source/CTest/cmCTestGlobalVC.h b/Source/CTest/cmCTestGlobalVC.h index 9a3757d..9fa5f21 100644 --- a/Source/CTest/cmCTestGlobalVC.h +++ b/Source/CTest/cmCTestGlobalVC.h @@ -64,8 +64,8 @@ protected: virtual void DoRevision(Revision const& revision, std::vector<Change> const& changes); virtual void DoModification(PathStatus status, std::string const& path); - virtual void LoadModifications() = 0; - virtual void LoadRevisions() = 0; + virtual bool LoadModifications() = 0; + virtual bool LoadRevisions() = 0; virtual void WriteXMLGlobal(cmXMLWriter& xml); void WriteXMLDirectory(cmXMLWriter& xml, std::string const& path, diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index 8443c93..68ebd37 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -104,19 +104,21 @@ std::string cmCTestHG::GetWorkingRevision() return rev; } -void cmCTestHG::NoteOldRevision() +bool cmCTestHG::NoteOldRevision() { this->OldRevision = this->GetWorkingRevision(); cmCTestLog(this->CTest, HANDLER_OUTPUT, " Old revision of repository is: " << this->OldRevision << "\n"); this->PriorRev.Rev = this->OldRevision; + return true; } -void cmCTestHG::NoteNewRevision() +bool cmCTestHG::NoteNewRevision() { this->NewRevision = this->GetWorkingRevision(); cmCTestLog(this->CTest, HANDLER_OUTPUT, " New revision of repository is: " << this->NewRevision << "\n"); + return true; } bool cmCTestHG::UpdateImpl() @@ -262,7 +264,7 @@ private: } }; -void cmCTestHG::LoadRevisions() +bool cmCTestHG::LoadRevisions() { // Use 'hg log' to get revisions in a xml format. // @@ -293,9 +295,10 @@ void cmCTestHG::LoadRevisions() OutputLogger err(this->Log, "log-err> "); this->RunChild(hg_log, &out, &err); out.Process("</log>\n"); + return true; } -void cmCTestHG::LoadModifications() +bool cmCTestHG::LoadModifications() { // Use 'hg status' to get modified files. const char* hg = this->CommandLineTool.c_str(); @@ -303,4 +306,5 @@ void cmCTestHG::LoadModifications() StatusParser out(this, "status-out> "); OutputLogger err(this->Log, "status-err> "); this->RunChild(hg_status, &out, &err); + return true; } diff --git a/Source/CTest/cmCTestHG.h b/Source/CTest/cmCTestHG.h index a81c347..63baba2 100644 --- a/Source/CTest/cmCTestHG.h +++ b/Source/CTest/cmCTestHG.h @@ -26,12 +26,12 @@ public: private: std::string GetWorkingRevision(); - void NoteOldRevision() CM_OVERRIDE; - void NoteNewRevision() CM_OVERRIDE; + bool NoteOldRevision() CM_OVERRIDE; + bool NoteNewRevision() CM_OVERRIDE; bool UpdateImpl() CM_OVERRIDE; - void LoadRevisions() CM_OVERRIDE; - void LoadModifications() CM_OVERRIDE; + bool LoadRevisions() CM_OVERRIDE; + bool LoadModifications() CM_OVERRIDE; // Parsing helper classes. class IdentifyParser; diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index a989b12..c99e450 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -6,6 +6,7 @@ #include "cmCTestGenericHandler.h" #include "cmMakefile.h" #include "cmSystemTools.h" +#include "cmWorkingDirectory.h" #include "cmake.h" #include <sstream> @@ -123,8 +124,8 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args, if (capureCMakeError) { this->Makefile->AddDefinition(this->Values[ct_CAPTURE_CMAKE_ERROR], "-1"); - const char* err = this->GetError(); - if (err && !cmSystemTools::FindLastString(err, "unknown error.")) { + std::string const err = this->GetName() + " " + this->GetError(); + if (!cmSystemTools::FindLastString(err.c_str(), "unknown error.")) { cmCTestLog(this->CTest, ERROR_MESSAGE, err << " error from command\n"); } // return success because failure is recorded in CAPTURE_CMAKE_ERROR @@ -216,8 +217,7 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args, handler->SetSubmitIndex(atoi(this->Values[ct_SUBMIT_INDEX])); } } - std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory( + cmWorkingDirectory workdir( this->CTest->GetCTestConfiguration("BuildDirectory")); int res = handler->ProcessHandler(); if (this->Values[ct_RETURN_VALUE] && *this->Values[ct_RETURN_VALUE]) { @@ -243,7 +243,6 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args, this->Makefile->AddDefinition(this->Values[ct_CAPTURE_CMAKE_ERROR], returnString); } - cmSystemTools::ChangeDirectory(current_dir); return true; } diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index c1724ab..2d4726c 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -7,6 +7,7 @@ #include "cmCTestScriptHandler.h" #include "cmCTestTestHandler.h" #include "cmSystemTools.h" +#include "cmWorkingDirectory.h" #include <algorithm> #include <cmsys/FStream.hxx> @@ -138,8 +139,7 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) } } - std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(this->Properties[test]->Directory); + cmWorkingDirectory workdir(this->Properties[test]->Directory); // Lock the resources we'll be using this->LockResources(test); @@ -163,10 +163,11 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) this->TestRunningMap[test] = false; this->RunningCount -= GetProcessorsUsed(test); testRun->EndTest(this->Completed, this->Total, false); - this->Failed->push_back(this->Properties[test]->Name); + if (!this->Properties[test]->Disabled) { + this->Failed->push_back(this->Properties[test]->Name); + } delete testRun; } - cmSystemTools::ChangeDirectory(current_dir); } void cmCTestMultiProcessHandler::LockResources(int index) @@ -683,9 +684,7 @@ void cmCTestMultiProcessHandler::PrintTestList() count++; cmCTestTestHandler::cmCTestTestProperties& p = *it->second; - // push working dir - std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(p.Directory); + cmWorkingDirectory workdir(p.Directory); cmCTestRunTest testRun(this->TestHandler); testRun.SetIndex(p.Index); @@ -724,8 +723,6 @@ void cmCTestMultiProcessHandler::PrintTestList() cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet); cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, p.Name << std::endl, this->Quiet); - // pop working dir - cmSystemTools::ChangeDirectory(current_dir); } cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, std::endl diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index 41b45a8..4f78876 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -369,24 +369,26 @@ std::string cmCTestP4::GetWorkingRevision() return rev; } -void cmCTestP4::NoteOldRevision() +bool cmCTestP4::NoteOldRevision() { this->OldRevision = this->GetWorkingRevision(); cmCTestLog(this->CTest, HANDLER_OUTPUT, " Old revision of repository is: " << this->OldRevision << "\n"); this->PriorRev.Rev = this->OldRevision; + return true; } -void cmCTestP4::NoteNewRevision() +bool cmCTestP4::NoteNewRevision() { this->NewRevision = this->GetWorkingRevision(); cmCTestLog(this->CTest, HANDLER_OUTPUT, " New revision of repository is: " << this->NewRevision << "\n"); + return true; } -void cmCTestP4::LoadRevisions() +bool cmCTestP4::LoadRevisions() { std::vector<char const*> p4_changes; SetP4Options(p4_changes); @@ -399,7 +401,7 @@ void cmCTestP4::LoadRevisions() if (this->OldRevision == "<unknown>" || this->NewRevision == "<unknown>") { cmCTestLog(this->CTest, HANDLER_OUTPUT, " At least one of the revisions " << "is unknown. No repository changes will be reported.\n"); - return; + return false; } range.append("@") @@ -418,7 +420,7 @@ void cmCTestP4::LoadRevisions() this->RunChild(&p4_changes[0], &out, &err); if (ChangeLists.empty()) { - return; + return true; } // p4 describe -s ...@1111111,2222222 @@ -435,9 +437,10 @@ void cmCTestP4::LoadRevisions() OutputLogger errDescribe(this->Log, "p4_describe-err> "); this->RunChild(&p4_describe[0], &outDescribe, &errDescribe); } + return true; } -void cmCTestP4::LoadModifications() +bool cmCTestP4::LoadModifications() { std::vector<char const*> p4_diff; SetP4Options(p4_diff); @@ -453,6 +456,7 @@ void cmCTestP4::LoadModifications() DiffParser out(this, "p4_diff-out> "); OutputLogger err(this->Log, "p4_diff-err> "); this->RunChild(&p4_diff[0], &out, &err); + return true; } bool cmCTestP4::UpdateCustom(const std::string& custom) diff --git a/Source/CTest/cmCTestP4.h b/Source/CTest/cmCTestP4.h index eadc4fb..2c04dc6 100644 --- a/Source/CTest/cmCTestP4.h +++ b/Source/CTest/cmCTestP4.h @@ -51,13 +51,13 @@ private: void SetP4Options(std::vector<char const*>& options); std::string GetWorkingRevision(); - void NoteOldRevision() CM_OVERRIDE; - void NoteNewRevision() CM_OVERRIDE; + bool NoteOldRevision() CM_OVERRIDE; + bool NoteNewRevision() CM_OVERRIDE; bool UpdateImpl() CM_OVERRIDE; bool UpdateCustom(const std::string& custom); - void LoadRevisions() CM_OVERRIDE; - void LoadModifications() CM_OVERRIDE; + bool LoadRevisions() CM_OVERRIDE; + bool LoadModifications() CM_OVERRIDE; class ChangesParser; class DescribeParser; diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index ac1644f..94aa4bd 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -7,6 +7,7 @@ #include "cmCTestTestHandler.h" #include "cmProcess.h" #include "cmSystemTools.h" +#include "cmWorkingDirectory.h" #include <cmConfigure.h> #include <cm_curl.h> @@ -214,6 +215,9 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) if (this->TestProperties->SkipReturnCode >= 0 && this->TestProperties->SkipReturnCode == retVal) { this->TestResult.Status = cmCTestTestHandler::NOT_RUN; + std::ostringstream s; + s << "SKIP_RETURN_CODE=" << this->TestProperties->SkipReturnCode; + this->TestResult.CompletionStatus = s.str(); cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Skipped "); } else if ((success && !this->TestProperties->WillFail) || (!success && this->TestProperties->WillFail)) { @@ -252,6 +256,8 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) cmCTestLog(this->CTest, HANDLER_OUTPUT, "Other"); this->TestResult.Status = cmCTestTestHandler::OTHER_FAULT; } + } else if ("Disabled" == this->TestResult.CompletionStatus) { + cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Not Run (Disabled) "); } else // cmsysProcess_State_Error { cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Not Run "); @@ -270,14 +276,11 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) *this->TestHandler->LogFile << "Test time = " << buf << std::endl; } - // Set the working directory to the tests directory - std::string oldpath = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(this->TestProperties->Directory); - - this->DartProcessing(); - - // restore working directory - cmSystemTools::ChangeDirectory(oldpath); + // Set the working directory to the tests directory to process Dart files. + { + cmWorkingDirectory workdir(this->TestProperties->Directory); + this->DartProcessing(); + } // if this is doing MemCheck then all the output needs to be put into // Output since that is what is parsed by cmCTestMemCheckHandler @@ -356,11 +359,8 @@ bool cmCTestRunTest::StartAgain() } this->RunAgain = false; // reset // change to tests directory - std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(this->TestProperties->Directory); + cmWorkingDirectory workdir(this->TestProperties->Directory); this->StartTest(this->TotalNumberOfTests); - // change back - cmSystemTools::ChangeDirectory(current_dir); return true; } @@ -418,6 +418,24 @@ bool cmCTestRunTest::StartTest(size_t total) << this->TestProperties->Index << ": " << this->TestProperties->Name << std::endl); this->ProcessOutput.clear(); + + // Return immediately if test is disabled + if (this->TestProperties->Disabled) { + this->TestResult.Properties = this->TestProperties; + this->TestResult.ExecutionTime = 0; + this->TestResult.CompressOutput = false; + this->TestResult.ReturnValue = -1; + this->TestResult.CompletionStatus = "Disabled"; + this->TestResult.Status = cmCTestTestHandler::NOT_RUN; + this->TestResult.TestCount = this->TestProperties->Index; + this->TestResult.Name = this->TestProperties->Name; + this->TestResult.Path = this->TestProperties->Directory; + this->TestProcess = new cmProcess; + this->TestResult.Output = "Disabled"; + this->TestResult.FullCommandLine = ""; + return false; + } + this->ComputeArguments(); std::vector<std::string>& args = this->TestProperties->Args; this->TestResult.Properties = this->TestProperties; @@ -442,7 +460,7 @@ bool cmCTestRunTest::StartTest(size_t total) cmCTestLog(this->CTest, HANDLER_OUTPUT, msg << std::endl); this->TestResult.Output = msg; this->TestResult.FullCommandLine = ""; - this->TestResult.CompletionStatus = "Not Run"; + this->TestResult.CompletionStatus = "Fixture dependency failed"; this->TestResult.Status = cmCTestTestHandler::NOT_RUN; return false; } @@ -462,7 +480,7 @@ bool cmCTestRunTest::StartTest(size_t total) cmCTestLog(this->CTest, ERROR_MESSAGE, msg << std::endl); this->TestResult.Output = msg; this->TestResult.FullCommandLine = ""; - this->TestResult.CompletionStatus = "Not Run"; + this->TestResult.CompletionStatus = "Missing Configuration"; this->TestResult.Status = cmCTestTestHandler::NOT_RUN; return false; } @@ -482,7 +500,7 @@ bool cmCTestRunTest::StartTest(size_t total) "Unable to find required file: " << file << std::endl); this->TestResult.Output = "Unable to find required file: " + file; this->TestResult.FullCommandLine = ""; - this->TestResult.CompletionStatus = "Not Run"; + this->TestResult.CompletionStatus = "Required Files Missing"; this->TestResult.Status = cmCTestTestHandler::NOT_RUN; return false; } @@ -498,7 +516,7 @@ bool cmCTestRunTest::StartTest(size_t total) "Unable to find executable: " << args[1] << std::endl); this->TestResult.Output = "Unable to find executable: " + args[1]; this->TestResult.FullCommandLine = ""; - this->TestResult.CompletionStatus = "Not Run"; + this->TestResult.CompletionStatus = "Unable to find executable"; this->TestResult.Status = cmCTestTestHandler::NOT_RUN; return false; } diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 410e0d4..ce395cd 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -97,9 +97,11 @@ std::string cmCTestSVN::LoadInfo(SVNInfo& svninfo) return rev; } -void cmCTestSVN::NoteOldRevision() +bool cmCTestSVN::NoteOldRevision() { - this->LoadRepositories(); + if (!this->LoadRepositories()) { + return false; + } std::list<SVNInfo>::iterator itbeg = this->Repositories.begin(); std::list<SVNInfo>::iterator itend = this->Repositories.end(); @@ -116,11 +118,14 @@ void cmCTestSVN::NoteOldRevision() // Set the global old revision to the one of the root this->OldRevision = this->RootInfo->OldRevision; this->PriorRev.Rev = this->OldRevision; + return true; } -void cmCTestSVN::NoteNewRevision() +bool cmCTestSVN::NoteNewRevision() { - this->LoadRepositories(); + if (!this->LoadRepositories()) { + return false; + } std::list<SVNInfo>::iterator itbeg = this->Repositories.begin(); std::list<SVNInfo>::iterator itend = this->Repositories.end(); @@ -153,6 +158,7 @@ void cmCTestSVN::NoteNewRevision() // Set the global new revision to the one of the root this->NewRevision = this->RootInfo->NewRevision; + return true; } void cmCTestSVN::GuessBase(SVNInfo& svninfo, @@ -370,18 +376,20 @@ private: } }; -void cmCTestSVN::LoadRevisions() +bool cmCTestSVN::LoadRevisions() { + bool result = true; // Get revisions for all the external repositories std::list<SVNInfo>::iterator itbeg = this->Repositories.begin(); std::list<SVNInfo>::iterator itend = this->Repositories.end(); for (; itbeg != itend; itbeg++) { SVNInfo& svninfo = *itbeg; - LoadRevisions(svninfo); + result = this->LoadRevisions(svninfo) && result; } + return result; } -void cmCTestSVN::LoadRevisions(SVNInfo& svninfo) +bool cmCTestSVN::LoadRevisions(SVNInfo& svninfo) { // We are interested in every revision included in the update. std::string revs; @@ -400,7 +408,7 @@ void cmCTestSVN::LoadRevisions(SVNInfo& svninfo) svn_log.push_back(svninfo.LocalPath.c_str()); LogParser out(this, "log-out> ", svninfo); OutputLogger err(this->Log, "log-err> "); - this->RunSVNCommand(svn_log, &out, &err); + return this->RunSVNCommand(svn_log, &out, &err); } void cmCTestSVN::DoRevisionSVN(Revision const& revision, @@ -468,7 +476,7 @@ private: } }; -void cmCTestSVN::LoadModifications() +bool cmCTestSVN::LoadModifications() { // Run "svn status" which reports local modifications. std::vector<const char*> svn_status; @@ -476,6 +484,7 @@ void cmCTestSVN::LoadModifications() StatusParser out(this, "status-out> "); OutputLogger err(this->Log, "status-err> "); this->RunSVNCommand(svn_status, &out, &err); + return true; } void cmCTestSVN::WriteXMLGlobal(cmXMLWriter& xml) @@ -521,10 +530,10 @@ private: } }; -void cmCTestSVN::LoadRepositories() +bool cmCTestSVN::LoadRepositories() { if (!this->Repositories.empty()) { - return; + return true; } // Info for root repository @@ -536,7 +545,7 @@ void cmCTestSVN::LoadRepositories() svn_status.push_back("status"); ExternalParser out(this, "external-out> "); OutputLogger err(this->Log, "external-err> "); - this->RunSVNCommand(svn_status, &out, &err); + return this->RunSVNCommand(svn_status, &out, &err); } std::string cmCTestSVN::SVNInfo::BuildLocalPath(std::string const& path) const diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index c0348c2..e5fe5b7 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -30,8 +30,8 @@ public: private: // Implement cmCTestVC internal API. void CleanupImpl() CM_OVERRIDE; - void NoteOldRevision() CM_OVERRIDE; - void NoteNewRevision() CM_OVERRIDE; + bool NoteOldRevision() CM_OVERRIDE; + bool NoteNewRevision() CM_OVERRIDE; bool UpdateImpl() CM_OVERRIDE; bool RunSVNCommand(std::vector<char const*> const& parameters, @@ -77,10 +77,10 @@ private: SVNInfo* RootInfo; std::string LoadInfo(SVNInfo& svninfo); - void LoadRepositories(); - void LoadModifications() CM_OVERRIDE; - void LoadRevisions() CM_OVERRIDE; - void LoadRevisions(SVNInfo& svninfo); + bool LoadRepositories(); + bool LoadModifications() CM_OVERRIDE; + bool LoadRevisions() CM_OVERRIDE; + bool LoadRevisions(SVNInfo& svninfo); void GuessBase(SVNInfo& svninfo, std::vector<Change> const& changes); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 5e5119d..88193b0 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -19,13 +19,14 @@ #include "cmState.h" #include "cmSystemTools.h" #include "cmThirdParty.h" +#include "cmWorkingDirectory.h" #include "cmXMLParser.h" #include "cmake.h" #if defined(CTEST_USE_XMLRPC) #include "cmVersion.h" +#include "cm_sys_stat.h" #include <cm_xmlrpc.h> -#include <sys/stat.h> #endif #define SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT 120 @@ -1519,7 +1520,6 @@ int cmCTestSubmitHandler::ProcessHandler() #endif } else if (dropMethod == "scp") { std::string url; - std::string oldWorkingDirectory; if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) { url += this->CTest->GetCTestConfiguration("DropSiteUser") + "@"; } @@ -1528,19 +1528,16 @@ int cmCTestSubmitHandler::ProcessHandler() // change to the build directory so that we can uses a relative path // on windows since scp dosn't support "c:" a drive in the path - oldWorkingDirectory = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(buildDirectory); + cmWorkingDirectory workdir(buildDirectory); if (!this->SubmitUsingSCP(this->CTest->GetCTestConfiguration("ScpCommand"), "Testing/" + this->CTest->GetCurrentTag(), files, prefix, url)) { - cmSystemTools::ChangeDirectory(oldWorkingDirectory); cmCTestLog(this->CTest, ERROR_MESSAGE, " Problems when submitting via SCP" << std::endl); ofs << " Problems when submitting via SCP" << std::endl; return -1; } - cmSystemTools::ChangeDirectory(oldWorkingDirectory); cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submission successful" << std::endl, this->Quiet); ofs << " Submission successful" << std::endl; @@ -1550,22 +1547,18 @@ int cmCTestSubmitHandler::ProcessHandler() // change to the build directory so that we can uses a relative path // on windows since scp dosn't support "c:" a drive in the path - std::string oldWorkingDirectory = - cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(buildDirectory); + cmWorkingDirectory workdir(buildDirectory); cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Change directory: " << buildDirectory << std::endl, this->Quiet); if (!this->SubmitUsingCP("Testing/" + this->CTest->GetCurrentTag(), files, prefix, location)) { - cmSystemTools::ChangeDirectory(oldWorkingDirectory); cmCTestLog(this->CTest, ERROR_MESSAGE, " Problems when submitting via CP" << std::endl); ofs << " Problems when submitting via cp" << std::endl; return -1; } - cmSystemTools::ChangeDirectory(oldWorkingDirectory); cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Submission successful" << std::endl, this->Quiet); ofs << " Submission successful" << std::endl; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 6175e50..814b310 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -27,6 +27,7 @@ #include "cmState.h" #include "cmStateSnapshot.h" #include "cmSystemTools.h" +#include "cmWorkingDirectory.h" #include "cmXMLWriter.h" #include "cm_auto_ptr.hxx" #include "cm_utf8.h" @@ -86,22 +87,24 @@ bool cmCTestSubdirCommand::InitialPass(std::vector<std::string> const& args, // No subdirectory? So what... continue; } - cmSystemTools::ChangeDirectory(fname); - const char* testFilename; - if (cmSystemTools::FileExists("CTestTestfile.cmake")) { - // does the CTestTestfile.cmake exist ? - testFilename = "CTestTestfile.cmake"; - } else if (cmSystemTools::FileExists("DartTestfile.txt")) { - // does the DartTestfile.txt exist ? - testFilename = "DartTestfile.txt"; - } else { - // No CTestTestfile? Who cares... - continue; + bool readit = false; + { + cmWorkingDirectory workdir(fname); + const char* testFilename; + if (cmSystemTools::FileExists("CTestTestfile.cmake")) { + // does the CTestTestfile.cmake exist ? + testFilename = "CTestTestfile.cmake"; + } else if (cmSystemTools::FileExists("DartTestfile.txt")) { + // does the DartTestfile.txt exist ? + testFilename = "DartTestfile.txt"; + } else { + // No CTestTestfile? Who cares... + continue; + } + fname += "/"; + fname += testFilename; + readit = this->Makefile->ReadDependentFile(fname.c_str()); } - fname += "/"; - fname += testFilename; - bool readit = this->Makefile->ReadDependentFile(fname.c_str()); - cmSystemTools::ChangeDirectory(cwd); if (!readit) { std::string m = "Could not find include file: "; m += fname; @@ -109,7 +112,6 @@ bool cmCTestSubdirCommand::InitialPass(std::vector<std::string> const& args, return false; } } - cmSystemTools::ChangeDirectory(cwd); return true; } @@ -149,9 +151,7 @@ bool cmCTestAddSubdirectoryCommand::InitialPass( return false; } - std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(cwd); - std::string fname = cwd; + std::string fname = cmSystemTools::GetCurrentWorkingDirectory(); fname += "/"; fname += args[0]; @@ -159,23 +159,23 @@ bool cmCTestAddSubdirectoryCommand::InitialPass( // No subdirectory? So what... return true; } - cmSystemTools::ChangeDirectory(fname); - const char* testFilename; - if (cmSystemTools::FileExists("CTestTestfile.cmake")) { - // does the CTestTestfile.cmake exist ? - testFilename = "CTestTestfile.cmake"; - } else if (cmSystemTools::FileExists("DartTestfile.txt")) { - // does the DartTestfile.txt exist ? - testFilename = "DartTestfile.txt"; - } else { - // No CTestTestfile? Who cares... - cmSystemTools::ChangeDirectory(cwd); - return true; + bool readit = false; + { + const char* testFilename; + if (cmSystemTools::FileExists("CTestTestfile.cmake")) { + // does the CTestTestfile.cmake exist ? + testFilename = "CTestTestfile.cmake"; + } else if (cmSystemTools::FileExists("DartTestfile.txt")) { + // does the DartTestfile.txt exist ? + testFilename = "DartTestfile.txt"; + } else { + // No CTestTestfile? Who cares... + return true; + } + fname += "/"; + fname += testFilename; + readit = this->Makefile->ReadDependentFile(fname.c_str()); } - fname += "/"; - fname += testFilename; - bool readit = this->Makefile->ReadDependentFile(fname.c_str()); - cmSystemTools::ChangeDirectory(cwd); if (!readit) { std::string m = "Could not find include file: "; m += fname; @@ -487,6 +487,19 @@ int cmCTestTestHandler::ProcessHandler() } } + typedef std::set<cmCTestTestHandler::cmCTestTestResult, + cmCTestTestResultLess> + SetOfTests; + SetOfTests resultsSet(this->TestResults.begin(), this->TestResults.end()); + std::vector<cmCTestTestHandler::cmCTestTestResult> disabledTests; + + for (SetOfTests::iterator ftit = resultsSet.begin(); + ftit != resultsSet.end(); ++ftit) { + if (ftit->CompletionStatus == "Disabled") { + disabledTests.push_back(*ftit); + } + } + float percent = float(passed.size()) * 100.0f / float(total); if (!failed.empty() && percent > 99) { percent = 99; @@ -505,21 +518,33 @@ int cmCTestTestHandler::ProcessHandler() "\nTotal Test time (real) = " << realBuf << "\n", this->Quiet); + if (!disabledTests.empty()) { + cmGeneratedFileStream ofs; + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl + << "The following tests are disabled and did not run:" + << std::endl); + this->StartLogFile("TestsDisabled", ofs); + + for (std::vector<cmCTestTestHandler::cmCTestTestResult>::iterator dtit = + disabledTests.begin(); + dtit != disabledTests.end(); ++dtit) { + ofs << dtit->TestCount << ":" << dtit->Name << std::endl; + cmCTestLog(this->CTest, HANDLER_OUTPUT, "\t" + << std::setw(3) << dtit->TestCount << " - " << dtit->Name + << std::endl); + } + } + if (!failed.empty()) { cmGeneratedFileStream ofs; cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl << "The following tests FAILED:" << std::endl); this->StartLogFile("TestsFailed", ofs); - typedef std::set<cmCTestTestHandler::cmCTestTestResult, - cmCTestTestResultLess> - SetOfTests; - SetOfTests resultsSet(this->TestResults.begin(), - this->TestResults.end()); - for (SetOfTests::iterator ftit = resultsSet.begin(); ftit != resultsSet.end(); ++ftit) { - if (ftit->Status != cmCTestTestHandler::COMPLETED) { + if (ftit->Status != cmCTestTestHandler::COMPLETED && + ftit->CompletionStatus != "Disabled") { ofs << ftit->TestCount << ":" << ftit->Name << std::endl; cmCTestLog( this->CTest, HANDLER_OUTPUT, "\t" @@ -841,6 +866,11 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const size_t fixtureTestsAdded = 0; std::set<std::string> addedFixtures; for (size_t i = 0; i < tests.size(); ++i) { + // Skip disabled tests + if (tests[i].Disabled) { + continue; + } + // There are two things to do for each test: // 1. For every fixture required by this test, record that fixture as // being required and create dependencies on that fixture's setup @@ -1200,6 +1230,7 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml) cmCTestTestResult* result = &this->TestResults[cc]; this->WriteTestResultHeader(xml, result); xml.StartElement("Results"); + if (result->Status != cmCTestTestHandler::NOT_RUN) { if (result->Status != cmCTestTestHandler::COMPLETED || result->ReturnValue) { @@ -1208,6 +1239,7 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml) xml.Attribute("name", "Exit Code"); xml.Element("Value", this->GetTestStatus(result->Status)); xml.EndElement(); // NamedMeasurement + xml.StartElement("NamedMeasurement"); xml.Attribute("type", "text/string"); xml.Attribute("name", "Exit Value"); @@ -1222,8 +1254,7 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml) xml.EndElement(); // NamedMeasurement if (!result->Reason.empty()) { const char* reasonType = "Pass Reason"; - if (result->Status != cmCTestTestHandler::COMPLETED && - result->Status != cmCTestTestHandler::NOT_RUN) { + if (result->Status != cmCTestTestHandler::COMPLETED) { reasonType = "Fail Reason"; } xml.StartElement("NamedMeasurement"); @@ -1232,12 +1263,14 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml) xml.Element("Value", result->Reason); xml.EndElement(); // NamedMeasurement } - xml.StartElement("NamedMeasurement"); - xml.Attribute("type", "text/string"); - xml.Attribute("name", "Completion Status"); - xml.Element("Value", result->CompletionStatus); - xml.EndElement(); // NamedMeasurement } + + xml.StartElement("NamedMeasurement"); + xml.Attribute("type", "text/string"); + xml.Attribute("name", "Completion Status"); + xml.Element("Value", result->CompletionStatus); + xml.EndElement(); // NamedMeasurement + xml.StartElement("NamedMeasurement"); xml.Attribute("type", "text/string"); xml.Attribute("name", "Command Line"); @@ -2000,6 +2033,9 @@ bool cmCTestTestHandler::SetTestsProperties( if (key == "WILL_FAIL") { rtit->WillFail = cmSystemTools::IsOn(val.c_str()); } + if (key == "DISABLED") { + rtit->Disabled = cmSystemTools::IsOn(val.c_str()); + } if (key == "ATTACHED_FILES") { cmSystemTools::ExpandListArgument(val, rtit->AttachedFiles); } @@ -2178,6 +2214,7 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args) test.IsInBasedOnREOptions = true; test.WillFail = false; + test.Disabled = false; test.RunSerial = false; test.Timeout = 0; test.ExplicitTimeout = false; diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 5b07e98..a95f088 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -114,6 +114,7 @@ public: std::map<std::string, std::string> Measurements; bool IsInBasedOnREOptions; bool WillFail; + bool Disabled; float Cost; int PreviousRuns; bool RunSerial; diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 0998d59..2b5683a 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -198,7 +198,7 @@ int cmCTestUpdateHandler::ProcessHandler() xml.Element("UpdateType", cmCTestUpdateHandlerUpdateToString(this->UpdateType)); - vc->WriteXML(xml); + bool loadedMods = vc->WriteXML(xml); int localModifications = 0; int numUpdated = vc->GetPathCount(cmCTestVC::PathUpdated); @@ -246,7 +246,7 @@ int cmCTestUpdateHandler::ProcessHandler() xml.EndElement(); // UpdateReturnStatus xml.EndElement(); // Update xml.EndDocument(); - return updated ? numUpdated : -1; + return updated && loadedMods ? numUpdated : -1; } int cmCTestUpdateHandler::DetectVCS(const char* dir) diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index 444c43d..26c9bb5 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -147,23 +147,25 @@ bool cmCTestVC::Update() // just note the current version and finish if (!cmSystemTools::IsOn( this->CTest->GetCTestConfiguration("UpdateVersionOnly").c_str())) { - this->NoteOldRevision(); + result = this->NoteOldRevision() && result; this->Log << "--- Begin Update ---\n"; - result = this->UpdateImpl(); + result = this->UpdateImpl() && result; this->Log << "--- End Update ---\n"; } - this->NoteNewRevision(); + result = this->NoteNewRevision() && result; return result; } -void cmCTestVC::NoteOldRevision() +bool cmCTestVC::NoteOldRevision() { // We do nothing by default. + return true; } -void cmCTestVC::NoteNewRevision() +bool cmCTestVC::NoteNewRevision() { // We do nothing by default. + return true; } bool cmCTestVC::UpdateImpl() diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h index 2681ba0..a1c1673 100644 --- a/Source/CTest/cmCTestVC.h +++ b/Source/CTest/cmCTestVC.h @@ -67,9 +67,9 @@ public: protected: // Internal API to be implemented by subclasses. virtual void CleanupImpl(); - virtual void NoteOldRevision(); + virtual bool NoteOldRevision(); virtual bool UpdateImpl(); - virtual void NoteNewRevision(); + virtual bool NoteNewRevision(); virtual bool WriteXMLUpdates(cmXMLWriter& xml); #if defined(__SUNPRO_CC) && __SUNPRO_CC <= 0x510 diff --git a/Source/Modules/FindLibUV.cmake b/Source/Modules/FindLibUV.cmake index b8cb365..ba13d75 100644 --- a/Source/Modules/FindLibUV.cmake +++ b/Source/Modules/FindLibUV.cmake @@ -49,7 +49,7 @@ They may be set by end users to point at libuv components. #----------------------------------------------------------------------------- find_library(LibUV_LIBRARY - NAMES uv + NAMES uv libuv ) mark_as_advanced(LibUV_LIBRARY) diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 5e03c39..b2f0b2d 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -184,9 +184,9 @@ int main(int argc, char** argv) } #if defined(Q_OS_MAC) +#include "cm_sys_stat.h" #include <errno.h> #include <string.h> -#include <sys/stat.h> #include <unistd.h> static bool cmOSXInstall(std::string const& dir, std::string const& tool) { diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx index eded883..75a2177 100644 --- a/Source/bindexplib.cxx +++ b/Source/bindexplib.cxx @@ -64,85 +64,92 @@ #include "bindexplib.h" #include <cmsys/Encoding.hxx> -#include <fstream> +#include <cmsys/FStream.hxx> #include <iostream> #include <windows.h> -typedef struct cmANON_OBJECT_HEADER_BIGOBJ { - /* same as ANON_OBJECT_HEADER_V2 */ - WORD Sig1; // Must be IMAGE_FILE_MACHINE_UNKNOWN - WORD Sig2; // Must be 0xffff - WORD Version; // >= 2 (implies the Flags field is present) - WORD Machine; // Actual machine - IMAGE_FILE_MACHINE_xxx - DWORD TimeDateStamp; - CLSID ClassID; // {D1BAA1C7-BAEE-4ba9-AF20-FAF66AA4DCB8} - DWORD SizeOfData; // Size of data that follows the header - DWORD Flags; // 0x1 -> contains metadata - DWORD MetaDataSize; // Size of CLR metadata - DWORD MetaDataOffset; // Offset of CLR metadata +#ifndef IMAGE_FILE_MACHINE_ARMNT +#define IMAGE_FILE_MACHINE_ARMNT 0x01c4 +#endif - /* bigobj specifics */ - DWORD NumberOfSections; // extended from WORD - DWORD PointerToSymbolTable; - DWORD NumberOfSymbols; +typedef struct cmANON_OBJECT_HEADER_BIGOBJ +{ + /* same as ANON_OBJECT_HEADER_V2 */ + WORD Sig1; // Must be IMAGE_FILE_MACHINE_UNKNOWN + WORD Sig2; // Must be 0xffff + WORD Version; // >= 2 (implies the Flags field is present) + WORD Machine; // Actual machine - IMAGE_FILE_MACHINE_xxx + DWORD TimeDateStamp; + CLSID ClassID; // {D1BAA1C7-BAEE-4ba9-AF20-FAF66AA4DCB8} + DWORD SizeOfData; // Size of data that follows the header + DWORD Flags; // 0x1 -> contains metadata + DWORD MetaDataSize; // Size of CLR metadata + DWORD MetaDataOffset; // Offset of CLR metadata + + /* bigobj specifics */ + DWORD NumberOfSections; // extended from WORD + DWORD PointerToSymbolTable; + DWORD NumberOfSymbols; } cmANON_OBJECT_HEADER_BIGOBJ; -typedef struct _cmIMAGE_SYMBOL_EX { - union { - BYTE ShortName[8]; - struct { - DWORD Short; // if 0, use LongName - DWORD Long; // offset into string table - } Name; - DWORD LongName[2]; // PBYTE [2] - } N; - DWORD Value; - LONG SectionNumber; - WORD Type; - BYTE StorageClass; - BYTE NumberOfAuxSymbols; +typedef struct _cmIMAGE_SYMBOL_EX +{ + union + { + BYTE ShortName[8]; + struct + { + DWORD Short; // if 0, use LongName + DWORD Long; // offset into string table + } Name; + DWORD LongName[2]; // PBYTE [2] + } N; + DWORD Value; + LONG SectionNumber; + WORD Type; + BYTE StorageClass; + BYTE NumberOfAuxSymbols; } cmIMAGE_SYMBOL_EX; -typedef cmIMAGE_SYMBOL_EX UNALIGNED *cmPIMAGE_SYMBOL_EX; +typedef cmIMAGE_SYMBOL_EX UNALIGNED* cmPIMAGE_SYMBOL_EX; -PIMAGE_SECTION_HEADER GetSectionHeaderOffset(PIMAGE_FILE_HEADER - pImageFileHeader) +PIMAGE_SECTION_HEADER GetSectionHeaderOffset( + PIMAGE_FILE_HEADER pImageFileHeader) { - return (PIMAGE_SECTION_HEADER) - ((DWORD_PTR)pImageFileHeader + - IMAGE_SIZEOF_FILE_HEADER + - pImageFileHeader->SizeOfOptionalHeader); + return (PIMAGE_SECTION_HEADER)((DWORD_PTR)pImageFileHeader + + IMAGE_SIZEOF_FILE_HEADER + + pImageFileHeader->SizeOfOptionalHeader); } -PIMAGE_SECTION_HEADER GetSectionHeaderOffset(cmANON_OBJECT_HEADER_BIGOBJ* - pImageFileHeader) +PIMAGE_SECTION_HEADER GetSectionHeaderOffset( + cmANON_OBJECT_HEADER_BIGOBJ* pImageFileHeader) { - return (PIMAGE_SECTION_HEADER) - ((DWORD_PTR)pImageFileHeader + - sizeof(cmANON_OBJECT_HEADER_BIGOBJ)); + return (PIMAGE_SECTION_HEADER)((DWORD_PTR)pImageFileHeader + + sizeof(cmANON_OBJECT_HEADER_BIGOBJ)); } /* + * Utility func, strstr with size + */ -const char* StrNStr(const char* start, const char* find, size_t &size) { - size_t len; - const char* hint; +const char* StrNStr(const char* start, const char* find, size_t& size) +{ + size_t len; + const char* hint; - if (!start || !find || !size) { - size = 0; - return 0; - } - len = strlen(find); + if (!start || !find || !size) { + size = 0; + return 0; + } + len = strlen(find); - while ((hint = (const char*) memchr(start, find[0], size-len+1))) { - size -= (hint - start); - if (!strncmp(hint, find, len)) - return hint; - start = hint + 1; - } + while ((hint = (const char*)memchr(start, find[0], size - len + 1))) { + size -= (hint - start); + if (!strncmp(hint, find, len)) + return hint; + start = hint + 1; + } - size = 0; - return 0; + size = 0; + return 0; } template < @@ -162,68 +169,18 @@ public: *---------------------------------------------------------------------- */ - DumpSymbols(ObjectHeaderType* ih, - std::set<std::string>& symbols, - std::set<std::string>& dataSymbols, - bool is64) - :Symbols(symbols), DataSymbols(dataSymbols) - { - this->ObjectImageHeader = ih; - this->SymbolTable = (SymbolTableType*) - ((DWORD_PTR)this->ObjectImageHeader - + this->ObjectImageHeader->PointerToSymbolTable); - this->SectionHeaders = - GetSectionHeaderOffset(this->ObjectImageHeader); - this->SymbolCount = this->ObjectImageHeader->NumberOfSymbols; - this->Is64Bit = is64; - } - - /* - *---------------------------------------------------------------------- - * HaveExportedObjects -- - * - * Returns true if export directives (declspec(dllexport)) exist. - * - *---------------------------------------------------------------------- - */ - - bool HaveExportedObjects() { - WORD i = 0; - size_t size = 0; - const char * rawdata = 0; - PIMAGE_SECTION_HEADER pDirectivesSectionHeader = 0; - PIMAGE_SECTION_HEADER pSectionHeaders = this->SectionHeaders; - for(i = 0; (i < this->ObjectImageHeader->NumberOfSections && - !pDirectivesSectionHeader); i++) - if (!strncmp((const char*)&pSectionHeaders[i].Name[0], ".drectve",8)) - pDirectivesSectionHeader = &pSectionHeaders[i]; - if (!pDirectivesSectionHeader) return 0; - - rawdata=(const char*) - this->ObjectImageHeader+pDirectivesSectionHeader->PointerToRawData; - if (!pDirectivesSectionHeader->PointerToRawData || !rawdata) return 0; - - size = pDirectivesSectionHeader->SizeOfRawData; - const char* posImportFlag = rawdata; - while ((posImportFlag = StrNStr(posImportFlag, " /EXPORT:", size))) { - const char* lookingForDict = posImportFlag + 9; - if (!strncmp(lookingForDict, "_G__cpp_",8) || - !strncmp(lookingForDict, "_G__set_cpp_",12)) { - posImportFlag = lookingForDict; - continue; - } - - const char* lookingForDATA = posImportFlag + 9; - while (*(++lookingForDATA) && *lookingForDATA != ' '); - lookingForDATA -= 5; - // ignore DATA exports - if (strncmp(lookingForDATA, ",DATA", 5)) break; - posImportFlag = lookingForDATA + 5; - } - if(posImportFlag) { - return true; - } - return false; + DumpSymbols(ObjectHeaderType* ih, std::set<std::string>& symbols, + std::set<std::string>& dataSymbols, bool isI386) + : Symbols(symbols) + , DataSymbols(dataSymbols) + { + this->ObjectImageHeader = ih; + this->SymbolTable = + (SymbolTableType*)((DWORD_PTR) this->ObjectImageHeader + + this->ObjectImageHeader->PointerToSymbolTable); + this->SectionHeaders = GetSectionHeaderOffset(this->ObjectImageHeader); + this->SymbolCount = this->ObjectImageHeader->NumberOfSymbols; + this->IsI386 = isI386; } /* @@ -233,9 +190,7 @@ public: * Dump an object file's exported symbols. *---------------------------------------------------------------------- */ - void DumpObjFile() { - this->DumpExternalsObjects(); - } + void DumpObjFile() { this->DumpExternalsObjects(); } /* *---------------------------------------------------------------------- @@ -244,7 +199,8 @@ public: * Dumps a COFF symbol table from an OBJ. *---------------------------------------------------------------------- */ - void DumpExternalsObjects() { + void DumpExternalsObjects() + { unsigned i; PSTR stringTable; std::string symbol; @@ -252,82 +208,66 @@ public: /* * The string table apparently starts right after the symbol table */ - stringTable = (PSTR)&this->SymbolTable[this->SymbolCount]; + stringTable = (PSTR) & this->SymbolTable[this->SymbolCount]; SymbolTableType* pSymbolTable = this->SymbolTable; - for ( i=0; i < this->SymbolCount; i++ ) { + for (i = 0; i < this->SymbolCount; i++) { if (pSymbolTable->SectionNumber > 0 && - ( pSymbolTable->Type == 0x20 || pSymbolTable->Type == 0x0)) { - if (pSymbolTable->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) { - /* - * The name of the Function entry points - */ - if (pSymbolTable->N.Name.Short != 0) { - symbol = ""; - symbol.insert(0, (const char *)pSymbolTable->N.ShortName, 8); - } else { - symbol = stringTable + pSymbolTable->N.Name.Long; - } + (pSymbolTable->Type == 0x20 || pSymbolTable->Type == 0x0)) { + if (pSymbolTable->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) { + /* + * The name of the Function entry points + */ + if (pSymbolTable->N.Name.Short != 0) { + symbol = ""; + symbol.insert(0, (const char*)pSymbolTable->N.ShortName, 8); + } else { + symbol = stringTable + pSymbolTable->N.Name.Long; + } - // clear out any leading spaces - while (isspace(symbol[0])) symbol.erase(0,1); - // if it starts with _ and has an @ then it is a __cdecl - // so remove the @ stuff for the export - if(symbol[0] == '_') { - std::string::size_type posAt = symbol.find('@'); - if (posAt != std::string::npos) { - symbol.erase(posAt); - } + // clear out any leading spaces + while (isspace(symbol[0])) + symbol.erase(0, 1); + // if it starts with _ and has an @ then it is a __cdecl + // so remove the @ stuff for the export + if (symbol[0] == '_') { + std::string::size_type posAt = symbol.find('@'); + if (posAt != std::string::npos) { + symbol.erase(posAt); } - // For 64 bit builds we don't need to remove _ - if(!this->Is64Bit) - { - if (symbol[0] == '_') - { - symbol.erase(0,1); - } + } + // For i386 builds we don't need to remove _ + if (this->IsI386 && symbol[0] == '_') { + symbol.erase(0, 1); + } + + /* + Check whether it is "Scalar deleting destructor" and + "Vector deleting destructor" + */ + const char* scalarPrefix = "??_G"; + const char* vectorPrefix = "??_E"; + // original code had a check for + // symbol.find("real@") == std::string::npos) + // but if this disallows memmber functions with the name real + // if scalarPrefix and vectorPrefix are not found then print + // the symbol + if (symbol.compare(0, 4, scalarPrefix) && + symbol.compare(0, 4, vectorPrefix)) { + SectChar = this->SectionHeaders[pSymbolTable->SectionNumber - 1] + .Characteristics; + if (!pSymbolTable->Type && (SectChar & IMAGE_SCN_MEM_WRITE)) { + // Read only (i.e. constants) must be excluded + this->DataSymbols.insert(symbol); + } else { + if (pSymbolTable->Type || !(SectChar & IMAGE_SCN_MEM_READ) || + (SectChar & IMAGE_SCN_MEM_EXECUTE)) { + this->Symbols.insert(symbol); + } else { + // printf(" strange symbol: %s \n",symbol.c_str()); } - /* - Check whether it is "Scalar deleting destructor" and - "Vector deleting destructor" - */ - const char *scalarPrefix = "??_G"; - const char *vectorPrefix = "??_E"; - // original code had a check for - // symbol.find("real@") == std::string::npos) - // but if this disallows memmber functions with the name real - // if scalarPrefix and vectorPrefix are not found then print - // the symbol - if (symbol.compare(0, 4, scalarPrefix) && - symbol.compare(0, 4, vectorPrefix) ) - { - SectChar = - this-> - SectionHeaders[pSymbolTable->SectionNumber-1].Characteristics; - if (!pSymbolTable->Type && (SectChar & IMAGE_SCN_MEM_WRITE)) { - // Read only (i.e. constants) must be excluded - this->DataSymbols.insert(symbol); - } else { - if ( pSymbolTable->Type || - !(SectChar & IMAGE_SCN_MEM_READ)) { - this->Symbols.insert(symbol); - } else { - // printf(" strange symbol: %s \n",symbol.c_str()); - } - } } - } - } - else if (pSymbolTable->SectionNumber == IMAGE_SYM_UNDEFINED && - !pSymbolTable->Type && 0) { - /* - * The IMPORT global variable entry points - */ - if (pSymbolTable->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) { - symbol = stringTable + pSymbolTable->N.Name.Long; - while (isspace(symbol[0])) symbol.erase(0,1); - if (symbol[0] == '_') symbol.erase(0,1); - this->DataSymbols.insert(symbol); - } + } + } } /* @@ -338,111 +278,129 @@ public: pSymbolTable++; } } + private: std::set<std::string>& Symbols; std::set<std::string>& DataSymbols; DWORD_PTR SymbolCount; PIMAGE_SECTION_HEADER SectionHeaders; ObjectHeaderType* ObjectImageHeader; - SymbolTableType* SymbolTable; - bool Is64Bit; + SymbolTableType* SymbolTable; + bool IsI386; }; -bool -DumpFile(const char* filename, - std::set<std::string>& symbols, - std::set<std::string>& dataSymbols) +bool DumpFile(const char* filename, std::set<std::string>& symbols, + std::set<std::string>& dataSymbols) { - HANDLE hFile; - HANDLE hFileMapping; - LPVOID lpFileBase; - PIMAGE_DOS_HEADER dosHeader; + HANDLE hFile; + HANDLE hFileMapping; + LPVOID lpFileBase; + PIMAGE_DOS_HEADER dosHeader; - hFile = CreateFileW(cmsys::Encoding::ToWide(filename).c_str(), - GENERIC_READ, FILE_SHARE_READ, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); + hFile = CreateFileW(cmsys::Encoding::ToWide(filename).c_str(), GENERIC_READ, + FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, 0); - if (hFile == INVALID_HANDLE_VALUE) { - fprintf(stderr, "Couldn't open file '%s' with CreateFile()\n", filename); - return false; - } + if (hFile == INVALID_HANDLE_VALUE) { + fprintf(stderr, "Couldn't open file '%s' with CreateFile()\n", filename); + return false; + } - hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL); - if (hFileMapping == 0) { - CloseHandle(hFile); - fprintf(stderr, "Couldn't open file mapping with CreateFileMapping()\n"); - return false; - } + hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL); + if (hFileMapping == 0) { + CloseHandle(hFile); + fprintf(stderr, "Couldn't open file mapping with CreateFileMapping()\n"); + return false; + } - lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0); - if (lpFileBase == 0) { - CloseHandle(hFileMapping); - CloseHandle(hFile); - fprintf(stderr, "Couldn't map view of file with MapViewOfFile()\n"); - return false; - } + lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0); + if (lpFileBase == 0) { + CloseHandle(hFileMapping); + CloseHandle(hFile); + fprintf(stderr, "Couldn't map view of file with MapViewOfFile()\n"); + return false; + } - dosHeader = (PIMAGE_DOS_HEADER)lpFileBase; - if (dosHeader->e_magic == IMAGE_DOS_SIGNATURE) { - fprintf(stderr, "File is an executable. I don't dump those.\n"); - return false; - } - /* Does it look like a i386 COFF OBJ file??? */ - else if ( - ((dosHeader->e_magic == IMAGE_FILE_MACHINE_I386) || - (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64)) - && (dosHeader->e_sp == 0) - ) { - /* - * The two tests above aren't what they look like. They're - * really checking for IMAGE_FILE_HEADER.Machine == i386 (0x14C) - * and IMAGE_FILE_HEADER.SizeOfOptionalHeader == 0; - */ - DumpSymbols<IMAGE_FILE_HEADER, IMAGE_SYMBOL> - symbolDumper((PIMAGE_FILE_HEADER) lpFileBase, symbols, dataSymbols, - (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64)); + dosHeader = (PIMAGE_DOS_HEADER)lpFileBase; + if (dosHeader->e_magic == IMAGE_DOS_SIGNATURE) { + fprintf(stderr, "File is an executable. I don't dump those.\n"); + return false; + } + /* Does it look like a COFF OBJ file??? */ + else if (((dosHeader->e_magic == IMAGE_FILE_MACHINE_I386) || + (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64) || + (dosHeader->e_magic == IMAGE_FILE_MACHINE_ARMNT)) && + (dosHeader->e_sp == 0)) { + /* + * The two tests above aren't what they look like. They're + * really checking for IMAGE_FILE_HEADER.Machine == i386 (0x14C) + * and IMAGE_FILE_HEADER.SizeOfOptionalHeader == 0; + */ + DumpSymbols<IMAGE_FILE_HEADER, IMAGE_SYMBOL> symbolDumper( + (PIMAGE_FILE_HEADER)lpFileBase, symbols, dataSymbols, + (dosHeader->e_magic == IMAGE_FILE_MACHINE_I386)); + symbolDumper.DumpObjFile(); + } else { + // check for /bigobj format + cmANON_OBJECT_HEADER_BIGOBJ* h = (cmANON_OBJECT_HEADER_BIGOBJ*)lpFileBase; + if (h->Sig1 == 0x0 && h->Sig2 == 0xffff) { + DumpSymbols<cmANON_OBJECT_HEADER_BIGOBJ, cmIMAGE_SYMBOL_EX> symbolDumper( + (cmANON_OBJECT_HEADER_BIGOBJ*)lpFileBase, symbols, dataSymbols, + (h->Machine == IMAGE_FILE_MACHINE_I386)); symbolDumper.DumpObjFile(); - } else { - // check for /bigobj format - cmANON_OBJECT_HEADER_BIGOBJ* h = - (cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase; - if(h->Sig1 == 0x0 && h->Sig2 == 0xffff) { - DumpSymbols<cmANON_OBJECT_HEADER_BIGOBJ, cmIMAGE_SYMBOL_EX> - symbolDumper((cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase, symbols, - dataSymbols, - (h->Machine == IMAGE_FILE_MACHINE_AMD64)); - symbolDumper.DumpObjFile(); - } else { - printf("unrecognized file format in '%s'\n", filename); - return false; - } - } - UnmapViewOfFile(lpFileBase); - CloseHandle(hFileMapping); - CloseHandle(hFile); - return true; + } else { + printf("unrecognized file format in '%s'\n", filename); + return false; + } + } + UnmapViewOfFile(lpFileBase); + CloseHandle(hFileMapping); + CloseHandle(hFile); + return true; } bool bindexplib::AddObjectFile(const char* filename) { - if(!DumpFile(filename, this->Symbols, this->DataSymbols)) - { + return DumpFile(filename, this->Symbols, this->DataSymbols); +} + +bool bindexplib::AddDefinitionFile(const char* filename) +{ + cmsys::ifstream infile(filename); + if (!infile) { + fprintf(stderr, "Couldn't open definition file '%s'\n", filename); return false; + } + std::string str; + while (std::getline(infile, str)) { + // skip the LIBRAY and EXPORTS lines (if any) + if ((str.compare(0, 7, "LIBRARY") == 0) || + (str.compare(0, 7, "EXPORTS") == 0)) { + continue; + } + // remove leading tabs & spaces + str.erase(0, str.find_first_not_of(" \t")); + std::size_t found = str.find(" \t DATA"); + if (found != std::string::npos) { + str.erase(found, std::string::npos); + this->DataSymbols.insert(str); + } else { + this->Symbols.insert(str); } + } + infile.close(); return true; } void bindexplib::WriteFile(FILE* file) { - fprintf(file,"EXPORTS \n"); - for(std::set<std::string>::const_iterator i = this->DataSymbols.begin(); - i!= this->DataSymbols.end(); ++i) - { + fprintf(file, "EXPORTS \n"); + for (std::set<std::string>::const_iterator i = this->DataSymbols.begin(); + i != this->DataSymbols.end(); ++i) { fprintf(file, "\t%s \t DATA\n", i->c_str()); - } - for(std::set<std::string>::const_iterator i = this->Symbols.begin(); - i!= this->Symbols.end(); ++i) - { + } + for (std::set<std::string>::const_iterator i = this->Symbols.begin(); + i != this->Symbols.end(); ++i) { fprintf(file, "\t%s\n", i->c_str()); - } + } } diff --git a/Source/bindexplib.h b/Source/bindexplib.h index d6900ba..51fe49d 100644 --- a/Source/bindexplib.h +++ b/Source/bindexplib.h @@ -13,8 +13,10 @@ class bindexplib { public: bindexplib() {} + bool AddDefinitionFile(const char* filename); bool AddObjectFile(const char* filename); void WriteFile(FILE* file); + private: std::set<std::string> Symbols; std::set<std::string> DataSymbols; diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 7c683ad..f5469e5 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -101,6 +101,12 @@ FwdIt cmRotate(FwdIt first, FwdIt middle, FwdIt last) return first; } +template <typename Container, typename Predicate> +void cmEraseIf(Container& cont, Predicate pred) +{ + cont.erase(std::remove_if(cont.begin(), cont.end(), pred), cont.end()); +} + namespace ContainerAlgorithms { template <typename T> diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx index 1e1cd21..93e5ca2 100644 --- a/Source/cmBuildNameCommand.cxx +++ b/Source/cmBuildNameCommand.cxx @@ -6,7 +6,6 @@ #include <cmsys/RegularExpression.hxx> #include "cmMakefile.h" -#include "cmPolicies.h" #include "cmStateTypes.h" #include "cmSystemTools.h" @@ -16,11 +15,6 @@ class cmExecutionStatus; bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args, cmExecutionStatus&) { - if (this->Disallowed( - cmPolicies::CMP0036, - "The build_name command should not be called; see CMP0036.")) { - return true; - } if (args.empty()) { this->SetError("called with incorrect number of arguments"); return false; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 559275e..e6e50e9 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1122,7 +1122,6 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output, if (log) { *log << "* Run internal CTest" << std::endl; } - std::string oldpath = cmSystemTools::GetCurrentWorkingDirectory(); CM_AUTO_PTR<cmSystemTools::SaveRestoreEnvironment> saveEnv; if (modifyEnv) { @@ -1137,7 +1136,6 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output, if (log && output) { *log << *output; } - cmSystemTools::ChangeDirectory(oldpath); if (output) { cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "Internal cmCTest object used to run test." << std::endl diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 4d33458..be736da 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -14,29 +14,12 @@ #include <time.h> #include <vector> -class cmCTest; class cmCTestGenericHandler; class cmCTestStartCommand; class cmGeneratedFileStream; class cmMakefile; class cmXMLWriter; -#define cmCTestLog(ctSelf, logType, msg) \ - do { \ - std::ostringstream cmCTestLog_msg; \ - cmCTestLog_msg << msg; \ - (ctSelf)->Log(cmCTest::logType, __FILE__, __LINE__, \ - cmCTestLog_msg.str().c_str()); \ - } while (false) - -#define cmCTestOptionalLog(ctSelf, logType, msg, suppress) \ - do { \ - std::ostringstream cmCTestLog_msg; \ - cmCTestLog_msg << msg; \ - (ctSelf)->Log(cmCTest::logType, __FILE__, __LINE__, \ - cmCTestLog_msg.str().c_str(), suppress); \ - } while (false) - /** \class cmCTest * \brief Represents a ctest invocation. * @@ -648,4 +631,20 @@ inline std::ostream& operator<<(std::ostream& os, const cmCTestLogWrite& c) return os; } +#define cmCTestLog(ctSelf, logType, msg) \ + do { \ + std::ostringstream cmCTestLog_msg; \ + cmCTestLog_msg << msg; \ + (ctSelf)->Log(cmCTest::logType, __FILE__, __LINE__, \ + cmCTestLog_msg.str().c_str()); \ + } while (false) + +#define cmCTestOptionalLog(ctSelf, logType, msg, suppress) \ + do { \ + std::ostringstream cmCTestLog_msg; \ + cmCTestLog_msg << msg; \ + (ctSelf)->Log(cmCTest::logType, __FILE__, __LINE__, \ + cmCTestLog_msg.str().c_str(), suppress); \ + } while (false) + #endif diff --git a/Source/cmCommand.cxx b/Source/cmCommand.cxx index 181b412..d349c91 100644 --- a/Source/cmCommand.cxx +++ b/Source/cmCommand.cxx @@ -3,7 +3,6 @@ #include "cmCommand.h" #include "cmMakefile.h" -#include "cmake.h" class cmExecutionStatus; struct cmListFileArgument; @@ -23,32 +22,12 @@ bool cmCommand::InvokeInitialPass(const std::vector<cmListFileArgument>& args, const char* cmCommand::GetError() { if (this->Error.empty()) { - this->Error = this->GetName(); - this->Error += " unknown error."; + return "unknown error."; } return this->Error.c_str(); } void cmCommand::SetError(const std::string& e) { - this->Error = this->GetName(); - this->Error += " "; - this->Error += e; -} - -bool cmCommand::Disallowed(cmPolicies::PolicyID pol, const char* e) -{ - switch (this->Makefile->GetPolicyStatus(pol)) { - case cmPolicies::WARN: - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, - cmPolicies::GetPolicyWarning(pol)); - case cmPolicies::OLD: - return false; - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::NEW: - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e); - break; - } - return true; + this->Error = e; } diff --git a/Source/cmCommand.h b/Source/cmCommand.h index d9fd5a2..9107d85 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -7,9 +7,6 @@ #include <string> #include <vector> -#include "cmCommandArgumentsHelper.h" -#include "cmPolicies.h" - class cmExecutionStatus; class cmMakefile; struct cmListFileArgument; @@ -105,12 +102,12 @@ public: */ void SetError(const std::string& e); - /** Check if the command is disallowed by a policy. */ - bool Disallowed(cmPolicies::PolicyID pol, const char* e); +private: + cmCommand(cmCommand const&); // = delete; + cmCommand& operator=(cmCommand const&); // = delete; protected: cmMakefile* Makefile; - cmCommandArgumentsHelper Helper; private: std::string Error; diff --git a/Source/cmCommandArgumentParser.cxx b/Source/cmCommandArgumentParser.cxx index e384f21..4a7acfc 100644 --- a/Source/cmCommandArgumentParser.cxx +++ b/Source/cmCommandArgumentParser.cxx @@ -1,16 +1,13 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -/* A Bison parser, made by GNU Bison 2.3. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -18,9 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -49,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -57,58 +52,23 @@ /* Pure parsers. */ #define YYPURE 1 -/* Using locations. */ -#define YYLSP_NEEDED 0 - -/* Substitute the variable and function names. */ -#define yyparse cmCommandArgument_yyparse -#define yylex cmCommandArgument_yylex -#define yyerror cmCommandArgument_yyerror -#define yylval cmCommandArgument_yylval -#define yychar cmCommandArgument_yychar -#define yydebug cmCommandArgument_yydebug -#define yynerrs cmCommandArgument_yynerrs - +/* Push parsers. */ +#define YYPUSH 0 -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - cal_ENVCURLY = 258, - cal_NCURLY = 259, - cal_DCURLY = 260, - cal_DOLLAR = 261, - cal_LCURLY = 262, - cal_RCURLY = 263, - cal_NAME = 264, - cal_BSLASH = 265, - cal_SYMBOL = 266, - cal_AT = 267, - cal_ERROR = 268, - cal_ATNAME = 269 - }; -#endif -/* Tokens. */ -#define cal_ENVCURLY 258 -#define cal_NCURLY 259 -#define cal_DCURLY 260 -#define cal_DOLLAR 261 -#define cal_LCURLY 262 -#define cal_RCURLY 263 -#define cal_NAME 264 -#define cal_BSLASH 265 -#define cal_SYMBOL 266 -#define cal_AT 267 -#define cal_ERROR 268 -#define cal_ATNAME 269 +/* Pull parsers. */ +#define YYPULL 1 +/* Substitute the variable and function names. */ +#define yyparse cmCommandArgument_yyparse +#define yylex cmCommandArgument_yylex +#define yyerror cmCommandArgument_yyerror +#define yydebug cmCommandArgument_yydebug +#define yynerrs cmCommandArgument_yynerrs /* Copy the first part of user declarations. */ -#line 1 "cmCommandArgumentParser.y" +#line 1 "cmCommandArgumentParser.y" /* yacc.c:339 */ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ @@ -121,19 +81,14 @@ Run bison like this: bison --yacc --name-prefix=cmCommandArgument_yy --defines=cmCommandArgumentParserTokens.h -ocmCommandArgumentParser.cxx cmCommandArgumentParser.y Modify cmCommandArgumentParser.cxx: - - remove TABs - - put header block at top of file + - "#if 0" out yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"] */ -#include "cmStandardIncludes.h" +#include <cmConfigure.h> // IWYU pragma: keep + +#include <string.h> -/* Configure the parser to use a lexer object. */ -#define YYPARSE_PARAM yyscanner -#define YYLEX_PARAM yyscanner -#define YYERROR_VERBOSE 1 -#define cmCommandArgument_yyerror(x) \ - cmCommandArgumentError(yyscanner, x) #define yyGetParser (cmCommandArgument_yyget_extra(yyscanner)) /* Make sure malloc and free are available on QNX. */ @@ -156,10 +111,9 @@ Modify cmCommandArgumentParser.cxx: /* Forward declare the lexer entry point. */ YY_DECL; -/* Internal utility functions. */ -static void cmCommandArgumentError(yyscan_t yyscanner, const char* message); +/* Helper function to forward error callback from parser. */ +static void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message); -#define YYDEBUG 1 /* Configure the parser to support large input. */ #define YYMAXDEPTH 100000 #define YYINITDEPTH 10000 @@ -173,39 +127,80 @@ static void cmCommandArgumentError(yyscan_t yyscanner, const char* message); # pragma warning (disable: 4702) /* unreachable code */ #endif +#line 131 "cmCommandArgumentParser.cxx" /* yacc.c:339 */ -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else -# define YYERROR_VERBOSE 0 +# define YYERROR_VERBOSE 1 #endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 +/* In a future release of Bison, this section will be replaced + by #include "cmCommandArgumentParserTokens.h". */ +#ifndef YY_CMCOMMANDARGUMENT_YY_CMCOMMANDARGUMENTPARSERTOKENS_H_INCLUDED +# define YY_CMCOMMANDARGUMENT_YY_CMCOMMANDARGUMENTPARSERTOKENS_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int cmCommandArgument_yydebug; #endif -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef int YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + cal_ENVCURLY = 258, + cal_NCURLY = 259, + cal_DCURLY = 260, + cal_DOLLAR = 261, + cal_LCURLY = 262, + cal_RCURLY = 263, + cal_NAME = 264, + cal_BSLASH = 265, + cal_SYMBOL = 266, + cal_AT = 267, + cal_ERROR = 268, + cal_ATNAME = 269 + }; #endif +/* Tokens. */ +#define cal_ENVCURLY 258 +#define cal_NCURLY 259 +#define cal_DCURLY 260 +#define cal_DOLLAR 261 +#define cal_LCURLY 262 +#define cal_RCURLY 263 +#define cal_NAME 264 +#define cal_BSLASH 265 +#define cal_SYMBOL 266 +#define cal_AT 267 +#define cal_ERROR 268 +#define cal_ATNAME 269 +/* Value type. */ -/* Copy the second part of user declarations. */ +int cmCommandArgument_yyparse (yyscan_t yyscanner); + +#endif /* !YY_CMCOMMANDARGUMENT_YY_CMCOMMANDARGUMENTPARSERTOKENS_H_INCLUDED */ + +/* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 227 "cmCommandArgumentParser.cxx" +#line 204 "cmCommandArgumentParser.cxx" /* yacc.c:358 */ #ifdef short # undef short @@ -219,11 +214,8 @@ typedef unsigned char yytype_uint8; #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; #else -typedef short int yytype_int8; +typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 @@ -243,8 +235,7 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# elif ! defined YYSIZE_T # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -258,39 +249,68 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ -# define YY_(msgid) msgid +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) +# define YYUSE(E) ((void) (E)) #else -# define YYUSE(e) /* empty */ +# define YYUSE(E) /* empty */ #endif -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") #else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int i) -#else -static int -YYID (i) - int i; +# define YY_INITIAL_VALUE(Value) Value #endif -{ - return i; -} +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif + #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -308,11 +328,11 @@ YYID (i) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # endif @@ -320,8 +340,8 @@ YYID (i) # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely @@ -335,25 +355,23 @@ YYID (i) # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# if (defined __cplusplus && ! defined _STDLIB_H \ +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif @@ -368,9 +386,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -381,42 +399,46 @@ union yyalloc ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif +# define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ - while (YYID (0)) + while (0) #endif +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + /* YYFINAL -- State number of the termination state. */ #define YYFINAL 25 /* YYLAST -- Last index in YYTABLE. */ @@ -428,17 +450,19 @@ union yyalloc #define YYNNTS 10 /* YYNRULES -- Number of rules. */ #define YYNRULES 24 -/* YYNRULES -- Number of states. */ +/* YYNSTATES -- Number of states. */ #define YYNSTATES 33 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 269 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -471,36 +495,16 @@ static const yytype_uint8 yytranslate[] = }; #if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint8 yyprhs[] = -{ - 0, 0, 3, 5, 7, 10, 11, 14, 16, 18, - 20, 22, 24, 26, 28, 30, 34, 38, 42, 44, - 46, 49, 50, 53, 55 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 16, 0, -1, 17, -1, 18, -1, 18, 10, -1, - -1, 19, 18, -1, 20, -1, 21, -1, 9, -1, - 12, -1, 6, -1, 7, -1, 8, -1, 11, -1, - 3, 22, 8, -1, 4, 23, 8, -1, 5, 23, - 8, -1, 14, -1, 23, -1, 11, 22, -1, -1, - 24, 23, -1, 9, -1, 21, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 116, 116, 123, 128, 134, 138, 144, 149, 155, - 160, 165, 170, 175, 180, 186, 192, 198, 204, 210, - 215, 221, 225, 231, 236 + 0, 96, 96, 102, 105, 110, 113, 118, 121, 126, + 129, 132, 135, 138, 141, 146, 149, 152, 155, 160, + 163, 168, 171, 176, 179 }; #endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +#if YYDEBUG || YYERROR_VERBOSE || 1 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -509,13 +513,13 @@ static const char *const yytname[] = "cal_DCURLY", "\"$\"", "\"{\"", "\"}\"", "cal_NAME", "\"\\\\\"", "cal_SYMBOL", "\"@\"", "cal_ERROR", "cal_ATNAME", "$accept", "Start", "GoalWithOptionalBackSlash", "Goal", "String", "OuterText", "Variable", - "EnvVarName", "MultipleIds", "ID", 0 + "EnvVarName", "MultipleIds", "ID", YY_NULLPTR }; #endif # ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, @@ -523,25 +527,29 @@ static const yytype_uint16 yytoknum[] = }; # endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 15, 16, 17, 17, 18, 18, 19, 19, 20, - 20, 20, 20, 20, 20, 21, 21, 21, 21, 22, - 22, 23, 23, 24, 24 -}; +#define YYPACT_NINF -3 -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-3))) + +#define YYTABLE_NINF -1 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int8 yypact[] = { - 0, 2, 1, 1, 2, 0, 2, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 3, 3, 1, 1, - 2, 0, 2, 1, 1 + 0, 14, 26, 26, -3, -3, -3, -3, -3, -3, + -3, 10, -3, 3, 0, -3, -3, -3, 14, -3, + 7, -3, 26, 13, 16, -3, -3, -3, -3, -3, + -3, -3, -3 }; -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ static const yytype_uint8 yydefact[] = { 5, 21, 21, 21, 11, 12, 13, 9, 14, 10, @@ -550,34 +558,21 @@ static const yytype_uint8 yydefact[] = 22, 16, 17 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = -{ - -1, 11, 12, 13, 14, 15, 19, 20, 21, 22 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -3 -static const yytype_int8 yypact[] = + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = { - 0, 14, 26, 26, -3, -3, -3, -3, -3, -3, - -3, 10, -3, 3, 0, -3, -3, -3, 14, -3, - 7, -3, 26, 13, 16, -3, -3, -3, -3, -3, - -3, -3, -3 + -3, -3, -3, 8, -3, -3, 2, 9, -2, -3 }; -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = { - -3, -3, -3, 8, -3, -3, 2, 9, -2, -3 + -1, 11, 12, 13, 14, 15, 19, 20, 21, 22 }; -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { 23, 24, 16, 1, 2, 3, 4, 5, 6, 7, @@ -596,8 +591,8 @@ static const yytype_int8 yycheck[] = 14 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 3, 4, 5, 6, 7, 8, 9, 11, 12, @@ -606,6 +601,23 @@ static const yytype_uint8 yystos[] = 23, 8, 8 }; + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 15, 16, 17, 17, 18, 18, 19, 19, 20, + 20, 20, 20, 20, 20, 21, 21, 21, 21, 22, + 22, 23, 23, 24, 24 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 2, 0, 2, 1, 1, 1, + 1, 1, 1, 1, 1, 3, 3, 3, 1, 1, + 2, 0, 2, 1, 1 +}; + + #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) @@ -616,85 +628,30 @@ static const yytype_uint8 yystos[] = #define YYERROR goto yyerrorlab -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ - -#define YYFAIL goto yyerrlab - #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ - if (yychar == YYEMPTY && yylen == 1) \ + if (yychar == YYEMPTY) \ { \ yychar = (Token); \ yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ goto yybackup; \ } \ else \ { \ - yyerror (YY_("syntax error: cannot back up")); \ + yyerror (yyscanner, YY_("syntax error: cannot back up")); \ YYERROR; \ } \ -while (YYID (0)) - +while (0) +/* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, YYLEX_PARAM) -#else -# define YYLEX yylex (&yylval) -#endif /* Enable debugging if requested. */ #if YYDEBUG @@ -708,7 +665,13 @@ while (YYID (0)) do { \ if (yydebug) \ YYFPRINTF Args; \ -} while (YYID (0)) +} while (0) + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ @@ -716,42 +679,29 @@ do { \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ - Type, Value); \ + Type, Value, yyscanner); \ YYFPRINTF (stderr, "\n"); \ } \ -} while (YYID (0)) +} while (0) -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner) { + FILE *yyo = yyoutput; + YYUSE (yyo); + YYUSE (yyscanner); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); # endif - switch (yytype) - { - default: - break; - } + YYUSE (yytype); } @@ -759,24 +709,13 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) | Print this symbol on YYOUTPUT. | `--------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; -#endif +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner) { - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - yy_symbol_value_print (yyoutput, yytype, yyvaluep); + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner); YYFPRINTF (yyoutput, ")"); } @@ -785,20 +724,15 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) | TOP (included). | `------------------------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) -#else -static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; -#endif +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -806,45 +740,38 @@ yy_stack_print (bottom, top) do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +} while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; -#endif +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, yyscan_t yyscanner) { + unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - fprintf (stderr, "\n"); + , yyscanner); + YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) + yy_reduce_print (yyssp, yyvsp, Rule, yyscanner); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -873,7 +800,6 @@ int yydebug; # define YYMAXDEPTH 10000 #endif - #if YYERROR_VERBOSE @@ -882,15 +808,8 @@ int yydebug; # define yystrlen strlen # else /* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) @@ -906,16 +825,8 @@ yystrlen (yystr) # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif { char *yyd = yydest; const char *yys = yysrc; @@ -976,165 +887,159 @@ yytnamerr (char *yyres, const char *yystr) } # endif -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) -{ - int yyn = yypact[yystate]; +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } - if (yysize_overflow) - return YYSIZE_MAXIMUM; + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } - if (yyresult) + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; } - return yysize; - } + else + { + yyp++; + yyformat++; + } + } + return 0; } #endif /* YYERROR_VERBOSE */ - /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, yyscan_t yyscanner) { YYUSE (yyvaluep); - + YYUSE (yyscanner); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - switch (yytype) - { - - default: - break; - } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } - - -/* Prevent warnings from -Wmissing-prototypes. */ - -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - - @@ -1143,99 +1048,76 @@ int yyparse (); | yyparse. | `----------*/ -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) int -yyparse (void) -#else -int -yyparse () - -#endif -#endif +yyparse (yyscan_t yyscanner) { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ -YYSTYPE yylval; - -/* Number of syntax errors so far. */ -int yynerrs; - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. +/* The semantic value of the lookahead symbol. */ +/* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + /* Number of syntax errors so far. */ + int yynerrs; - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss; - yyvsp = yyvs; - + yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; /*------------------------------------------------------------. @@ -1262,7 +1144,6 @@ int yynerrs; YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; - /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -1270,7 +1151,6 @@ int yynerrs; yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); yyss = yyss1; @@ -1293,9 +1173,8 @@ int yynerrs; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1306,7 +1185,6 @@ int yynerrs; yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1316,6 +1194,9 @@ int yynerrs; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1324,20 +1205,20 @@ int yynerrs; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yypact_value_is_default (yyn)) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (&yylval, yyscanner); } if (yychar <= YYEOF) @@ -1359,29 +1240,27 @@ yybackup: yyn = yytable[yyn]; if (yyn <= 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) + if (yytable_value_is_error (yyn)) goto yyerrlab; yyn = -yyn; goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; @@ -1404,7 +1283,7 @@ yyreduce: yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1418,175 +1297,205 @@ yyreduce: switch (yyn) { case 2: -#line 117 "cmCommandArgumentParser.y" +#line 96 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = 0; - yyGetParser->SetResult((yyvsp[(1) - (1)].str)); -} + (yyval.str) = 0; + yyGetParser->SetResult((yyvsp[0].str)); + } +#line 1306 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 3: -#line 124 "cmCommandArgumentParser.y" +#line 102 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[(1) - (1)].str); -} + (yyval.str) = (yyvsp[0].str); + } +#line 1314 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 4: -#line 129 "cmCommandArgumentParser.y" +#line 105 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = yyGetParser->CombineUnions((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); -} + (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str)); + } +#line 1322 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 5: -#line 134 "cmCommandArgumentParser.y" +#line 110 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = 0; -} + (yyval.str) = 0; + } +#line 1330 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 6: -#line 139 "cmCommandArgumentParser.y" +#line 113 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = yyGetParser->CombineUnions((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); -} + (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str)); + } +#line 1338 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 7: -#line 145 "cmCommandArgumentParser.y" +#line 118 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[(1) - (1)].str); -} + (yyval.str) = (yyvsp[0].str); + } +#line 1346 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 8: -#line 150 "cmCommandArgumentParser.y" +#line 121 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[(1) - (1)].str); -} + (yyval.str) = (yyvsp[0].str); + } +#line 1354 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 9: -#line 156 "cmCommandArgumentParser.y" +#line 126 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[(1) - (1)].str); -} + (yyval.str) = (yyvsp[0].str); + } +#line 1362 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 10: -#line 161 "cmCommandArgumentParser.y" +#line 129 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[(1) - (1)].str); -} + (yyval.str) = (yyvsp[0].str); + } +#line 1370 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 11: -#line 166 "cmCommandArgumentParser.y" +#line 132 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[(1) - (1)].str); -} + (yyval.str) = (yyvsp[0].str); + } +#line 1378 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 12: -#line 171 "cmCommandArgumentParser.y" +#line 135 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[(1) - (1)].str); -} + (yyval.str) = (yyvsp[0].str); + } +#line 1386 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 13: -#line 176 "cmCommandArgumentParser.y" +#line 138 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[(1) - (1)].str); -} + (yyval.str) = (yyvsp[0].str); + } +#line 1394 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 14: -#line 181 "cmCommandArgumentParser.y" +#line 141 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[(1) - (1)].str); -} + (yyval.str) = (yyvsp[0].str); + } +#line 1402 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 15: -#line 187 "cmCommandArgumentParser.y" +#line 146 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[(1) - (3)].str),(yyvsp[(2) - (3)].str)); - //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl; -} + (yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[-2].str), (yyvsp[-1].str)); + } +#line 1410 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 16: -#line 193 "cmCommandArgumentParser.y" +#line 149 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[(1) - (3)].str),(yyvsp[(2) - (3)].str)); - //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl; -} + (yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[-2].str), (yyvsp[-1].str)); + } +#line 1418 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 17: -#line 199 "cmCommandArgumentParser.y" +#line 152 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = yyGetParser->ExpandVariable((yyvsp[(2) - (3)].str)); - //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl; -} + (yyval.str) = yyGetParser->ExpandVariable((yyvsp[-1].str)); + } +#line 1426 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 18: -#line 205 "cmCommandArgumentParser.y" +#line 155 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = yyGetParser->ExpandVariableForAt((yyvsp[(1) - (1)].str)); -} + (yyval.str) = yyGetParser->ExpandVariableForAt((yyvsp[0].str)); + } +#line 1434 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 19: -#line 211 "cmCommandArgumentParser.y" +#line 160 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[(1) - (1)].str); -} + (yyval.str) = (yyvsp[0].str); + } +#line 1442 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 20: -#line 216 "cmCommandArgumentParser.y" +#line 163 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[(1) - (2)].str); -} + (yyval.str) = (yyvsp[-1].str); + } +#line 1450 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 21: -#line 221 "cmCommandArgumentParser.y" +#line 168 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = 0; -} + (yyval.str) = 0; + } +#line 1458 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 22: -#line 226 "cmCommandArgumentParser.y" +#line 171 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = yyGetParser->CombineUnions((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); -} + (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str)); + } +#line 1466 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 23: -#line 232 "cmCommandArgumentParser.y" +#line 176 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[(1) - (1)].str); -} + (yyval.str) = (yyvsp[0].str); + } +#line 1474 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 24: -#line 237 "cmCommandArgumentParser.y" +#line 179 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { - (yyval.str) = (yyvsp[(1) - (1)].str); -} + (yyval.str) = (yyvsp[0].str); + } +#line 1482 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; -/* Line 1267 of yacc.c. */ -#line 1606 "cmCommandArgumentParser.cxx" +#line 1486 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ default: break; } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); @@ -1595,8 +1504,7 @@ yyreduce: *++yyvsp = yyval; - - /* Now `shift' the result of the reduction. Determine what state + /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1611,48 +1519,51 @@ yyreduce: goto yynewstate; -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); + yyerror (yyscanner, YY_("syntax error")); #else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; } } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } + yyerror (yyscanner, yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; } +# undef YYSYNTAX_ERROR #endif } @@ -1660,7 +1571,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -1672,12 +1583,13 @@ yyerrlab: else { yydestruct ("Error: discarding", - yytoken, &yylval); + yytoken, &yylval, yyscanner); yychar = YYEMPTY; } } - /* Else will try to reuse look-ahead token after shifting the error +#if 0 + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -1693,7 +1605,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -1706,12 +1618,13 @@ yyerrorlab: | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: +#endif yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) + if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) @@ -1728,16 +1641,15 @@ yyerrlab1: yydestruct ("Error: popping", - yystos[yystate], yyvsp); + yystos[yystate], yyvsp, yyscanner); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ @@ -1761,28 +1673,33 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: - yyerror (YY_("memory exhausted")); + yyerror (yyscanner, YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - /* Do not reclaim the symbols of the rule which action triggered + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, yyscanner); + } + /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); + yystos[*yyssp], yyvsp, yyscanner); YYPOPSTACK (1); } #ifndef yyoverflow @@ -1793,19 +1710,14 @@ yyreturn: if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - /* Make sure YYID is used. */ - return YYID (yyresult); + return yyresult; } - - -#line 242 "cmCommandArgumentParser.y" +#line 184 "cmCommandArgumentParser.y" /* yacc.c:1906 */ /* End of grammar */ /*--------------------------------------------------------------------------*/ -void cmCommandArgumentError(yyscan_t yyscanner, const char* message) +void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message) { yyGetParser->Error(message); } - - diff --git a/Source/cmCommandArgumentParser.y b/Source/cmCommandArgumentParser.y index b2f4b1b..d71b605 100644 --- a/Source/cmCommandArgumentParser.y +++ b/Source/cmCommandArgumentParser.y @@ -10,20 +10,14 @@ Run bison like this: bison --yacc --name-prefix=cmCommandArgument_yy --defines=cmCommandArgumentParserTokens.h -ocmCommandArgumentParser.cxx cmCommandArgumentParser.y Modify cmCommandArgumentParser.cxx: - - remove TABs - - remove use of the 'register' storage class specifier - - put header block at top of file + - "#if 0" out yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"] */ -#include "cmStandardIncludes.h" +#include <cmConfigure.h> // IWYU pragma: keep + +#include <string.h> -/* Configure the parser to use a lexer object. */ -#define YYPARSE_PARAM yyscanner -#define YYLEX_PARAM yyscanner -#define YYERROR_VERBOSE 1 -#define cmCommandArgument_yyerror(x) \ - cmCommandArgumentError(yyscanner, x) #define yyGetParser (cmCommandArgument_yyget_extra(yyscanner)) /* Make sure malloc and free are available on QNX. */ @@ -46,10 +40,9 @@ Modify cmCommandArgumentParser.cxx: /* Forward declare the lexer entry point. */ YY_DECL; -/* Internal utility functions. */ -static void cmCommandArgumentError(yyscan_t yyscanner, const char* message); +/* Helper function to forward error callback from parser. */ +static void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message); -#define YYDEBUG 1 /* Configure the parser to support large input. */ #define YYMAXDEPTH 100000 #define YYINITDEPTH 10000 @@ -65,7 +58,13 @@ static void cmCommandArgumentError(yyscan_t yyscanner, const char* message); %} /* Generate a reentrant parser object. */ -%pure_parser +%define api.pure + +/* Configure the parser to use a lexer object. */ +%lex-param {yyscan_t yyscanner} +%parse-param {yyscan_t yyscanner} + +%define parse.error verbose /* %union { @@ -94,137 +93,99 @@ static void cmCommandArgumentError(yyscan_t yyscanner, const char* message); Start: -GoalWithOptionalBackSlash -{ - $<str>$ = 0; - yyGetParser->SetResult($<str>1); -} + GoalWithOptionalBackSlash { + $<str>$ = 0; + yyGetParser->SetResult($<str>1); + } GoalWithOptionalBackSlash: -Goal -{ - $<str>$ = $<str>1; -} -| -Goal cal_BSLASH -{ - $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2); -} + Goal { + $<str>$ = $<str>1; + } +| Goal cal_BSLASH { + $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2); + } Goal: -{ - $<str>$ = 0; -} -| -String Goal -{ - $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2); -} + { + $<str>$ = 0; + } +| String Goal { + $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2); + } String: -OuterText -{ - $<str>$ = $<str>1; -} -| -Variable -{ - $<str>$ = $<str>1; -} + OuterText { + $<str>$ = $<str>1; + } +| Variable { + $<str>$ = $<str>1; + } OuterText: -cal_NAME -{ - $<str>$ = $<str>1; -} -| -cal_AT -{ - $<str>$ = $<str>1; -} -| -cal_DOLLAR -{ - $<str>$ = $<str>1; -} -| -cal_LCURLY -{ - $<str>$ = $<str>1; -} -| -cal_RCURLY -{ - $<str>$ = $<str>1; -} -| -cal_SYMBOL -{ - $<str>$ = $<str>1; -} + cal_NAME { + $<str>$ = $<str>1; + } +| cal_AT { + $<str>$ = $<str>1; + } +| cal_DOLLAR { + $<str>$ = $<str>1; + } +| cal_LCURLY { + $<str>$ = $<str>1; + } +| cal_RCURLY { + $<str>$ = $<str>1; + } +| cal_SYMBOL { + $<str>$ = $<str>1; + } Variable: -cal_ENVCURLY EnvVarName cal_RCURLY -{ - $<str>$ = yyGetParser->ExpandSpecialVariable($<str>1,$<str>2); - //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl; -} -| -cal_NCURLY MultipleIds cal_RCURLY -{ - $<str>$ = yyGetParser->ExpandSpecialVariable($<str>1,$<str>2); - //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl; -} -| -cal_DCURLY MultipleIds cal_RCURLY -{ - $<str>$ = yyGetParser->ExpandVariable($<str>2); - //std::cerr << __LINE__ << " here: [" << $<str>1 << "] [" << $<str>2 << "] [" << $<str>3 << "]" << std::endl; -} -| -cal_ATNAME -{ - $<str>$ = yyGetParser->ExpandVariableForAt($<str>1); -} + cal_ENVCURLY EnvVarName cal_RCURLY { + $<str>$ = yyGetParser->ExpandSpecialVariable($<str>1, $<str>2); + } +| cal_NCURLY MultipleIds cal_RCURLY { + $<str>$ = yyGetParser->ExpandSpecialVariable($<str>1, $<str>2); + } +| cal_DCURLY MultipleIds cal_RCURLY { + $<str>$ = yyGetParser->ExpandVariable($<str>2); + } +| cal_ATNAME { + $<str>$ = yyGetParser->ExpandVariableForAt($<str>1); + } EnvVarName: -MultipleIds -{ - $<str>$ = $<str>1; -} -| -cal_SYMBOL EnvVarName -{ - $<str>$ = $<str>1; -} + MultipleIds { + $<str>$ = $<str>1; + } +| cal_SYMBOL EnvVarName { + $<str>$ = $<str>1; + } MultipleIds: -{ - $<str>$ = 0; -} -| -ID MultipleIds -{ - $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2); -} + { + $<str>$ = 0; + } +| ID MultipleIds { + $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2); + } ID: -cal_NAME -{ - $<str>$ = $<str>1; -} -| -Variable -{ - $<str>$ = $<str>1; -} - + cal_NAME { + $<str>$ = $<str>1; + } +| Variable { + $<str>$ = $<str>1; + } +; %% /* End of grammar */ /*--------------------------------------------------------------------------*/ -void cmCommandArgumentError(yyscan_t yyscanner, const char* message) +void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message) { yyGetParser->Error(message); } diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 2d66344..1222d5a 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -2,8 +2,6 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmCommandArgumentParserHelper.h" -#include <cm_kwiml.h> - #include "cmCommandArgumentLexer.h" #include "cmMakefile.h" #include "cmState.h" diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index 95bf0ad..5bfb236 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -8,27 +8,15 @@ #include <string> #include <vector> -#define YYSTYPE cmCommandArgumentParserHelper::ParserType -#define YYSTYPE_IS_DECLARED -#define YY_EXTRA_TYPE cmCommandArgumentParserHelper* -#define YY_DECL \ - int cmCommandArgument_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner) - -/** \class cmCommandArgumentParserHelper - * \brief Helper class for parsing java source files - * - * Finds dependencies for java file and list of outputs - */ - class cmMakefile; class cmCommandArgumentParserHelper { public: - typedef struct + struct ParserType { char* str; - } ParserType; + }; cmCommandArgumentParserHelper(); ~cmCommandArgumentParserHelper(); @@ -100,4 +88,10 @@ private: bool RemoveEmpty; }; +#define YYSTYPE cmCommandArgumentParserHelper::ParserType +#define YYSTYPE_IS_DECLARED +#define YY_EXTRA_TYPE cmCommandArgumentParserHelper* +#define YY_DECL \ + int cmCommandArgument_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner) + #endif diff --git a/Source/cmCommandArgumentParserTokens.h b/Source/cmCommandArgumentParserTokens.h index d162b82..3172182 100644 --- a/Source/cmCommandArgumentParserTokens.h +++ b/Source/cmCommandArgumentParserTokens.h @@ -1,16 +1,13 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -/* A Bison parser, made by GNU Bison 2.3. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -18,9 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -35,25 +30,34 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -/* Tokens. */ +#ifndef YY_CMCOMMANDARGUMENT_YY_CMCOMMANDARGUMENTPARSERTOKENS_H_INCLUDED +# define YY_CMCOMMANDARGUMENT_YY_CMCOMMANDARGUMENTPARSERTOKENS_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int cmCommandArgument_yydebug; +#endif + +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - cal_ENVCURLY = 258, - cal_NCURLY = 259, - cal_DCURLY = 260, - cal_DOLLAR = 261, - cal_LCURLY = 262, - cal_RCURLY = 263, - cal_NAME = 264, - cal_BSLASH = 265, - cal_SYMBOL = 266, - cal_AT = 267, - cal_ERROR = 268, - cal_ATNAME = 269 - }; + enum yytokentype + { + cal_ENVCURLY = 258, + cal_NCURLY = 259, + cal_DCURLY = 260, + cal_DOLLAR = 261, + cal_LCURLY = 262, + cal_RCURLY = 263, + cal_NAME = 264, + cal_BSLASH = 265, + cal_SYMBOL = 266, + cal_AT = 267, + cal_ERROR = 268, + cal_ATNAME = 269 + }; #endif /* Tokens. */ #define cal_ENVCURLY 258 @@ -69,15 +73,10 @@ #define cal_ERROR 268 #define cal_ATNAME 269 +/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef int YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 -#endif - - +int cmCommandArgument_yyparse (yyscan_t yyscanner); +#endif /* !YY_CMCOMMANDARGUMENT_YY_CMCOMMANDARGUMENTPARSERTOKENS_H_INCLUDED */ diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index 4c5b093..1576722 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -1,6 +1,8 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmCommands.h" +#include "cmPolicies.h" +#include "cmState.h" #include "cmAddCustomCommandCommand.h" #include "cmAddCustomTargetCommand.h" @@ -77,6 +79,7 @@ #include "cmAuxSourceDirectoryCommand.h" #include "cmBuildNameCommand.h" #include "cmCMakeHostSystemInformationCommand.h" +#include "cmDisallowedCommand.h" #include "cmExportCommand.h" #include "cmExportLibraryDependenciesCommand.h" #include "cmFLTKWrapUICommand.h" @@ -104,138 +107,162 @@ #include "cmWriteFileCommand.h" #endif -std::vector<cmCommand*> GetPredefinedCommands() +void GetScriptingCommands(cmState* state) { - std::vector<cmCommand*> commands; + state->AddCommand(new cmBreakCommand); + state->AddCommand(new cmCMakeMinimumRequired); + state->AddCommand(new cmCMakePolicyCommand); + state->AddCommand(new cmConfigureFileCommand); + state->AddCommand(new cmContinueCommand); + state->AddCommand(new cmExecProgramCommand); + state->AddCommand(new cmExecuteProcessCommand); + state->AddCommand(new cmFileCommand); + state->AddCommand(new cmFindFileCommand); + state->AddCommand(new cmFindLibraryCommand); + state->AddCommand(new cmFindPackageCommand); + state->AddCommand(new cmFindPathCommand); + state->AddCommand(new cmFindProgramCommand); + state->AddCommand(new cmForEachCommand); + state->AddCommand(new cmFunctionCommand); + state->AddCommand(new cmGetCMakePropertyCommand); + state->AddCommand(new cmGetDirectoryPropertyCommand); + state->AddCommand(new cmGetFilenameComponentCommand); + state->AddCommand(new cmGetPropertyCommand); + state->AddCommand(new cmIfCommand); + state->AddCommand(new cmIncludeCommand); + state->AddCommand(new cmListCommand); + state->AddCommand(new cmMacroCommand); + state->AddCommand(new cmMakeDirectoryCommand); + state->AddCommand(new cmMarkAsAdvancedCommand); + state->AddCommand(new cmMathCommand); + state->AddCommand(new cmMessageCommand); + state->AddCommand(new cmOptionCommand); + state->AddCommand(new cmParseArgumentsCommand); + state->AddCommand(new cmReturnCommand); + state->AddCommand(new cmSeparateArgumentsCommand); + state->AddCommand(new cmSetCommand); + state->AddCommand(new cmSetDirectoryPropertiesCommand); + state->AddCommand(new cmSetPropertyCommand); + state->AddCommand(new cmSiteNameCommand); + state->AddCommand(new cmStringCommand); + state->AddCommand(new cmUnsetCommand); + state->AddCommand(new cmWhileCommand); - commands.push_back(new cmAddCustomCommandCommand); - commands.push_back(new cmAddCustomTargetCommand); - commands.push_back(new cmAddDefinitionsCommand); - commands.push_back(new cmAddDependenciesCommand); - commands.push_back(new cmAddExecutableCommand); - commands.push_back(new cmAddLibraryCommand); - commands.push_back(new cmAddSubDirectoryCommand); - commands.push_back(new cmAddTestCommand); - commands.push_back(new cmBreakCommand); - commands.push_back(new cmBuildCommand); - commands.push_back(new cmCMakeMinimumRequired); - commands.push_back(new cmCMakePolicyCommand); - commands.push_back(new cmConfigureFileCommand); - commands.push_back(new cmContinueCommand); - commands.push_back(new cmCreateTestSourceList); - commands.push_back(new cmDefinePropertyCommand); - commands.push_back(new cmEnableLanguageCommand); - commands.push_back(new cmEnableTestingCommand); - commands.push_back(new cmExecProgramCommand); - commands.push_back(new cmExecuteProcessCommand); - commands.push_back(new cmFileCommand); - commands.push_back(new cmFindFileCommand); - commands.push_back(new cmFindLibraryCommand); - commands.push_back(new cmFindPackageCommand); - commands.push_back(new cmFindPathCommand); - commands.push_back(new cmFindProgramCommand); - commands.push_back(new cmForEachCommand); - commands.push_back(new cmFunctionCommand); - commands.push_back(new cmGetCMakePropertyCommand); - commands.push_back(new cmGetDirectoryPropertyCommand); - commands.push_back(new cmGetFilenameComponentCommand); - commands.push_back(new cmGetPropertyCommand); - commands.push_back(new cmGetSourceFilePropertyCommand); - commands.push_back(new cmGetTargetPropertyCommand); - commands.push_back(new cmGetTestPropertyCommand); - commands.push_back(new cmIfCommand); - commands.push_back(new cmIncludeCommand); - commands.push_back(new cmIncludeDirectoryCommand); - commands.push_back(new cmIncludeRegularExpressionCommand); - commands.push_back(new cmInstallCommand); - commands.push_back(new cmInstallFilesCommand); - commands.push_back(new cmInstallTargetsCommand); - commands.push_back(new cmLinkDirectoriesCommand); - commands.push_back(new cmListCommand); - commands.push_back(new cmMacroCommand); - commands.push_back(new cmMakeDirectoryCommand); - commands.push_back(new cmMarkAsAdvancedCommand); - commands.push_back(new cmMathCommand); - commands.push_back(new cmMessageCommand); - commands.push_back(new cmOptionCommand); - commands.push_back(new cmParseArgumentsCommand); - commands.push_back(new cmProjectCommand); - commands.push_back(new cmReturnCommand); - commands.push_back(new cmSeparateArgumentsCommand); - commands.push_back(new cmSetCommand); - commands.push_back(new cmSetDirectoryPropertiesCommand); - commands.push_back(new cmSetPropertyCommand); - commands.push_back(new cmSetSourceFilesPropertiesCommand); - commands.push_back(new cmSetTargetPropertiesCommand); - commands.push_back(new cmSetTestsPropertiesCommand); - commands.push_back(new cmSiteNameCommand); - commands.push_back(new cmStringCommand); - commands.push_back(new cmSubdirCommand); - commands.push_back(new cmTargetLinkLibrariesCommand); - commands.push_back(new cmTryCompileCommand); - commands.push_back(new cmTryRunCommand); - commands.push_back(new cmUnsetCommand); - commands.push_back(new cmWhileCommand); - - commands.push_back(new cmUnexpectedCommand( + state->AddCommand(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( + state->AddCommand(new cmUnexpectedCommand( "elseif", "An ELSEIF command was found outside of a proper " "IF ENDIF structure.")); - commands.push_back(new cmUnexpectedCommand( + state->AddCommand(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( + state->AddCommand(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( + state->AddCommand(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( + state->AddCommand(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( + state->AddCommand(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 cmExportCommand); - commands.push_back(new cmExportLibraryDependenciesCommand); - commands.push_back(new cmFLTKWrapUICommand); - commands.push_back(new cmIncludeExternalMSProjectCommand); - commands.push_back(new cmInstallProgramsCommand); - commands.push_back(new cmLinkLibrariesCommand); - commands.push_back(new cmLoadCacheCommand); - commands.push_back(new cmLoadCommandCommand); - commands.push_back(new cmOutputRequiredFilesCommand); - commands.push_back(new cmQTWrapCPPCommand); - commands.push_back(new cmQTWrapUICommand); - commands.push_back(new cmRemoveCommand); - commands.push_back(new cmRemoveDefinitionsCommand); - commands.push_back(new cmSourceGroupCommand); - commands.push_back(new cmSubdirDependsCommand); - commands.push_back(new cmTargetCompileDefinitionsCommand); - commands.push_back(new cmTargetCompileFeaturesCommand); - commands.push_back(new cmTargetCompileOptionsCommand); - commands.push_back(new cmTargetIncludeDirectoriesCommand); - commands.push_back(new cmTargetSourcesCommand); - commands.push_back(new cmUseMangledMesaCommand); - commands.push_back(new cmUtilitySourceCommand); - commands.push_back(new cmVariableRequiresCommand); - commands.push_back(new cmVariableWatchCommand); - commands.push_back(new cmWriteFileCommand); + state->AddCommand(new cmCMakeHostSystemInformationCommand); + state->AddCommand(new cmRemoveCommand); + state->AddCommand(new cmVariableWatchCommand); + state->AddCommand(new cmWriteFileCommand); + + state->AddCommand(new cmDisallowedCommand( + new cmBuildNameCommand, cmPolicies::CMP0036, + "The build_name command should not be called; see CMP0036.")); + state->AddCommand(new cmDisallowedCommand( + new cmUseMangledMesaCommand, cmPolicies::CMP0030, + "The use_mangled_mesa command should not be called; see CMP0030.")); + #endif +} - return commands; +void GetProjectCommands(cmState* state) +{ + state->AddCommand(new cmAddCustomCommandCommand); + state->AddCommand(new cmAddCustomTargetCommand); + state->AddCommand(new cmAddDefinitionsCommand); + state->AddCommand(new cmAddDependenciesCommand); + state->AddCommand(new cmAddExecutableCommand); + state->AddCommand(new cmAddLibraryCommand); + state->AddCommand(new cmAddSubDirectoryCommand); + state->AddCommand(new cmAddTestCommand); + state->AddCommand(new cmBuildCommand); + state->AddCommand(new cmCreateTestSourceList); + state->AddCommand(new cmDefinePropertyCommand); + state->AddCommand(new cmEnableLanguageCommand); + state->AddCommand(new cmEnableTestingCommand); + state->AddCommand(new cmGetSourceFilePropertyCommand); + state->AddCommand(new cmGetTargetPropertyCommand); + state->AddCommand(new cmGetTestPropertyCommand); + state->AddCommand(new cmIncludeDirectoryCommand); + state->AddCommand(new cmIncludeRegularExpressionCommand); + state->AddCommand(new cmInstallCommand); + state->AddCommand(new cmInstallFilesCommand); + state->AddCommand(new cmInstallTargetsCommand); + state->AddCommand(new cmLinkDirectoriesCommand); + state->AddCommand(new cmProjectCommand); + state->AddCommand(new cmSetSourceFilesPropertiesCommand); + state->AddCommand(new cmSetTargetPropertiesCommand); + state->AddCommand(new cmSetTestsPropertiesCommand); + state->AddCommand(new cmSubdirCommand); + state->AddCommand(new cmTargetLinkLibrariesCommand); + state->AddCommand(new cmTryCompileCommand); + state->AddCommand(new cmTryRunCommand); + +#if defined(CMAKE_BUILD_WITH_CMAKE) + state->AddCommand(new cmAddCompileOptionsCommand); + state->AddCommand(new cmAuxSourceDirectoryCommand); + state->AddCommand(new cmExportCommand); + state->AddCommand(new cmFLTKWrapUICommand); + state->AddCommand(new cmIncludeExternalMSProjectCommand); + state->AddCommand(new cmInstallProgramsCommand); + state->AddCommand(new cmLinkLibrariesCommand); + state->AddCommand(new cmLoadCacheCommand); + state->AddCommand(new cmQTWrapCPPCommand); + state->AddCommand(new cmQTWrapUICommand); + state->AddCommand(new cmRemoveDefinitionsCommand); + state->AddCommand(new cmSourceGroupCommand); + state->AddCommand(new cmTargetCompileDefinitionsCommand); + state->AddCommand(new cmTargetCompileFeaturesCommand); + state->AddCommand(new cmTargetCompileOptionsCommand); + state->AddCommand(new cmTargetIncludeDirectoriesCommand); + state->AddCommand(new cmTargetSourcesCommand); + + state->AddCommand(new cmDisallowedCommand( + new cmExportLibraryDependenciesCommand, cmPolicies::CMP0033, + "The export_library_dependencies command should not be called; " + "see CMP0033.")); + state->AddCommand(new cmDisallowedCommand( + new cmLoadCommandCommand, cmPolicies::CMP0031, + "The load_command command should not be called; see CMP0031.")); + state->AddCommand(new cmDisallowedCommand( + new cmOutputRequiredFilesCommand, cmPolicies::CMP0032, + "The output_required_files command should not be called; " + "see CMP0032.")); + state->AddCommand(new cmDisallowedCommand( + new cmSubdirDependsCommand, cmPolicies::CMP0029, + "The subdir_depends command should not be called; see CMP0029.")); + state->AddCommand(new cmDisallowedCommand( + new cmUtilitySourceCommand, cmPolicies::CMP0034, + "The utility_source command should not be called; see CMP0034.")); + state->AddCommand(new cmDisallowedCommand( + new cmVariableRequiresCommand, cmPolicies::CMP0035, + "The variable_requires command should not be called; see CMP0035.")); +#endif } diff --git a/Source/cmCommands.h b/Source/cmCommands.h index 649dea6..7895ece 100644 --- a/Source/cmCommands.h +++ b/Source/cmCommands.h @@ -3,16 +3,14 @@ #ifndef cmCommands_h #define cmCommands_h -#include <cmConfigure.h> // IWYU pragma: keep +class cmState; -#include <vector> - -class cmCommand; /** - * Global function to return all compiled in commands. + * Global function to register all compiled in commands. * To add a new command edit cmCommands.cxx and add your command. * It is up to the caller to delete the commands created by this call. */ -std::vector<cmCommand*> GetPredefinedCommands(); +void GetScriptingCommands(cmState* state); +void GetProjectCommands(cmState* state); #endif diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 239582f..fe2c0fe 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -26,7 +26,6 @@ cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt) , GlobalGenerator(static_cast<cmGlobalCommonGenerator*>( gt->LocalGenerator->GetGlobalGenerator())) , ConfigName(LocalGenerator->GetConfigName()) - , ModuleDefinitionFile(GeneratorTarget->GetModuleDefinitionFile(ConfigName)) { } @@ -44,18 +43,13 @@ const char* cmCommonTargetGenerator::GetFeature(const std::string& feature) return this->GeneratorTarget->GetFeature(feature, this->ConfigName); } -bool cmCommonTargetGenerator::GetFeatureAsBool(const std::string& feature) -{ - return this->GeneratorTarget->GetFeatureAsBool(feature, this->ConfigName); -} - void cmCommonTargetGenerator::AddFeatureFlags(std::string& flags, const std::string& lang) { // Add language-specific flags. this->LocalGenerator->AddLanguageFlags(flags, lang, this->ConfigName); - if (this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION")) { + if (this->GeneratorTarget->IsIPOEnabled(this->ConfigName)) { this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO"); } } @@ -63,14 +57,9 @@ void cmCommonTargetGenerator::AddFeatureFlags(std::string& flags, void cmCommonTargetGenerator::AddModuleDefinitionFlag( cmLinkLineComputer* linkLineComputer, std::string& flags) { - // A module definition file only makes sense on certain target types. - if (this->GeneratorTarget->GetType() != cmStateEnums::SHARED_LIBRARY && - this->GeneratorTarget->GetType() != cmStateEnums::MODULE_LIBRARY && - this->GeneratorTarget->GetType() != cmStateEnums::EXECUTABLE) { - return; - } - - if (!this->ModuleDefinitionFile) { + cmGeneratorTarget::ModuleDefinitionInfo const* mdi = + this->GeneratorTarget->GetModuleDefinitionInfo(this->GetConfigName()); + if (!mdi || mdi->DefFile.empty()) { return; } @@ -85,8 +74,7 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag( // vs6's "cl -link" pass it to the linker. std::string flag = defFileFlag; flag += this->LocalGenerator->ConvertToOutputFormat( - linkLineComputer->ConvertToLinkReference( - this->ModuleDefinitionFile->GetFullPath()), + linkLineComputer->ConvertToLinkReference(mdi->DefFile), cmOutputConverter::SHELL); this->LocalGenerator->AppendFlags(flags, flag); } diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index d67fefb..425ff91 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -32,7 +32,6 @@ protected: // Feature query methods. const char* GetFeature(const std::string& feature); - bool GetFeatureAsBool(const std::string& feature); // Helper to add flag for windows .def file. void AddModuleDefinitionFlag(cmLinkLineComputer* linkLineComputer, @@ -44,9 +43,6 @@ protected: cmGlobalCommonGenerator* GlobalGenerator; std::string ConfigName; - // The windows module definition source file (.def), if any. - cmSourceFile const* ModuleDefinitionFile; - void AppendFortranFormatFlags(std::string& flags, cmSourceFile const& source); diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index 26f1df2..5f89ba1 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -3,7 +3,7 @@ #ifndef cmConfigure_h #define cmConfigure_h -#include <cmsys/Configure.hxx> // IWYU pragma: keep +#include <cmsys/Configure.hxx> // IWYU pragma: export #ifdef _MSC_VER #pragma warning(disable : 4786) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index ff9ffc0..fd9d04b 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -8,6 +8,7 @@ #include <sstream> #include <stdio.h> #include <string.h> +#include <utility> #include "cmAlgorithms.h" #include "cmExportTryCompileFileGenerator.h" diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index c189419..b8c76b9 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -7,6 +7,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmSystemTools.h" +#include "cmWorkingDirectory.h" #include <cmsys/FStream.hxx> #include <sstream> @@ -75,13 +76,7 @@ bool cmDepends::Check(const char* makeFile, const char* internalFile, std::map<std::string, DependencyVector>& validDeps) { // Dependency checks must be done in proper working directory. - std::string oldcwd = "."; - if (this->CompileDirectory != ".") { - // Get the CWD but do not call CollapseFullPath because - // we only need it to cd back, and the form does not matter - oldcwd = cmSystemTools::GetCurrentWorkingDirectory(false); - cmSystemTools::ChangeDirectory(this->CompileDirectory); - } + cmWorkingDirectory workdir(this->CompileDirectory); // Check whether dependencies must be regenerated. bool okay = true; @@ -93,11 +88,6 @@ bool cmDepends::Check(const char* makeFile, const char* internalFile, okay = false; } - // Restore working directory. - if (oldcwd != ".") { - cmSystemTools::ChangeDirectory(oldcwd); - } - return okay; } diff --git a/Source/cmDependsJavaParser.cxx b/Source/cmDependsJavaParser.cxx index b99d631..b09bd0c 100644 --- a/Source/cmDependsJavaParser.cxx +++ b/Source/cmDependsJavaParser.cxx @@ -1,12 +1,13 @@ -/* A Bison parser, made by GNU Bison 1.875d. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ -/* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, - 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +/* Bison implementation for Yacc-like parsers in C - This program is free software; you can redistribute it and/or modify + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -14,17 +15,23 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ -/* Written by Richard Stallman by simplifying the original so called - ``semantic'' parser. */ +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local @@ -33,145 +40,223 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ -/* turn off some warning as this is generated code */ -#if defined(_MSC_VER) -# pragma warning ( disable : 4702 ) /* unreachable code */ -#endif - /* Identify Bison output. */ #define YYBISON 1 +/* Bison version. */ +#define YYBISON_VERSION "3.0.4" + /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 1 -/* Using locations. */ -#define YYLSP_NEEDED 0 +/* Push parsers. */ +#define YYPUSH 0 -/* If NAME_PREFIX is specified substitute the variables and functions - names. */ -#define yyparse cmDependsJava_yyparse -#define yylex cmDependsJava_yylex -#define yyerror cmDependsJava_yyerror -#define yylval cmDependsJava_yylval -#define yychar cmDependsJava_yychar -#define yydebug cmDependsJava_yydebug -#define yynerrs cmDependsJava_yynerrs +/* Pull parsers. */ +#define YYPULL 1 -/* Tokens. */ +/* Substitute the variable and function names. */ +#define yyparse cmDependsJava_yyparse +#define yylex cmDependsJava_yylex +#define yyerror cmDependsJava_yyerror +#define yydebug cmDependsJava_yydebug +#define yynerrs cmDependsJava_yynerrs + + +/* Copy the first part of user declarations. */ +#line 1 "cmDependsJavaParser.y" /* yacc.c:339 */ + +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +/* + +This file must be translated to C and modified to build everywhere. + +Run bison like this: + + bison --yacc --name-prefix=cmDependsJava_yy --defines=cmDependsJavaParserTokens.h -ocmDependsJavaParser.cxx cmDependsJavaParser.y + +Modify cmDependsJavaParser.cxx: + - "#if 0" out yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"] + +*/ + +#include <cmConfigure.h> // IWYU pragma: keep + +#include <stdlib.h> +#include <string.h> +#include <string> + +#define yyGetParser (cmDependsJava_yyget_extra(yyscanner)) + +/*-------------------------------------------------------------------------*/ +#include "cmDependsJavaParserHelper.h" /* Interface to parser object. */ +#include "cmDependsJavaLexer.h" /* Interface to lexer object. */ +#include "cmDependsJavaParserTokens.h" /* Need YYSTYPE for YY_DECL. */ + +/* Forward declare the lexer entry point. */ +YY_DECL; + +/* Helper function to forward error callback from parser. */ +static void cmDependsJava_yyerror(yyscan_t yyscanner, const char* message); + +#define YYMAXDEPTH 1000000 + + +#define jpCheckEmpty(cnt) yyGetParser->CheckEmpty(__LINE__, cnt, yyvsp); +#define jpElementStart(cnt) yyGetParser->PrepareElement(&yyval) +#define jpStoreClass(str) yyGetParser->AddClassFound(str); yyGetParser->DeallocateParserType(&(str)) +/* Disable some warnings in the generated code. */ +#ifdef _MSC_VER +# pragma warning (disable: 4102) /* Unused goto label. */ +# pragma warning (disable: 4065) /* Switch statement contains default but no case. */ +#endif + +#line 120 "cmDependsJavaParser.cxx" /* yacc.c:339 */ + +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 1 +#endif + +/* In a future release of Bison, this section will be replaced + by #include "cmDependsJavaParserTokens.h". */ +#ifndef YY_CMDEPENDSJAVA_YY_CMDEPENDSJAVAPARSERTOKENS_H_INCLUDED +# define YY_CMDEPENDSJAVA_YY_CMDEPENDSJAVAPARSERTOKENS_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int cmDependsJava_yydebug; +#endif + +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - jp_ABSTRACT = 258, - jp_ASSERT = 259, - jp_BOOLEAN_TYPE = 260, - jp_BREAK = 261, - jp_BYTE_TYPE = 262, - jp_CASE = 263, - jp_CATCH = 264, - jp_CHAR_TYPE = 265, - jp_CLASS = 266, - jp_CONTINUE = 267, - jp_DEFAULT = 268, - jp_DO = 269, - jp_DOUBLE_TYPE = 270, - jp_ELSE = 271, - jp_EXTENDS = 272, - jp_FINAL = 273, - jp_FINALLY = 274, - jp_FLOAT_TYPE = 275, - jp_FOR = 276, - jp_IF = 277, - jp_IMPLEMENTS = 278, - jp_IMPORT = 279, - jp_INSTANCEOF = 280, - jp_INT_TYPE = 281, - jp_INTERFACE = 282, - jp_LONG_TYPE = 283, - jp_NATIVE = 284, - jp_NEW = 285, - jp_PACKAGE = 286, - jp_PRIVATE = 287, - jp_PROTECTED = 288, - jp_PUBLIC = 289, - jp_RETURN = 290, - jp_SHORT_TYPE = 291, - jp_STATIC = 292, - jp_STRICTFP = 293, - jp_SUPER = 294, - jp_SWITCH = 295, - jp_SYNCHRONIZED = 296, - jp_THIS = 297, - jp_THROW = 298, - jp_THROWS = 299, - jp_TRANSIENT = 300, - jp_TRY = 301, - jp_VOID = 302, - jp_VOLATILE = 303, - jp_WHILE = 304, - jp_BOOLEANLITERAL = 305, - jp_CHARACTERLITERAL = 306, - jp_DECIMALINTEGERLITERAL = 307, - jp_FLOATINGPOINTLITERAL = 308, - jp_HEXINTEGERLITERAL = 309, - jp_NULLLITERAL = 310, - jp_STRINGLITERAL = 311, - jp_NAME = 312, - jp_AND = 313, - jp_ANDAND = 314, - jp_ANDEQUALS = 315, - jp_BRACKETEND = 316, - jp_BRACKETSTART = 317, - jp_CARROT = 318, - jp_CARROTEQUALS = 319, - jp_COLON = 320, - jp_COMMA = 321, - jp_CURLYEND = 322, - jp_CURLYSTART = 323, - jp_DIVIDE = 324, - jp_DIVIDEEQUALS = 325, - jp_DOLLAR = 326, - jp_DOT = 327, - jp_EQUALS = 328, - jp_EQUALSEQUALS = 329, - jp_EXCLAMATION = 330, - jp_EXCLAMATIONEQUALS = 331, - jp_GREATER = 332, - jp_GTEQUALS = 333, - jp_GTGT = 334, - jp_GTGTEQUALS = 335, - jp_GTGTGT = 336, - jp_GTGTGTEQUALS = 337, - jp_LESLESEQUALS = 338, - jp_LESSTHAN = 339, - jp_LTEQUALS = 340, - jp_LTLT = 341, - jp_MINUS = 342, - jp_MINUSEQUALS = 343, - jp_MINUSMINUS = 344, - jp_PAREEND = 345, - jp_PARESTART = 346, - jp_PERCENT = 347, - jp_PERCENTEQUALS = 348, - jp_PIPE = 349, - jp_PIPEEQUALS = 350, - jp_PIPEPIPE = 351, - jp_PLUS = 352, - jp_PLUSEQUALS = 353, - jp_PLUSPLUS = 354, - jp_QUESTION = 355, - jp_SEMICOL = 356, - jp_TILDE = 357, - jp_TIMES = 358, - jp_TIMESEQUALS = 359, - jp_ERROR = 360 - }; + enum yytokentype + { + jp_ABSTRACT = 258, + jp_ASSERT = 259, + jp_BOOLEAN_TYPE = 260, + jp_BREAK = 261, + jp_BYTE_TYPE = 262, + jp_CASE = 263, + jp_CATCH = 264, + jp_CHAR_TYPE = 265, + jp_CLASS = 266, + jp_CONTINUE = 267, + jp_DEFAULT = 268, + jp_DO = 269, + jp_DOUBLE_TYPE = 270, + jp_ELSE = 271, + jp_EXTENDS = 272, + jp_FINAL = 273, + jp_FINALLY = 274, + jp_FLOAT_TYPE = 275, + jp_FOR = 276, + jp_IF = 277, + jp_IMPLEMENTS = 278, + jp_IMPORT = 279, + jp_INSTANCEOF = 280, + jp_INT_TYPE = 281, + jp_INTERFACE = 282, + jp_LONG_TYPE = 283, + jp_NATIVE = 284, + jp_NEW = 285, + jp_PACKAGE = 286, + jp_PRIVATE = 287, + jp_PROTECTED = 288, + jp_PUBLIC = 289, + jp_RETURN = 290, + jp_SHORT_TYPE = 291, + jp_STATIC = 292, + jp_STRICTFP = 293, + jp_SUPER = 294, + jp_SWITCH = 295, + jp_SYNCHRONIZED = 296, + jp_THIS = 297, + jp_THROW = 298, + jp_THROWS = 299, + jp_TRANSIENT = 300, + jp_TRY = 301, + jp_VOID = 302, + jp_VOLATILE = 303, + jp_WHILE = 304, + jp_BOOLEANLITERAL = 305, + jp_CHARACTERLITERAL = 306, + jp_DECIMALINTEGERLITERAL = 307, + jp_FLOATINGPOINTLITERAL = 308, + jp_HEXINTEGERLITERAL = 309, + jp_NULLLITERAL = 310, + jp_STRINGLITERAL = 311, + jp_NAME = 312, + jp_AND = 313, + jp_ANDAND = 314, + jp_ANDEQUALS = 315, + jp_BRACKETEND = 316, + jp_BRACKETSTART = 317, + jp_CARROT = 318, + jp_CARROTEQUALS = 319, + jp_COLON = 320, + jp_COMMA = 321, + jp_CURLYEND = 322, + jp_CURLYSTART = 323, + jp_DIVIDE = 324, + jp_DIVIDEEQUALS = 325, + jp_DOLLAR = 326, + jp_DOT = 327, + jp_EQUALS = 328, + jp_EQUALSEQUALS = 329, + jp_EXCLAMATION = 330, + jp_EXCLAMATIONEQUALS = 331, + jp_GREATER = 332, + jp_GTEQUALS = 333, + jp_GTGT = 334, + jp_GTGTEQUALS = 335, + jp_GTGTGT = 336, + jp_GTGTGTEQUALS = 337, + jp_LESLESEQUALS = 338, + jp_LESSTHAN = 339, + jp_LTEQUALS = 340, + jp_LTLT = 341, + jp_MINUS = 342, + jp_MINUSEQUALS = 343, + jp_MINUSMINUS = 344, + jp_PAREEND = 345, + jp_PARESTART = 346, + jp_PERCENT = 347, + jp_PERCENTEQUALS = 348, + jp_PIPE = 349, + jp_PIPEEQUALS = 350, + jp_PIPEPIPE = 351, + jp_PLUS = 352, + jp_PLUSEQUALS = 353, + jp_PLUSPLUS = 354, + jp_QUESTION = 355, + jp_SEMICOL = 356, + jp_TILDE = 357, + jp_TIMES = 358, + jp_TIMESEQUALS = 359, + jp_ERROR = 360 + }; #endif +/* Tokens. */ #define jp_ABSTRACT 258 #define jp_ASSERT 259 #define jp_BOOLEAN_TYPE 260 @@ -276,141 +361,205 @@ #define jp_TIMESEQUALS 359 #define jp_ERROR 360 +/* Value type. */ -/* Copy the first part of user declarations. */ -#line 1 "cmDependsJavaParser.y" +int cmDependsJava_yyparse (yyscan_t yyscanner); -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -/* +#endif /* !YY_CMDEPENDSJAVA_YY_CMDEPENDSJAVAPARSERTOKENS_H_INCLUDED */ -This file must be translated to C and modified to build everywhere. +/* Copy the second part of user declarations. */ -Run bison like this: +#line 375 "cmDependsJavaParser.cxx" /* yacc.c:358 */ - bison --yacc --name-prefix=cmDependsJava_yy - --defines=cmDependsJavaParserTokens.h -ocmDependsJavaParser.cxx - cmDependsJavaParser.y +#ifdef short +# undef short +#endif -Modify cmDependsJavaParser.c: - - remove TABs +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif -*/ +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#else +typedef signed char yytype_int8; +#endif -/* Configure the parser to use a lexer object. */ -#define YYPARSE_PARAM yyscanner -#define YYLEX_PARAM yyscanner -#define YYERROR_VERBOSE 1 -#define cmDependsJava_yyerror(x) \ - cmDependsJavaError(yyscanner, x) -#define yyGetParser (cmDependsJava_yyget_extra(yyscanner)) +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif -/*-------------------------------------------------------------------------*/ -#include "cmDependsJavaParserHelper.h" /* Interface to parser object. */ -#include "cmDependsJavaLexer.h" /* Interface to lexer object. */ -#include "cmDependsJavaParserTokens.h" /* Need YYSTYPE for YY_DECL. */ +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif -/* Forward declare the lexer entry point. */ -YY_DECL; +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif -/* Internal utility functions. */ -static void cmDependsJavaError(yyscan_t yyscanner, const char* message); +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) -#define YYDEBUG 1 -#define YYMAXDEPTH 1000000 +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif -#define jpCheckEmpty(cnt) yyGetParser->CheckEmpty(__LINE__, cnt, yyvsp); -#define jpElementStart(cnt) yyGetParser->PrepareElement(&yyval) -#define jpStoreClass(str) \ -yyGetParser->AddClassFound(str); yyGetParser->DeallocateParserType(&(str)) -/* Disable some warnings in the generated code. */ -#ifdef _MSC_VER -# pragma warning (disable: 4102) /* Unused goto label. */ -# pragma warning (disable: 4065) /* Switch statement contains default but - no case. */ +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) #endif +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif #endif -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) #else -# define YYERROR_VERBOSE 0 +# define YYUSE(E) /* empty */ #endif -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -typedef int YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif - -/* Copy the second part of user declarations. */ - - -/* Line 214 of yacc.c. */ -#line 372 "cmDependsJavaParser.cxx" - -#if ! defined (yyoverflow) || YYERROR_VERBOSE - -# ifndef YYFREE -# define YYFREE free -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# endif +#if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# endif -# else -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca -# else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif # endif # endif # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ + /* Pacify GCC's 'empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# else -# if defined (__STDC__) || defined (__cplusplus) -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif +# else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined EXIT_SUCCESS +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined EXIT_SUCCESS +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif # endif -#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ -#if (! defined (yyoverflow) \ - && (! defined (__cplusplus) \ - || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - short int yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -418,74 +567,74 @@ union yyalloc /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined (__GNUC__) && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (0) -# endif -# endif +# define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ while (0) #endif -#if defined (__STDC__) || defined (__cplusplus) - typedef signed char yysigned_char; -#else - typedef short int yysigned_char; -#endif +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ -/* YYFINAL -- State number of the termination state. */ +/* YYFINAL -- State number of the termination state. */ #define YYFINAL 23 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 2215 -/* YYNTOKENS -- Number of terminals. */ +/* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 106 -/* YYNNTS -- Number of nonterminals. */ +/* YYNNTS -- Number of nonterminals. */ #define YYNNTS 158 -/* YYNRULES -- Number of rules. */ +/* YYNRULES -- Number of rules. */ #define YYNRULES 351 -/* YYNRULES -- Number of states. */ +/* YYNSTATES -- Number of states. */ #define YYNSTATES 575 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 360 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const unsigned char yytranslate[] = +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -527,201 +676,51 @@ static const unsigned char yytranslate[] = }; #if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const unsigned short int yyprhs[] = + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = { - 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, - 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, - 39, 41, 43, 45, 47, 49, 51, 54, 57, 59, - 61, 63, 65, 68, 72, 76, 80, 84, 86, 88, - 92, 93, 95, 96, 99, 100, 103, 107, 109, 111, - 115, 121, 123, 125, 127, 129, 132, 134, 136, 138, - 140, 142, 144, 146, 148, 150, 152, 154, 158, 161, - 165, 169, 174, 175, 177, 180, 183, 185, 189, 193, - 194, 197, 199, 201, 203, 205, 207, 209, 214, 216, - 220, 222, 226, 228, 232, 234, 236, 239, 242, 246, - 251, 256, 257, 259, 264, 268, 269, 271, 273, 277, - 281, 284, 286, 290, 292, 295, 300, 306, 311, 316, - 317, 320, 326, 332, 336, 340, 341, 343, 346, 350, - 354, 355, 358, 360, 362, 364, 367, 369, 372, 374, - 377, 379, 382, 386, 387, 389, 392, 394, 398, 402, - 403, 405, 407, 410, 412, 414, 416, 419, 423, 426, - 428, 430, 432, 434, 436, 438, 440, 442, 444, 446, - 448, 450, 452, 454, 456, 458, 460, 462, 464, 466, - 468, 470, 472, 474, 478, 482, 485, 487, 489, 491, - 493, 495, 497, 499, 505, 513, 521, 527, 532, 533, - 535, 536, 539, 542, 544, 547, 551, 554, 560, 566, - 574, 584, 585, 587, 588, 590, 600, 601, 603, 605, - 607, 609, 611, 615, 619, 625, 629, 630, 632, 636, - 640, 644, 650, 654, 659, 660, 662, 664, 667, 673, - 676, 678, 680, 682, 684, 688, 690, 692, 694, 696, - 703, 704, 706, 707, 709, 711, 715, 720, 725, 730, - 735, 736, 738, 740, 743, 747, 750, 754, 758, 762, - 766, 770, 775, 782, 789, 796, 801, 806, 808, 810, - 814, 816, 818, 821, 824, 826, 828, 831, 834, 836, - 839, 842, 844, 847, 850, 852, 858, 863, 869, 871, - 875, 879, 883, 885, 889, 893, 895, 899, 903, 907, - 909, 913, 917, 921, 925, 929, 931, 935, 939, 941, - 945, 947, 951, 953, 957, 959, 963, 965, 969, 971, - 977, 979, 981, 985, 987, 989, 991, 993, 995, 997, - 999, 1001, 1003, 1005, 1007, 1009, 1011, 1013, 1015, 1017, - 1019, 1021 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const short int yyrhs[] = -{ - 107, 0, -1, 122, -1, 109, -1, 53, -1, 50, - -1, 51, -1, 56, -1, 55, -1, 52, -1, 54, - -1, 111, -1, 112, -1, 7, -1, 36, -1, 26, - -1, 28, -1, 10, -1, 20, -1, 15, -1, 5, - -1, 113, -1, 116, -1, 117, -1, 113, -1, 113, - -1, 111, 234, -1, 117, 234, -1, 118, -1, 120, - -1, 119, -1, 57, -1, 71, 57, -1, 117, 72, - 119, -1, 117, 72, 11, -1, 117, 72, 42, -1, - 121, 72, 11, -1, 111, -1, 47, -1, 123, 124, - 125, -1, -1, 126, -1, -1, 124, 127, -1, -1, - 125, 130, -1, 31, 117, 101, -1, 128, -1, 129, - -1, 24, 117, 101, -1, 24, 117, 72, 103, 101, - -1, 134, -1, 165, -1, 101, -1, 132, -1, 131, - 132, -1, 34, -1, 33, -1, 32, -1, 37, -1, - 3, -1, 18, -1, 29, -1, 41, -1, 45, -1, - 48, -1, 38, -1, 135, 11, 119, -1, 133, 139, - -1, 133, 137, 139, -1, 133, 136, 139, -1, 133, - 136, 137, 139, -1, -1, 131, -1, 17, 114, -1, - 23, 138, -1, 115, -1, 138, 66, 115, -1, 68, - 140, 67, -1, -1, 140, 141, -1, 142, -1, 158, - -1, 159, -1, 130, -1, 143, -1, 148, -1, 135, - 110, 144, 101, -1, 145, -1, 144, 66, 145, -1, - 146, -1, 146, 73, 147, -1, 119, -1, 146, 62, - 61, -1, 261, -1, 174, -1, 149, 101, -1, 149, - 157, -1, 149, 157, 101, -1, 135, 110, 151, 150, - -1, 135, 47, 151, 150, -1, -1, 155, -1, 119, - 91, 152, 90, -1, 151, 62, 61, -1, -1, 153, - -1, 154, -1, 153, 66, 154, -1, 135, 110, 146, - -1, 44, 156, -1, 114, -1, 156, 66, 114, -1, - 177, -1, 37, 177, -1, 135, 160, 150, 161, -1, - 135, 160, 150, 161, 101, -1, 118, 91, 152, 90, - -1, 68, 162, 178, 67, -1, -1, 162, 163, -1, - 42, 91, 228, 90, 101, -1, 39, 91, 228, 90, - 101, -1, 135, 27, 119, -1, 164, 166, 168, -1, - -1, 167, -1, 17, 115, -1, 167, 66, 115, -1, - 68, 169, 67, -1, -1, 169, 170, -1, 171, -1, - 172, -1, 134, -1, 134, 101, -1, 165, -1, 165, - 101, -1, 143, -1, 149, 173, -1, 101, -1, 173, - 101, -1, 68, 175, 67, -1, -1, 176, -1, 176, - 66, -1, 147, -1, 176, 66, 147, -1, 68, 178, - 67, -1, -1, 179, -1, 180, -1, 179, 180, -1, - 181, -1, 183, -1, 134, -1, 182, 101, -1, 131, - 110, 144, -1, 110, 144, -1, 185, -1, 187, -1, - 191, -1, 192, -1, 201, -1, 204, -1, 185, -1, - 188, -1, 193, -1, 202, -1, 207, -1, 177, -1, - 186, -1, 189, -1, 194, -1, 203, -1, 213, -1, - 215, -1, 216, -1, 218, -1, 217, -1, 219, -1, - 212, -1, 101, -1, 119, 65, 183, -1, 119, 65, - 184, -1, 190, 101, -1, 258, -1, 242, -1, 243, - -1, 239, -1, 240, -1, 236, -1, 226, -1, 22, - 91, 261, 90, 183, -1, 22, 91, 261, 90, 184, - 16, 183, -1, 22, 91, 261, 90, 184, 16, 184, - -1, 40, 91, 261, 90, 195, -1, 68, 197, 196, - 67, -1, -1, 199, -1, -1, 197, 198, -1, 199, - 179, -1, 200, -1, 199, 200, -1, 8, 262, 65, - -1, 13, 65, -1, 49, 91, 261, 90, 183, -1, - 49, 91, 261, 90, 184, -1, 14, 183, 49, 91, - 261, 90, 101, -1, 21, 91, 206, 101, 208, 101, - 205, 90, 183, -1, -1, 210, -1, -1, 209, -1, - 21, 91, 206, 101, 208, 101, 205, 90, 184, -1, - -1, 261, -1, 211, -1, 182, -1, 211, -1, 190, - -1, 211, 66, 190, -1, 4, 261, 101, -1, 4, - 261, 65, 261, 101, -1, 6, 214, 101, -1, -1, - 119, -1, 12, 214, 101, -1, 35, 208, 101, -1, - 43, 261, 101, -1, 41, 91, 261, 90, 177, -1, - 46, 177, 221, -1, 46, 177, 220, 223, -1, -1, - 221, -1, 222, -1, 221, 222, -1, 9, 91, 154, - 90, 177, -1, 19, 177, -1, 225, -1, 230, -1, - 108, -1, 42, -1, 91, 261, 90, -1, 226, -1, - 235, -1, 236, -1, 237, -1, 263, 114, 91, 228, - 90, 227, -1, -1, 139, -1, -1, 229, -1, 261, - -1, 229, 66, 261, -1, 263, 111, 232, 231, -1, - 263, 113, 232, 231, -1, 263, 111, 234, 174, -1, - 263, 113, 234, 174, -1, -1, 234, -1, 233, -1, - 232, 233, -1, 62, 261, 61, -1, 62, 61, -1, - 234, 62, 61, -1, 224, 72, 119, -1, 39, 72, - 119, -1, 42, 72, 119, -1, 224, 72, 42, -1, - 117, 91, 228, 90, -1, 224, 72, 119, 91, 228, - 90, -1, 39, 72, 119, 91, 228, 90, -1, 42, - 72, 119, 91, 228, 90, -1, 117, 62, 261, 61, - -1, 225, 62, 261, 61, -1, 224, -1, 117, -1, - 116, 72, 11, -1, 239, -1, 240, -1, 238, 99, - -1, 238, 89, -1, 242, -1, 243, -1, 97, 241, - -1, 87, 241, -1, 244, -1, 99, 241, -1, 89, - 241, -1, 238, -1, 102, 241, -1, 75, 241, -1, - 245, -1, 91, 111, 231, 90, 241, -1, 91, 261, - 90, 244, -1, 91, 117, 234, 90, 244, -1, 241, - -1, 246, 103, 241, -1, 246, 69, 241, -1, 246, - 92, 241, -1, 246, -1, 247, 97, 246, -1, 247, - 87, 246, -1, 247, -1, 248, 86, 247, -1, 248, - 79, 247, -1, 248, 81, 247, -1, 248, -1, 249, - 84, 248, -1, 249, 77, 248, -1, 249, 85, 248, - -1, 249, 78, 248, -1, 249, 25, 112, -1, 249, - -1, 250, 74, 249, -1, 250, 76, 249, -1, 250, - -1, 251, 58, 250, -1, 251, -1, 252, 63, 251, - -1, 252, -1, 253, 94, 252, -1, 253, -1, 254, - 59, 253, -1, 254, -1, 255, 96, 254, -1, 255, - -1, 255, 100, 261, 65, 256, -1, 256, -1, 258, - -1, 259, 260, 257, -1, 117, -1, 235, -1, 237, - -1, 73, -1, 104, -1, 70, -1, 93, -1, 98, - -1, 88, -1, 83, -1, 80, -1, 82, -1, 60, - -1, 64, -1, 95, -1, 257, -1, 261, -1, 30, - -1, 117, 72, 30, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short int yyrline[] = -{ - 0, 191, 191, 200, 208, 216, 224, 232, 240, 249, - 257, 266, 274, 283, 288, 293, 298, 303, 308, 313, - 318, 324, 332, 341, 351, 360, 369, 377, 387, 393, - 400, 407, 413, 420, 429, 439, 449, 458, 466, 475, - 484, 490, 499, 505, 514, 520, 529, 541, 549, 558, - 570, 583, 591, 599, 608, 616, 625, 625, 625, 626, - 627, 627, 627, 627, 627, 627, 628, 631, 641, 650, - 659, 668, 678, 684, 693, 702, 711, 719, 728, 737, - 743, 752, 760, 768, 776, 785, 793, 802, 808, 816, - 825, 833, 842, 851, 860, 868, 877, 885, 893, 902, - 911, 921, 928, 938, 948, 955, 962, 965, 971, 981, - 991, 1001, 1007, 1017, 1027, 1037, 1046, 1056, 1067, 1077, - 1084, 1094, 1103, 1113, 1122, 1132, 1138, 1148, 1157, 1167, - 1177, 1184, 1193, 1202, 1211, 1220, 1228, 1237, 1246, 1256, - 1266, 1275, 1285, 1295, 1302, 1311, 1321, 1330, 1340, 1349, - 1356, 1366, 1375, 1385, 1394, 1403, 1413, 1423, 1432, 1442, - 1451, 1460, 1469, 1478, 1487, 1497, 1506, 1515, 1524, 1533, - 1543, 1552, 1561, 1570, 1579, 1588, 1597, 1606, 1615, 1624, - 1633, 1642, 1652, 1662, 1673, 1683, 1693, 1702, 1711, 1720, - 1729, 1738, 1747, 1757, 1767, 1777, 1787, 1794, 1801, 1808, - 1818, 1825, 1835, 1845, 1854, 1864, 1873, 1883, 1890, 1897, - 1904, 1912, 1919, 1929, 1936, 1946, 1956, 1963, 1973, 1982, - 1992, 2002, 2011, 2021, 2030, 2040, 2051, 2058, 2065, 2076, - 2086, 2096, 2106, 2115, 2125, 2132, 2142, 2151, 2161, 2168, - 2178, 2187, 2197, 2206, 2212, 2221, 2230, 2239, 2248, 2258, - 2268, 2275, 2285, 2292, 2302, 2311, 2321, 2330, 2339, 2348, - 2358, 2365, 2375, 2384, 2394, 2404, 2410, 2417, 2427, 2437, - 2447, 2458, 2468, 2479, 2489, 2500, 2510, 2520, 2529, 2538, - 2547, 2556, 2566, 2576, 2586, 2595, 2604, 2613, 2622, 2632, - 2642, 2652, 2661, 2670, 2679, 2689, 2698, 2707, 2714, 2723, - 2732, 2741, 2751, 2760, 2769, 2779, 2788, 2797, 2806, 2816, - 2825, 2834, 2843, 2852, 2861, 2871, 2880, 2889, 2899, 2908, - 2918, 2927, 2937, 2946, 2956, 2965, 2975, 2984, 2994, 3003, - 3013, 3022, 3032, 3042, 3052, 3061, 3071, 3080, 3089, 3098, - 3107, 3116, 3125, 3134, 3143, 3152, 3161, 3170, 3180, 3190, - 3200, 3209 + 0, 179, 179, 188, 196, 204, 212, 220, 228, 237, + 245, 254, 262, 271, 276, 281, 286, 291, 296, 301, + 306, 312, 320, 329, 339, 348, 357, 365, 375, 381, + 388, 395, 401, 408, 417, 427, 437, 446, 454, 463, + 472, 478, 487, 493, 502, 508, 517, 529, 537, 546, + 558, 571, 579, 587, 596, 604, 613, 613, 613, 614, + 615, 615, 615, 615, 615, 615, 616, 619, 629, 638, + 647, 656, 666, 672, 681, 690, 699, 707, 716, 725, + 731, 740, 748, 756, 764, 773, 781, 790, 796, 804, + 813, 821, 830, 839, 848, 856, 865, 873, 881, 890, + 899, 909, 916, 926, 936, 943, 950, 953, 959, 969, + 979, 989, 995, 1005, 1015, 1025, 1034, 1044, 1055, 1065, + 1072, 1082, 1091, 1101, 1110, 1120, 1126, 1136, 1145, 1155, + 1165, 1172, 1181, 1190, 1199, 1208, 1216, 1225, 1234, 1244, + 1254, 1263, 1273, 1283, 1290, 1299, 1309, 1318, 1328, 1337, + 1344, 1354, 1363, 1373, 1382, 1391, 1401, 1411, 1420, 1430, + 1439, 1448, 1457, 1466, 1475, 1485, 1494, 1503, 1512, 1521, + 1531, 1540, 1549, 1558, 1567, 1576, 1585, 1594, 1603, 1612, + 1621, 1630, 1640, 1650, 1661, 1671, 1681, 1690, 1699, 1708, + 1717, 1726, 1735, 1745, 1755, 1765, 1775, 1782, 1789, 1796, + 1806, 1813, 1823, 1833, 1842, 1852, 1861, 1871, 1878, 1885, + 1892, 1900, 1907, 1917, 1924, 1934, 1944, 1951, 1961, 1970, + 1980, 1990, 1999, 2009, 2018, 2028, 2039, 2046, 2053, 2064, + 2074, 2084, 2094, 2103, 2113, 2120, 2130, 2139, 2149, 2156, + 2166, 2175, 2185, 2194, 2200, 2209, 2218, 2227, 2236, 2246, + 2256, 2263, 2273, 2280, 2290, 2299, 2309, 2318, 2327, 2336, + 2346, 2353, 2363, 2372, 2382, 2392, 2398, 2405, 2415, 2425, + 2435, 2446, 2456, 2467, 2477, 2488, 2498, 2508, 2517, 2526, + 2535, 2544, 2554, 2564, 2574, 2583, 2592, 2601, 2610, 2620, + 2630, 2640, 2649, 2658, 2667, 2677, 2686, 2695, 2702, 2711, + 2720, 2729, 2739, 2748, 2757, 2767, 2776, 2785, 2794, 2804, + 2813, 2822, 2831, 2840, 2849, 2859, 2868, 2877, 2887, 2896, + 2906, 2915, 2925, 2934, 2944, 2953, 2963, 2972, 2982, 2991, + 3001, 3010, 3020, 3030, 3040, 3049, 3059, 3068, 3077, 3086, + 3095, 3104, 3113, 3122, 3131, 3140, 3149, 3158, 3168, 3178, + 3188, 3197 }; #endif -#if YYDEBUG || YYERROR_VERBOSE -/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +#if YYDEBUG || YYERROR_VERBOSE || 1 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "jp_ABSTRACT", "jp_ASSERT", @@ -798,14 +797,14 @@ static const char *const yytname[] = "ConditionalAndExpression", "ConditionalOrExpression", "ConditionalExpression", "AssignmentExpression", "Assignment", "LeftHandSide", "AssignmentOperator", "Expression", "ConstantExpression", - "New", 0 + "New", YY_NULLPTR }; #endif # ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const unsigned short int yytoknum[] = +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -821,178 +820,19 @@ static const unsigned short int yytoknum[] = }; # endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const unsigned short int yyr1[] = -{ - 0, 106, 107, 108, 108, 108, 108, 108, 108, 109, - 109, 110, 110, 111, 111, 111, 111, 111, 111, 111, - 111, 112, 112, 113, 114, 115, 116, 116, 117, 117, - 118, 119, 119, 120, 120, 120, 120, 121, 121, 122, - 123, 123, 124, 124, 125, 125, 126, 127, 127, 128, - 129, 130, 130, 130, 131, 131, 132, 132, 132, 132, - 132, 132, 132, 132, 132, 132, 132, 133, 134, 134, - 134, 134, 135, 135, 136, 137, 138, 138, 139, 140, - 140, 141, 141, 141, 141, 142, 142, 143, 144, 144, - 145, 145, 146, 146, 147, 147, 148, 148, 148, 149, - 149, 150, 150, 151, 151, 152, 152, 153, 153, 154, - 155, 156, 156, 157, 158, 159, 159, 160, 161, 162, - 162, 163, 163, 164, 165, 166, 166, 167, 167, 168, - 169, 169, 170, 170, 170, 170, 170, 170, 171, 172, - 173, 173, 174, 175, 175, 175, 176, 176, 177, 178, - 178, 179, 179, 180, 180, 180, 181, 182, 182, 183, - 183, 183, 183, 183, 183, 184, 184, 184, 184, 184, - 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, - 185, 185, 186, 187, 188, 189, 190, 190, 190, 190, - 190, 190, 190, 191, 192, 193, 194, 195, 196, 196, - 197, 197, 198, 199, 199, 200, 200, 201, 202, 203, - 204, 205, 205, 206, 206, 207, 208, 208, 209, 209, - 210, 211, 211, 212, 212, 213, 214, 214, 215, 216, - 217, 218, 219, 219, 220, 220, 221, 221, 222, 223, - 224, 224, 225, 225, 225, 225, 225, 225, 225, 226, - 227, 227, 228, 228, 229, 229, 230, 230, 230, 230, - 231, 231, 232, 232, 233, 234, 234, 235, 235, 235, - 235, 236, 236, 236, 236, 237, 237, 238, 238, 238, - 238, 238, 239, 240, 241, 241, 241, 241, 241, 242, - 243, 244, 244, 244, 244, 245, 245, 245, 246, 246, - 246, 246, 247, 247, 247, 248, 248, 248, 248, 249, - 249, 249, 249, 249, 249, 250, 250, 250, 251, 251, - 252, 252, 253, 253, 254, 254, 255, 255, 256, 256, - 257, 257, 258, 259, 259, 259, 260, 260, 260, 260, - 260, 260, 260, 260, 260, 260, 260, 260, 261, 262, - 263, 263 -}; +#define YYPACT_NINF -503 -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const unsigned char yyr2[] = -{ - 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, - 1, 1, 2, 3, 3, 3, 3, 1, 1, 3, - 0, 1, 0, 2, 0, 2, 3, 1, 1, 3, - 5, 1, 1, 1, 1, 2, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 3, 2, 3, - 3, 4, 0, 1, 2, 2, 1, 3, 3, 0, - 2, 1, 1, 1, 1, 1, 1, 4, 1, 3, - 1, 3, 1, 3, 1, 1, 2, 2, 3, 4, - 4, 0, 1, 4, 3, 0, 1, 1, 3, 3, - 2, 1, 3, 1, 2, 4, 5, 4, 4, 0, - 2, 5, 5, 3, 3, 0, 1, 2, 3, 3, - 0, 2, 1, 1, 1, 2, 1, 2, 1, 2, - 1, 2, 3, 0, 1, 2, 1, 3, 3, 0, - 1, 1, 2, 1, 1, 1, 2, 3, 2, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 3, 3, 2, 1, 1, 1, 1, - 1, 1, 1, 5, 7, 7, 5, 4, 0, 1, - 0, 2, 2, 1, 2, 3, 2, 5, 5, 7, - 9, 0, 1, 0, 1, 9, 0, 1, 1, 1, - 1, 1, 3, 3, 5, 3, 0, 1, 3, 3, - 3, 5, 3, 4, 0, 1, 1, 2, 5, 2, - 1, 1, 1, 1, 3, 1, 1, 1, 1, 6, - 0, 1, 0, 1, 1, 3, 4, 4, 4, 4, - 0, 1, 1, 2, 3, 2, 3, 3, 3, 3, - 3, 4, 6, 6, 6, 4, 4, 1, 1, 3, - 1, 1, 2, 2, 1, 1, 2, 2, 1, 2, - 2, 1, 2, 2, 1, 5, 4, 5, 1, 3, - 3, 3, 1, 3, 3, 1, 3, 3, 3, 1, - 3, 3, 3, 3, 3, 1, 3, 3, 1, 3, - 1, 3, 1, 3, 1, 3, 1, 3, 1, 5, - 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 3 -}; +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-503))) -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const unsigned short int yydefact[] = -{ - 40, 0, 0, 2, 42, 41, 20, 13, 17, 19, - 18, 15, 16, 14, 38, 31, 0, 37, 0, 28, - 30, 29, 0, 1, 44, 32, 0, 46, 0, 0, - 72, 43, 47, 48, 34, 35, 33, 36, 0, 60, - 61, 62, 58, 57, 56, 59, 66, 63, 64, 65, - 53, 45, 73, 54, 0, 51, 0, 125, 52, 0, - 49, 55, 0, 0, 79, 0, 0, 68, 0, 0, - 0, 0, 126, 0, 24, 74, 23, 25, 76, 75, - 72, 0, 70, 69, 67, 123, 127, 130, 124, 0, - 50, 0, 59, 78, 84, 0, 80, 81, 85, 86, - 0, 82, 83, 71, 72, 128, 77, 72, 114, 38, - 0, 11, 12, 21, 22, 23, 28, 101, 96, 97, - 113, 129, 134, 0, 138, 0, 136, 131, 132, 133, - 0, 226, 226, 0, 0, 0, 350, 216, 0, 0, - 63, 243, 0, 0, 0, 5, 6, 9, 4, 10, - 8, 7, 0, 0, 0, 182, 242, 3, 0, 22, - 333, 30, 73, 155, 0, 170, 0, 72, 151, 153, - 0, 154, 159, 171, 160, 172, 0, 161, 162, 173, - 163, 174, 164, 181, 175, 176, 177, 179, 178, 180, - 277, 240, 245, 241, 246, 247, 248, 0, 189, 190, - 187, 188, 186, 0, 0, 0, 101, 92, 0, 88, - 90, 101, 0, 26, 27, 72, 0, 0, 102, 98, - 135, 140, 139, 137, 0, 0, 0, 0, 0, 37, - 0, 278, 245, 247, 291, 280, 281, 298, 284, 285, - 288, 294, 302, 305, 309, 315, 318, 320, 322, 324, - 326, 328, 330, 348, 331, 0, 227, 0, 0, 0, - 0, 213, 0, 0, 217, 0, 0, 0, 0, 0, - 234, 0, 278, 246, 248, 290, 0, 289, 92, 158, - 0, 0, 0, 252, 0, 0, 148, 152, 156, 185, - 0, 0, 283, 282, 345, 346, 338, 336, 343, 344, - 342, 341, 339, 347, 340, 337, 0, 37, 24, 0, - 72, 0, 100, 0, 87, 0, 0, 99, 265, 0, - 0, 0, 106, 107, 111, 110, 119, 115, 141, 293, - 287, 37, 278, 0, 286, 292, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 223, 225, - 228, 0, 0, 219, 221, 0, 214, 218, 0, 229, - 268, 0, 0, 269, 230, 0, 0, 232, 236, 0, - 244, 279, 0, 351, 0, 253, 254, 183, 157, 270, - 267, 0, 332, 0, 260, 262, 0, 260, 0, 252, - 0, 104, 89, 93, 143, 91, 95, 94, 266, 0, - 117, 72, 0, 72, 116, 0, 26, 27, 244, 300, - 301, 299, 304, 303, 307, 308, 306, 314, 311, 313, - 310, 312, 316, 317, 319, 321, 323, 325, 327, 0, - 0, 0, 216, 0, 0, 252, 0, 0, 252, 72, - 0, 233, 237, 0, 275, 271, 0, 252, 276, 0, - 256, 263, 261, 258, 257, 259, 0, 103, 146, 0, - 144, 109, 108, 112, 0, 243, 120, 0, 0, 0, - 296, 0, 224, 0, 0, 222, 0, 0, 0, 30, - 193, 0, 159, 166, 167, 168, 169, 0, 200, 196, - 231, 0, 0, 239, 207, 255, 0, 264, 250, 142, - 145, 252, 252, 118, 295, 297, 329, 0, 211, 213, - 0, 0, 0, 0, 273, 198, 274, 0, 272, 251, - 249, 147, 0, 0, 209, 0, 212, 220, 0, 0, - 0, 184, 194, 0, 0, 0, 201, 72, 203, 238, - 0, 0, 0, 216, 0, 0, 349, 0, 206, 197, - 202, 204, 122, 121, 210, 0, 0, 208, 205, 211, - 0, 0, 195, 0, 215 -}; +#define YYTABLE_NINF -336 -/* YYDEFGOTO[NTERM-NUM]. */ -static const short int yydefgoto[] = -{ - -1, 2, 156, 157, 158, 229, 112, 113, 75, 78, - 230, 231, 19, 20, 21, 22, 3, 4, 24, 30, - 5, 31, 32, 33, 51, 52, 53, 54, 163, 164, - 65, 66, 79, 67, 80, 96, 97, 98, 208, 209, - 210, 405, 99, 100, 217, 206, 321, 322, 323, 218, - 325, 119, 101, 102, 117, 327, 413, 476, 57, 58, - 71, 72, 88, 104, 127, 128, 129, 222, 406, 469, - 470, 165, 166, 167, 168, 169, 170, 171, 491, 172, - 173, 174, 493, 175, 176, 177, 178, 494, 179, 499, - 545, 525, 546, 547, 548, 180, 495, 181, 182, 535, - 365, 496, 263, 366, 536, 367, 183, 184, 257, 185, - 186, 187, 188, 189, 376, 377, 378, 451, 190, 191, - 232, 530, 384, 385, 193, 415, 394, 395, 214, 194, - 233, 196, 234, 235, 236, 237, 238, 239, 240, 241, - 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 203, 306, 386, 557, 204 -}; +#define yytable_value_is_error(Yytable_value) \ + 0 -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -503 -static const short int yypact[] = + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = { 159, 1039, 236, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, 186, -503, 56, -503, @@ -1054,8 +894,73 @@ static const short int yypact[] = 1699, 432, -503, 1699, -503 }; -/* YYPGOTO[NTERM-NUM]. */ -static const short int yypgoto[] = + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint16 yydefact[] = +{ + 40, 0, 0, 2, 42, 41, 20, 13, 17, 19, + 18, 15, 16, 14, 38, 31, 0, 37, 0, 28, + 30, 29, 0, 1, 44, 32, 0, 46, 0, 0, + 72, 43, 47, 48, 34, 35, 33, 36, 0, 60, + 61, 62, 58, 57, 56, 59, 66, 63, 64, 65, + 53, 45, 73, 54, 0, 51, 0, 125, 52, 0, + 49, 55, 0, 0, 79, 0, 0, 68, 0, 0, + 0, 0, 126, 0, 24, 74, 23, 25, 76, 75, + 72, 0, 70, 69, 67, 123, 127, 130, 124, 0, + 50, 0, 59, 78, 84, 0, 80, 81, 85, 86, + 0, 82, 83, 71, 72, 128, 77, 72, 114, 38, + 0, 11, 12, 21, 22, 23, 28, 101, 96, 97, + 113, 129, 134, 0, 138, 0, 136, 131, 132, 133, + 0, 226, 226, 0, 0, 0, 350, 216, 0, 0, + 63, 243, 0, 0, 0, 5, 6, 9, 4, 10, + 8, 7, 0, 0, 0, 182, 242, 3, 0, 22, + 333, 30, 73, 155, 0, 170, 0, 72, 151, 153, + 0, 154, 159, 171, 160, 172, 0, 161, 162, 173, + 163, 174, 164, 181, 175, 176, 177, 179, 178, 180, + 277, 240, 245, 241, 246, 247, 248, 0, 189, 190, + 187, 188, 186, 0, 0, 0, 101, 92, 0, 88, + 90, 101, 0, 26, 27, 72, 0, 0, 102, 98, + 135, 140, 139, 137, 0, 0, 0, 0, 0, 37, + 0, 278, 245, 247, 291, 280, 281, 298, 284, 285, + 288, 294, 302, 305, 309, 315, 318, 320, 322, 324, + 326, 328, 330, 348, 331, 0, 227, 0, 0, 0, + 0, 213, 0, 0, 217, 0, 0, 0, 0, 0, + 234, 0, 278, 246, 248, 290, 0, 289, 92, 158, + 0, 0, 0, 252, 0, 0, 148, 152, 156, 185, + 0, 0, 283, 282, 345, 346, 338, 336, 343, 344, + 342, 341, 339, 347, 340, 337, 0, 37, 24, 0, + 72, 0, 100, 0, 87, 0, 0, 99, 265, 0, + 0, 0, 106, 107, 111, 110, 119, 115, 141, 293, + 287, 37, 278, 0, 286, 292, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 223, 225, + 228, 0, 0, 219, 221, 0, 214, 218, 0, 229, + 268, 0, 0, 269, 230, 0, 0, 232, 236, 0, + 244, 279, 0, 351, 0, 253, 254, 183, 157, 270, + 267, 0, 332, 0, 260, 262, 0, 260, 0, 252, + 0, 104, 89, 93, 143, 91, 95, 94, 266, 0, + 117, 72, 0, 72, 116, 0, 26, 27, 244, 300, + 301, 299, 304, 303, 307, 308, 306, 314, 311, 313, + 310, 312, 316, 317, 319, 321, 323, 325, 327, 0, + 0, 0, 216, 0, 0, 252, 0, 0, 252, 72, + 0, 233, 237, 0, 275, 271, 0, 252, 276, 0, + 256, 263, 261, 258, 257, 259, 0, 103, 146, 0, + 144, 109, 108, 112, 0, 243, 120, 0, 0, 0, + 296, 0, 224, 0, 0, 222, 0, 0, 0, 30, + 193, 0, 159, 166, 167, 168, 169, 0, 200, 196, + 231, 0, 0, 239, 207, 255, 0, 264, 250, 142, + 145, 252, 252, 118, 295, 297, 329, 0, 211, 213, + 0, 0, 0, 0, 273, 198, 274, 0, 272, 251, + 249, 147, 0, 0, 209, 0, 212, 220, 0, 0, + 0, 184, 194, 0, 0, 0, 201, 72, 203, 238, + 0, 0, 0, 216, 0, 0, 349, 0, 206, 197, + 202, 204, 122, 121, 210, 0, 0, 208, 205, 211, + 0, 0, 195, 0, 215 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = { -503, -503, -503, -503, -85, 2, 181, -41, -198, -45, -87, -1, 431, 14, -503, -503, -503, -503, -503, -503, @@ -1075,12 +980,31 @@ static const short int yypgoto[] = 95, 274, 350, -503, -503, 660, -503, -503 }; -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -336 -static const short int yytable[] = + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 2, 156, 157, 158, 229, 112, 113, 75, 78, + 230, 231, 19, 20, 21, 22, 3, 4, 24, 30, + 5, 31, 32, 33, 51, 52, 53, 54, 163, 164, + 65, 66, 79, 67, 80, 96, 97, 98, 208, 209, + 210, 405, 99, 100, 217, 206, 321, 322, 323, 218, + 325, 119, 101, 102, 117, 327, 413, 476, 57, 58, + 71, 72, 88, 104, 127, 128, 129, 222, 406, 469, + 470, 165, 166, 167, 168, 169, 170, 171, 491, 172, + 173, 174, 493, 175, 176, 177, 178, 494, 179, 499, + 545, 525, 546, 547, 548, 180, 495, 181, 182, 535, + 365, 496, 263, 366, 536, 367, 183, 184, 257, 185, + 186, 187, 188, 189, 376, 377, 378, 451, 190, 191, + 232, 530, 384, 385, 193, 415, 394, 395, 214, 194, + 233, 196, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 203, 306, 386, 557, 204 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_int16 yytable[] = { 18, 82, 83, 17, 287, 61, 309, 56, 114, 364, 110, 363, 279, 468, 34, 108, 537, 103, 324, 107, @@ -1306,7 +1230,7 @@ static const short int yytable[] = 0, 0, 0, 0, 0, 305 }; -static const short int yycheck[] = +static const yytype_int16 yycheck[] = { 1, 65, 66, 1, 167, 52, 204, 30, 95, 261, 95, 261, 158, 404, 11, 92, 518, 81, 216, 68, @@ -1532,9 +1456,9 @@ static const short int yycheck[] = -1, -1, -1, -1, -1, 104 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const unsigned short int yystos[] = + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint16 yystos[] = { 0, 31, 107, 122, 123, 126, 5, 7, 10, 15, 20, 26, 28, 36, 47, 57, 71, 111, 117, 118, @@ -1596,78 +1520,123 @@ static const unsigned short int yystos[] = 16, 205, 184, 90, 184 }; -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ -#endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t -#endif -#if ! defined (YYSIZE_T) -# if defined (__STDC__) || defined (__cplusplus) -# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -#endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int -#endif + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint16 yyr1[] = +{ + 0, 106, 107, 108, 108, 108, 108, 108, 108, 109, + 109, 110, 110, 111, 111, 111, 111, 111, 111, 111, + 111, 112, 112, 113, 114, 115, 116, 116, 117, 117, + 118, 119, 119, 120, 120, 120, 120, 121, 121, 122, + 123, 123, 124, 124, 125, 125, 126, 127, 127, 128, + 129, 130, 130, 130, 131, 131, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 133, 134, 134, + 134, 134, 135, 135, 136, 137, 138, 138, 139, 140, + 140, 141, 141, 141, 141, 142, 142, 143, 144, 144, + 145, 145, 146, 146, 147, 147, 148, 148, 148, 149, + 149, 150, 150, 151, 151, 152, 152, 153, 153, 154, + 155, 156, 156, 157, 158, 159, 159, 160, 161, 162, + 162, 163, 163, 164, 165, 166, 166, 167, 167, 168, + 169, 169, 170, 170, 170, 170, 170, 170, 171, 172, + 173, 173, 174, 175, 175, 175, 176, 176, 177, 178, + 178, 179, 179, 180, 180, 180, 181, 182, 182, 183, + 183, 183, 183, 183, 183, 184, 184, 184, 184, 184, + 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 186, 187, 188, 189, 190, 190, 190, 190, + 190, 190, 190, 191, 192, 193, 194, 195, 196, 196, + 197, 197, 198, 199, 199, 200, 200, 201, 202, 203, + 204, 205, 205, 206, 206, 207, 208, 208, 209, 209, + 210, 211, 211, 212, 212, 213, 214, 214, 215, 216, + 217, 218, 219, 219, 220, 220, 221, 221, 222, 223, + 224, 224, 225, 225, 225, 225, 225, 225, 225, 226, + 227, 227, 228, 228, 229, 229, 230, 230, 230, 230, + 231, 231, 232, 232, 233, 234, 234, 235, 235, 235, + 235, 236, 236, 236, 236, 237, 237, 238, 238, 238, + 238, 238, 239, 240, 241, 241, 241, 241, 241, 242, + 243, 244, 244, 244, 244, 245, 245, 245, 246, 246, + 246, 246, 247, 247, 247, 248, 248, 248, 248, 249, + 249, 249, 249, 249, 249, 250, 250, 250, 251, 251, + 252, 252, 253, 253, 254, 254, 255, 255, 256, 256, + 257, 257, 258, 259, 259, 259, 260, 260, 260, 260, + 260, 260, 260, 260, 260, 260, 260, 260, 261, 262, + 263, 263 +}; -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, + 1, 1, 2, 3, 3, 3, 3, 1, 1, 3, + 0, 1, 0, 2, 0, 2, 3, 1, 1, 3, + 5, 1, 1, 1, 1, 2, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 3, 2, 3, + 3, 4, 0, 1, 2, 2, 1, 3, 3, 0, + 2, 1, 1, 1, 1, 1, 1, 4, 1, 3, + 1, 3, 1, 3, 1, 1, 2, 2, 3, 4, + 4, 0, 1, 4, 3, 0, 1, 1, 3, 3, + 2, 1, 3, 1, 2, 4, 5, 4, 4, 0, + 2, 5, 5, 3, 3, 0, 1, 2, 3, 3, + 0, 2, 1, 1, 1, 2, 1, 2, 1, 2, + 1, 2, 3, 0, 1, 2, 1, 3, 3, 0, + 1, 1, 2, 1, 1, 1, 2, 3, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 3, 3, 2, 1, 1, 1, 1, + 1, 1, 1, 5, 7, 7, 5, 4, 0, 1, + 0, 2, 2, 1, 2, 3, 2, 5, 5, 7, + 9, 0, 1, 0, 1, 9, 0, 1, 1, 1, + 1, 1, 3, 3, 5, 3, 0, 1, 3, 3, + 3, 5, 3, 4, 0, 1, 1, 2, 5, 2, + 1, 1, 1, 1, 3, 1, 1, 1, 1, 6, + 0, 1, 0, 1, 1, 3, 4, 4, 4, 4, + 0, 1, 1, 2, 3, 2, 3, 3, 3, 3, + 3, 4, 6, 6, 6, 4, 4, 1, 1, 3, + 1, 1, 2, 2, 1, 1, 2, 2, 1, 2, + 2, 1, 2, 2, 1, 5, 4, 5, 1, 3, + 3, 3, 1, 3, 3, 1, 3, 3, 3, 1, + 3, 3, 3, 3, 3, 1, 3, 3, 1, 3, + 1, 3, 1, 3, 1, 3, 1, 3, 1, 5, + 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3 +}; -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab -#define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror ("syntax error: cannot back up");\ - YYERROR; \ - } \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (yyscanner, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ while (0) -#define YYTERROR 1 -#define YYERRCODE 256 - -/* YYLLOC_DEFAULT -- Compute the default location (before the actions - are run). */ +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - ((Current).first_line = (Rhs)[1].first_line, \ - (Current).first_column = (Rhs)[1].first_column, \ - (Current).last_line = (Rhs)[N].last_line, \ - (Current).last_column = (Rhs)[N].last_column) -#endif -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, YYLEX_PARAM) -#else -# define YYLEX yylex (&yylval) -#endif /* Enable debugging if requested. */ #if YYDEBUG @@ -1677,54 +1646,85 @@ while (0) # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ } while (0) -# define YYDSYMPRINT(Args) \ -do { \ - if (yydebug) \ - yysymprint Args; \ -} while (0) +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif -# define YYDSYMPRINTF(Title, Token, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yysymprint (stderr, \ - Token, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, yyscanner); \ + YYFPRINTF (stderr, "\n"); \ + } \ } while (0) + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner) +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + YYUSE (yyscanner); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner) +{ + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner); + YYFPRINTF (yyoutput, ")"); +} + /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) static void -yy_stack_print (short int *bottom, short int *top) -#else -static void -yy_stack_print (bottom, top) - short int *bottom; - short int *top; -#endif +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) { YYFPRINTF (stderr, "Stack now"); - for (/* Nothing. */; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ } while (0) @@ -1732,29 +1732,30 @@ do { \ | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) static void -yy_reduce_print (int yyrule) -#else -static void -yy_reduce_print (yyrule) - int yyrule; -#endif +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, yyscan_t yyscanner) { + unsigned long int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; int yyi; - unsigned int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); - /* Print the symbols being reduced, and their result. */ - for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) - YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); - YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , yyscanner); + YYFPRINTF (stderr, "\n"); + } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (Rule); \ +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule, yyscanner); \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that @@ -1762,15 +1763,14 @@ do { \ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) -# define YYDSYMPRINT(Args) -# define YYDSYMPRINTF(Title, Token, Value, Location) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -1778,58 +1778,40 @@ int yydebug; if the built-in stack extension method is used). Do not make this value too large; the results are undefined if - SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ -#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 -# undef YYMAXDEPTH -#endif - #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif - #if YYERROR_VERBOSE # ifndef yystrlen -# if defined (__GLIBC__) && defined (_STRING_H) +# if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ static YYSIZE_T -# if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) -# else -yystrlen (yystr) - const char *yystr; -# endif { - const char *yys = yystr; - - while (*yys++ != '\0') + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) continue; - - return yys - yystr - 1; + return yylen; } # endif # endif # ifndef yystpcpy -# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * -# if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) -# else -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -# endif { char *yyd = yydest; const char *yys = yysrc; @@ -1842,91 +1824,207 @@ yystpcpy (yydest, yysrc) # endif # endif -#endif /* !YYERROR_VERBOSE */ +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; - + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } -#if YYDEBUG -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ + if (! yyres) + return yystrlen (yystr); -#if defined (__STDC__) || defined (__cplusplus) -static void -yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) -#else -static void -yysymprint (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE *yyvaluep; -#endif + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) { - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } - if (yytype < YYNTOKENS) - { - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); -# ifdef YYPRINT - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ } - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - switch (yytype) + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + + if (*yymsg_alloc < yysize) { - default: - break; + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; } - YYFPRINTF (yyoutput, ")"); + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; } +#endif /* YYERROR_VERBOSE */ -#endif /* ! YYDEBUG */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) -static void -yydestruct (int yytype, YYSTYPE *yyvaluep) -#else static void -yydestruct (yytype, yyvaluep) - int yytype; - YYSTYPE *yyvaluep; -#endif +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, yyscan_t yyscanner) { - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; - - switch (yytype) - { + YYUSE (yyvaluep); + YYUSE (yyscanner); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - default: - break; - } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } - - -/* Prevent warnings from -Wmissing-prototypes. */ - -#ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -int yyparse (void *YYPARSE_PARAM); -# else -int yyparse (); -# endif -#else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - - @@ -1935,90 +2033,76 @@ int yyparse (); | yyparse. | `----------*/ -#ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -int yyparse (void *YYPARSE_PARAM) -# else -int yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -# endif -#else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) int -yyparse (void) -#else -int -yyparse () - -#endif -#endif +yyparse (yyscan_t yyscanner) { - /* The lookahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; - -/* Number of syntax errors so far. */ -int yynerrs; - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. +/* The semantic value of the lookahead symbol. */ +/* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + /* Number of syntax errors so far. */ + int yynerrs; - /* The state stack. */ - short int yyssa[YYINITDEPTH]; - short int *yyss = yyssa; - short int *yyssp; + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; -#define YYPOPSTACK (yyvsp--, yyssp--) + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; - /* When reducing, the number of symbols on the RHS of the reduced - rule. */ - int yylen; + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss; - yyvsp = yyvs; - - + yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; /*------------------------------------------------------------. @@ -2026,8 +2110,7 @@ int yynerrs; `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. - */ + have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: @@ -2040,49 +2123,46 @@ int yynerrs; #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - short int *yyss1 = yyss; - - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow ("parser stack overflow", - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE - goto yyoverflowlab; + goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyoverflowlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; { - short int *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyoverflowlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ @@ -2090,16 +2170,18 @@ int yynerrs; yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -2107,14 +2189,12 @@ int yynerrs; `-----------*/ yybackup: -/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ -/* yyresume: */ + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ @@ -2123,7 +2203,7 @@ yybackup: if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (&yylval, yyscanner); } if (yychar <= YYEOF) @@ -2134,7 +2214,7 @@ yybackup: else { yytoken = YYTRANSLATE (yychar); - YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to @@ -2145,31 +2225,28 @@ yybackup: yyn = yytable[yyn]; if (yyn <= 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; + if (yytable_value_is_error (yyn)) + goto yyerrlab; yyn = -yyn; goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - - /* Shift the lookahead token. */ - YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; - - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + goto yynewstate; @@ -2191,7 +2268,7 @@ yyreduce: yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -2205,3581 +2282,3927 @@ yyreduce: switch (yyn) { case 2: -#line 192 "cmDependsJavaParser.y" +#line 180 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2293 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 3: -#line 201 "cmDependsJavaParser.y" +#line 189 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2304 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 4: -#line 209 "cmDependsJavaParser.y" +#line 197 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2315 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 5: -#line 217 "cmDependsJavaParser.y" +#line 205 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2326 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 6: -#line 225 "cmDependsJavaParser.y" +#line 213 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2337 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 7: -#line 233 "cmDependsJavaParser.y" +#line 221 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2348 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 8: -#line 241 "cmDependsJavaParser.y" +#line 229 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2359 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 9: -#line 250 "cmDependsJavaParser.y" +#line 238 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2370 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 10: -#line 258 "cmDependsJavaParser.y" +#line 246 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2381 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 11: -#line 267 "cmDependsJavaParser.y" +#line 255 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2392 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 12: -#line 275 "cmDependsJavaParser.y" +#line 263 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2403 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 13: -#line 284 "cmDependsJavaParser.y" +#line 272 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); } +#line 2411 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 14: -#line 289 "cmDependsJavaParser.y" +#line 277 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); } +#line 2419 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 15: -#line 294 "cmDependsJavaParser.y" +#line 282 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); } +#line 2427 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 16: -#line 299 "cmDependsJavaParser.y" +#line 287 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); } +#line 2435 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 17: -#line 304 "cmDependsJavaParser.y" +#line 292 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); } +#line 2443 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 18: -#line 309 "cmDependsJavaParser.y" +#line 297 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); } +#line 2451 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 19: -#line 314 "cmDependsJavaParser.y" +#line 302 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); } +#line 2459 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 20: -#line 319 "cmDependsJavaParser.y" +#line 307 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); } +#line 2467 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 21: -#line 325 "cmDependsJavaParser.y" +#line 313 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2478 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 22: -#line 333 "cmDependsJavaParser.y" +#line 321 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2489 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 23: -#line 342 "cmDependsJavaParser.y" +#line 330 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); - jpStoreClass(yyvsp[0].str); + jpStoreClass((yyvsp[0].str)); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2501 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 24: -#line 352 "cmDependsJavaParser.y" +#line 340 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2512 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 25: -#line 361 "cmDependsJavaParser.y" +#line 349 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2523 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 26: -#line 370 "cmDependsJavaParser.y" +#line 358 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2534 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 27: -#line 378 "cmDependsJavaParser.y" +#line 366 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); - jpStoreClass(yyvsp[-1].str); + jpStoreClass((yyvsp[-1].str)); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2546 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 28: -#line 388 "cmDependsJavaParser.y" +#line 376 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); - yyval.str = yyvsp[0].str; + (yyval.str) = (yyvsp[0].str); } +#line 2555 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 29: -#line 394 "cmDependsJavaParser.y" +#line 382 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); - yyval.str = yyvsp[0].str; + (yyval.str) = (yyvsp[0].str); } +#line 2564 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 30: -#line 401 "cmDependsJavaParser.y" +#line 389 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); - yyval.str = yyvsp[0].str; + (yyval.str) = (yyvsp[0].str); } +#line 2573 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 31: -#line 408 "cmDependsJavaParser.y" +#line 396 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); - yyval.str = yyvsp[0].str; + (yyval.str) = (yyvsp[0].str); } +#line 2582 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 32: -#line 414 "cmDependsJavaParser.y" +#line 402 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); - yyval.str = yyvsp[0].str; + (yyval.str) = (yyvsp[0].str); } +#line 2591 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 33: -#line 421 "cmDependsJavaParser.y" +#line 409 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); - yyGetParser->AddClassFound(yyvsp[-2].str); - yyGetParser->UpdateCombine(yyvsp[-2].str, yyvsp[0].str); - yyGetParser->DeallocateParserType(&(yyvsp[-2].str)); - yyval.str = const_cast<char*>(yyGetParser->GetCurrentCombine()); + yyGetParser->AddClassFound((yyvsp[-2].str)); + yyGetParser->UpdateCombine((yyvsp[-2].str), (yyvsp[0].str)); + yyGetParser->DeallocateParserType(&((yyvsp[-2].str))); + (yyval.str) = const_cast<char*>(yyGetParser->GetCurrentCombine()); } +#line 2603 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 34: -#line 430 "cmDependsJavaParser.y" +#line 418 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); - jpStoreClass(yyvsp[-2].str); + jpStoreClass((yyvsp[-2].str)); jpCheckEmpty(3); yyGetParser->SetCurrentCombine(""); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2616 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 35: -#line 440 "cmDependsJavaParser.y" +#line 428 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); - jpStoreClass(yyvsp[-2].str); + jpStoreClass((yyvsp[-2].str)); yyGetParser->SetCurrentCombine(""); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2629 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 36: -#line 450 "cmDependsJavaParser.y" +#line 438 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2640 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 37: -#line 459 "cmDependsJavaParser.y" +#line 447 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2651 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 38: -#line 467 "cmDependsJavaParser.y" +#line 455 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2662 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 39: -#line 476 "cmDependsJavaParser.y" +#line 464 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2673 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 40: -#line 484 "cmDependsJavaParser.y" +#line 472 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2683 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 41: -#line 491 "cmDependsJavaParser.y" +#line 479 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2694 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 42: -#line 499 "cmDependsJavaParser.y" +#line 487 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2704 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 43: -#line 506 "cmDependsJavaParser.y" +#line 494 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2715 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 44: -#line 514 "cmDependsJavaParser.y" +#line 502 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2725 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 45: -#line 521 "cmDependsJavaParser.y" +#line 509 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2736 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 46: -#line 530 "cmDependsJavaParser.y" +#line 518 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); - yyGetParser->SetCurrentPackage(yyvsp[-1].str); - yyGetParser->DeallocateParserType(&(yyvsp[-1].str)); + yyGetParser->SetCurrentPackage((yyvsp[-1].str)); + yyGetParser->DeallocateParserType(&((yyvsp[-1].str))); yyGetParser->SetCurrentCombine(""); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2750 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 47: -#line 542 "cmDependsJavaParser.y" +#line 530 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2761 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 48: -#line 550 "cmDependsJavaParser.y" +#line 538 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2772 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 49: -#line 559 "cmDependsJavaParser.y" +#line 547 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); - yyGetParser->AddPackagesImport(yyvsp[-1].str); - yyGetParser->DeallocateParserType(&(yyvsp[-1].str)); + yyGetParser->AddPackagesImport((yyvsp[-1].str)); + yyGetParser->DeallocateParserType(&((yyvsp[-1].str))); yyGetParser->SetCurrentCombine(""); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2786 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 50: -#line 571 "cmDependsJavaParser.y" +#line 559 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); - std::string str = yyvsp[-3].str; + std::string str = (yyvsp[-3].str); str += ".*"; yyGetParser->AddPackagesImport(str.c_str()); - yyGetParser->DeallocateParserType(&(yyvsp[-3].str)); + yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); yyGetParser->SetCurrentCombine(""); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2801 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 51: -#line 584 "cmDependsJavaParser.y" +#line 572 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2812 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 52: -#line 592 "cmDependsJavaParser.y" +#line 580 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2823 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 53: -#line 600 "cmDependsJavaParser.y" +#line 588 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2834 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 54: -#line 609 "cmDependsJavaParser.y" +#line 597 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2845 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 55: -#line 617 "cmDependsJavaParser.y" +#line 605 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2856 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 67: -#line 632 "cmDependsJavaParser.y" +#line 620 "cmDependsJavaParser.y" /* yacc.c:1646 */ { - yyGetParser->StartClass(yyvsp[0].str); + yyGetParser->StartClass((yyvsp[0].str)); jpElementStart(3); - yyGetParser->DeallocateParserType(&(yyvsp[0].str)); + yyGetParser->DeallocateParserType(&((yyvsp[0].str))); jpCheckEmpty(3); } +#line 2867 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 68: -#line 642 "cmDependsJavaParser.y" +#line 630 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); yyGetParser->EndClass(); } +#line 2879 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 69: -#line 651 "cmDependsJavaParser.y" +#line 639 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); yyGetParser->EndClass(); } +#line 2891 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 70: -#line 660 "cmDependsJavaParser.y" +#line 648 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); yyGetParser->EndClass(); } +#line 2903 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 71: -#line 669 "cmDependsJavaParser.y" +#line 657 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); yyGetParser->EndClass(); } +#line 2915 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 72: -#line 678 "cmDependsJavaParser.y" +#line 666 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2925 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 73: -#line 685 "cmDependsJavaParser.y" +#line 673 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2936 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 74: -#line 694 "cmDependsJavaParser.y" +#line 682 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2947 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 75: -#line 703 "cmDependsJavaParser.y" +#line 691 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2958 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 76: -#line 712 "cmDependsJavaParser.y" +#line 700 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2969 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 77: -#line 720 "cmDependsJavaParser.y" +#line 708 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2980 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 78: -#line 729 "cmDependsJavaParser.y" +#line 717 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 2991 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 79: -#line 737 "cmDependsJavaParser.y" +#line 725 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3001 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 80: -#line 744 "cmDependsJavaParser.y" +#line 732 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3012 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 81: -#line 753 "cmDependsJavaParser.y" +#line 741 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3023 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 82: -#line 761 "cmDependsJavaParser.y" +#line 749 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3034 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 83: -#line 769 "cmDependsJavaParser.y" +#line 757 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3045 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 84: -#line 777 "cmDependsJavaParser.y" +#line 765 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3056 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 85: -#line 786 "cmDependsJavaParser.y" +#line 774 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3067 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 86: -#line 794 "cmDependsJavaParser.y" +#line 782 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3078 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 87: -#line 803 "cmDependsJavaParser.y" +#line 791 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); } +#line 3086 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 88: -#line 809 "cmDependsJavaParser.y" +#line 797 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3097 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 89: -#line 817 "cmDependsJavaParser.y" +#line 805 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3108 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 90: -#line 826 "cmDependsJavaParser.y" +#line 814 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3119 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 91: -#line 834 "cmDependsJavaParser.y" +#line 822 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3130 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 92: -#line 843 "cmDependsJavaParser.y" +#line 831 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); - yyGetParser->DeallocateParserType(&(yyvsp[0].str)); + yyGetParser->DeallocateParserType(&((yyvsp[0].str))); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3142 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 93: -#line 852 "cmDependsJavaParser.y" +#line 840 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3153 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 94: -#line 861 "cmDependsJavaParser.y" +#line 849 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3164 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 95: -#line 869 "cmDependsJavaParser.y" +#line 857 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3175 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 96: -#line 878 "cmDependsJavaParser.y" +#line 866 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3186 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 97: -#line 886 "cmDependsJavaParser.y" +#line 874 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3197 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 98: -#line 894 "cmDependsJavaParser.y" +#line 882 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3208 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 99: -#line 903 "cmDependsJavaParser.y" +#line 891 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3220 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 100: -#line 912 "cmDependsJavaParser.y" +#line 900 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3232 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 101: -#line 921 "cmDependsJavaParser.y" +#line 909 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3243 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 102: -#line 929 "cmDependsJavaParser.y" +#line 917 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3255 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 103: -#line 939 "cmDependsJavaParser.y" +#line 927 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); - yyGetParser->DeallocateParserType(&(yyvsp[-3].str)); + yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); jpCheckEmpty(4); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3268 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 104: -#line 949 "cmDependsJavaParser.y" +#line 937 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); } +#line 3277 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 105: -#line 955 "cmDependsJavaParser.y" +#line 943 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3288 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 107: -#line 966 "cmDependsJavaParser.y" +#line 954 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); } +#line 3297 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 108: -#line 972 "cmDependsJavaParser.y" +#line 960 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3309 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 109: -#line 982 "cmDependsJavaParser.y" +#line 970 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3321 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 110: -#line 992 "cmDependsJavaParser.y" +#line 980 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3333 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 111: -#line 1002 "cmDependsJavaParser.y" +#line 990 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); } +#line 3342 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 112: -#line 1008 "cmDependsJavaParser.y" +#line 996 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3354 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 113: -#line 1018 "cmDependsJavaParser.y" +#line 1006 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3366 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 114: -#line 1028 "cmDependsJavaParser.y" +#line 1016 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3378 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 115: -#line 1038 "cmDependsJavaParser.y" +#line 1026 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3390 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 116: -#line 1047 "cmDependsJavaParser.y" +#line 1035 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); jpCheckEmpty(5); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3402 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 117: -#line 1057 "cmDependsJavaParser.y" +#line 1045 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); - yyGetParser->DeallocateParserType(&(yyvsp[-3].str)); + yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); jpCheckEmpty(4); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3415 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 118: -#line 1068 "cmDependsJavaParser.y" +#line 1056 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3427 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 119: -#line 1077 "cmDependsJavaParser.y" +#line 1065 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3438 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 120: -#line 1085 "cmDependsJavaParser.y" +#line 1073 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3450 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 121: -#line 1095 "cmDependsJavaParser.y" +#line 1083 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); jpCheckEmpty(5); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3462 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 122: -#line 1104 "cmDependsJavaParser.y" +#line 1092 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); jpCheckEmpty(5); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3474 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 123: -#line 1114 "cmDependsJavaParser.y" +#line 1102 "cmDependsJavaParser.y" /* yacc.c:1646 */ { - yyGetParser->StartClass(yyvsp[0].str); + yyGetParser->StartClass((yyvsp[0].str)); jpElementStart(3); - yyGetParser->DeallocateParserType(&(yyvsp[0].str)); + yyGetParser->DeallocateParserType(&((yyvsp[0].str))); jpCheckEmpty(3); } +#line 3485 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 124: -#line 1123 "cmDependsJavaParser.y" +#line 1111 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); yyGetParser->EndClass(); } +#line 3497 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 125: -#line 1132 "cmDependsJavaParser.y" +#line 1120 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3507 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 126: -#line 1139 "cmDependsJavaParser.y" +#line 1127 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3519 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 127: -#line 1149 "cmDependsJavaParser.y" +#line 1137 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3531 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 128: -#line 1158 "cmDependsJavaParser.y" +#line 1146 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3543 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 129: -#line 1168 "cmDependsJavaParser.y" +#line 1156 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3555 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 130: -#line 1177 "cmDependsJavaParser.y" +#line 1165 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3566 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 131: -#line 1185 "cmDependsJavaParser.y" +#line 1173 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3577 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 132: -#line 1194 "cmDependsJavaParser.y" +#line 1182 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3589 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 133: -#line 1203 "cmDependsJavaParser.y" +#line 1191 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3601 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 134: -#line 1212 "cmDependsJavaParser.y" +#line 1200 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3613 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 135: -#line 1221 "cmDependsJavaParser.y" +#line 1209 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3624 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 136: -#line 1229 "cmDependsJavaParser.y" +#line 1217 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3636 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 137: -#line 1238 "cmDependsJavaParser.y" +#line 1226 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3647 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 138: -#line 1247 "cmDependsJavaParser.y" +#line 1235 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3659 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 139: -#line 1257 "cmDependsJavaParser.y" +#line 1245 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3671 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 140: -#line 1267 "cmDependsJavaParser.y" +#line 1255 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3683 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 141: -#line 1276 "cmDependsJavaParser.y" +#line 1264 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3695 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 142: -#line 1286 "cmDependsJavaParser.y" +#line 1274 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3707 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 143: -#line 1295 "cmDependsJavaParser.y" +#line 1283 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3718 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 144: -#line 1303 "cmDependsJavaParser.y" +#line 1291 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3730 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 145: -#line 1312 "cmDependsJavaParser.y" +#line 1300 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3742 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 146: -#line 1322 "cmDependsJavaParser.y" +#line 1310 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3754 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 147: -#line 1331 "cmDependsJavaParser.y" +#line 1319 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3766 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 148: -#line 1341 "cmDependsJavaParser.y" +#line 1329 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3777 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 149: -#line 1349 "cmDependsJavaParser.y" +#line 1337 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3788 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 150: -#line 1357 "cmDependsJavaParser.y" +#line 1345 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3800 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 151: -#line 1367 "cmDependsJavaParser.y" +#line 1355 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3812 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 152: -#line 1376 "cmDependsJavaParser.y" +#line 1364 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3824 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 153: -#line 1386 "cmDependsJavaParser.y" +#line 1374 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3836 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 154: -#line 1395 "cmDependsJavaParser.y" +#line 1383 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3848 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 155: -#line 1404 "cmDependsJavaParser.y" +#line 1392 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3860 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 156: -#line 1414 "cmDependsJavaParser.y" +#line 1402 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3872 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 157: -#line 1424 "cmDependsJavaParser.y" +#line 1412 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3884 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 158: -#line 1433 "cmDependsJavaParser.y" +#line 1421 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3896 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 159: -#line 1443 "cmDependsJavaParser.y" +#line 1431 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3908 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 160: -#line 1452 "cmDependsJavaParser.y" +#line 1440 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3920 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 161: -#line 1461 "cmDependsJavaParser.y" +#line 1449 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3932 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 162: -#line 1470 "cmDependsJavaParser.y" +#line 1458 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3944 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 163: -#line 1479 "cmDependsJavaParser.y" +#line 1467 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3956 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 164: -#line 1488 "cmDependsJavaParser.y" +#line 1476 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3968 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 165: -#line 1498 "cmDependsJavaParser.y" +#line 1486 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3980 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 166: -#line 1507 "cmDependsJavaParser.y" +#line 1495 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 3992 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 167: -#line 1516 "cmDependsJavaParser.y" +#line 1504 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4004 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 168: -#line 1525 "cmDependsJavaParser.y" +#line 1513 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4016 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 169: -#line 1534 "cmDependsJavaParser.y" +#line 1522 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4028 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 170: -#line 1544 "cmDependsJavaParser.y" +#line 1532 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4040 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 171: -#line 1553 "cmDependsJavaParser.y" +#line 1541 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4052 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 172: -#line 1562 "cmDependsJavaParser.y" +#line 1550 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4064 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 173: -#line 1571 "cmDependsJavaParser.y" +#line 1559 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4076 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 174: -#line 1580 "cmDependsJavaParser.y" +#line 1568 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4088 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 175: -#line 1589 "cmDependsJavaParser.y" +#line 1577 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4100 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 176: -#line 1598 "cmDependsJavaParser.y" +#line 1586 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4112 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 177: -#line 1607 "cmDependsJavaParser.y" +#line 1595 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4124 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 178: -#line 1616 "cmDependsJavaParser.y" +#line 1604 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4136 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 179: -#line 1625 "cmDependsJavaParser.y" +#line 1613 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4148 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 180: -#line 1634 "cmDependsJavaParser.y" +#line 1622 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4160 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 181: -#line 1643 "cmDependsJavaParser.y" +#line 1631 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4172 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 182: -#line 1653 "cmDependsJavaParser.y" +#line 1641 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4184 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 183: -#line 1663 "cmDependsJavaParser.y" +#line 1651 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); - yyGetParser->DeallocateParserType(&(yyvsp[-2].str)); + yyGetParser->DeallocateParserType(&((yyvsp[-2].str))); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4197 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 184: -#line 1674 "cmDependsJavaParser.y" +#line 1662 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4209 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 185: -#line 1684 "cmDependsJavaParser.y" +#line 1672 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4221 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 186: -#line 1694 "cmDependsJavaParser.y" +#line 1682 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4233 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 187: -#line 1703 "cmDependsJavaParser.y" +#line 1691 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4245 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 188: -#line 1712 "cmDependsJavaParser.y" +#line 1700 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4257 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 189: -#line 1721 "cmDependsJavaParser.y" +#line 1709 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4269 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 190: -#line 1730 "cmDependsJavaParser.y" +#line 1718 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4281 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 191: -#line 1739 "cmDependsJavaParser.y" +#line 1727 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4293 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 192: -#line 1748 "cmDependsJavaParser.y" +#line 1736 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4305 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 193: -#line 1758 "cmDependsJavaParser.y" +#line 1746 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); jpCheckEmpty(5); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4317 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 194: -#line 1768 "cmDependsJavaParser.y" +#line 1756 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(7); jpCheckEmpty(7); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4329 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 195: -#line 1778 "cmDependsJavaParser.y" +#line 1766 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(7); jpCheckEmpty(7); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4341 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 196: -#line 1788 "cmDependsJavaParser.y" +#line 1776 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); } +#line 4350 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 197: -#line 1795 "cmDependsJavaParser.y" +#line 1783 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); } +#line 4359 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 198: -#line 1801 "cmDependsJavaParser.y" +#line 1789 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4370 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 199: -#line 1809 "cmDependsJavaParser.y" +#line 1797 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4382 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 200: -#line 1818 "cmDependsJavaParser.y" +#line 1806 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4393 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 201: -#line 1826 "cmDependsJavaParser.y" +#line 1814 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4405 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 202: -#line 1836 "cmDependsJavaParser.y" +#line 1824 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4417 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 203: -#line 1846 "cmDependsJavaParser.y" +#line 1834 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4429 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 204: -#line 1855 "cmDependsJavaParser.y" +#line 1843 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4441 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 205: -#line 1865 "cmDependsJavaParser.y" +#line 1853 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4453 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 206: -#line 1874 "cmDependsJavaParser.y" +#line 1862 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4465 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 207: -#line 1884 "cmDependsJavaParser.y" +#line 1872 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); } +#line 4474 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 208: -#line 1891 "cmDependsJavaParser.y" +#line 1879 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); } +#line 4483 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 209: -#line 1898 "cmDependsJavaParser.y" +#line 1886 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(7); } +#line 4492 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 210: -#line 1906 "cmDependsJavaParser.y" +#line 1894 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(9); } +#line 4501 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 211: -#line 1912 "cmDependsJavaParser.y" +#line 1900 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4512 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 212: -#line 1920 "cmDependsJavaParser.y" +#line 1908 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4524 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 213: -#line 1929 "cmDependsJavaParser.y" +#line 1917 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4535 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 214: -#line 1937 "cmDependsJavaParser.y" +#line 1925 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4547 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 215: -#line 1948 "cmDependsJavaParser.y" +#line 1936 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(9); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4558 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 216: -#line 1956 "cmDependsJavaParser.y" +#line 1944 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4569 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 217: -#line 1964 "cmDependsJavaParser.y" +#line 1952 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4581 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 218: -#line 1974 "cmDependsJavaParser.y" +#line 1962 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4593 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 219: -#line 1983 "cmDependsJavaParser.y" +#line 1971 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4605 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 220: -#line 1993 "cmDependsJavaParser.y" +#line 1981 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4617 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 221: -#line 2003 "cmDependsJavaParser.y" +#line 1991 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4629 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 222: -#line 2012 "cmDependsJavaParser.y" +#line 2000 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4641 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 223: -#line 2022 "cmDependsJavaParser.y" +#line 2010 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4653 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 224: -#line 2031 "cmDependsJavaParser.y" +#line 2019 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); jpCheckEmpty(5); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4665 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 225: -#line 2041 "cmDependsJavaParser.y" +#line 2029 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); - yyGetParser->DeallocateParserType(&(yyvsp[-1].str)); + yyGetParser->DeallocateParserType(&((yyvsp[-1].str))); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4678 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 226: -#line 2051 "cmDependsJavaParser.y" +#line 2039 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4689 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 227: -#line 2059 "cmDependsJavaParser.y" +#line 2047 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); } +#line 4698 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 228: -#line 2066 "cmDependsJavaParser.y" +#line 2054 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); - yyGetParser->DeallocateParserType(&(yyvsp[-1].str)); + yyGetParser->DeallocateParserType(&((yyvsp[-1].str))); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4711 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 229: -#line 2077 "cmDependsJavaParser.y" +#line 2065 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4723 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 230: -#line 2087 "cmDependsJavaParser.y" +#line 2075 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4735 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 231: -#line 2097 "cmDependsJavaParser.y" +#line 2085 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); jpCheckEmpty(5); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4747 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 232: -#line 2107 "cmDependsJavaParser.y" +#line 2095 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4759 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 233: -#line 2116 "cmDependsJavaParser.y" +#line 2104 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4771 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 234: -#line 2125 "cmDependsJavaParser.y" +#line 2113 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4782 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 235: -#line 2133 "cmDependsJavaParser.y" +#line 2121 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4794 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 236: -#line 2143 "cmDependsJavaParser.y" +#line 2131 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4806 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 237: -#line 2152 "cmDependsJavaParser.y" +#line 2140 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4818 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 238: -#line 2162 "cmDependsJavaParser.y" +#line 2150 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); } +#line 4827 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 239: -#line 2169 "cmDependsJavaParser.y" +#line 2157 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4839 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 240: -#line 2179 "cmDependsJavaParser.y" +#line 2167 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4851 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 241: -#line 2188 "cmDependsJavaParser.y" +#line 2176 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4863 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 242: -#line 2198 "cmDependsJavaParser.y" +#line 2186 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4875 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 243: -#line 2207 "cmDependsJavaParser.y" +#line 2195 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); } +#line 4884 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 244: -#line 2213 "cmDependsJavaParser.y" +#line 2201 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4896 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 245: -#line 2222 "cmDependsJavaParser.y" +#line 2210 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4908 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 246: -#line 2231 "cmDependsJavaParser.y" +#line 2219 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4920 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 247: -#line 2240 "cmDependsJavaParser.y" +#line 2228 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4932 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 248: -#line 2249 "cmDependsJavaParser.y" +#line 2237 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4944 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 249: -#line 2259 "cmDependsJavaParser.y" +#line 2247 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(6); jpCheckEmpty(6); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4956 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 250: -#line 2268 "cmDependsJavaParser.y" +#line 2256 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4967 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 251: -#line 2276 "cmDependsJavaParser.y" +#line 2264 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4979 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 252: -#line 2285 "cmDependsJavaParser.y" +#line 2273 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 4990 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 253: -#line 2293 "cmDependsJavaParser.y" +#line 2281 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5002 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 254: -#line 2303 "cmDependsJavaParser.y" +#line 2291 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5014 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 255: -#line 2312 "cmDependsJavaParser.y" +#line 2300 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5026 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 256: -#line 2322 "cmDependsJavaParser.y" +#line 2310 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5038 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 257: -#line 2331 "cmDependsJavaParser.y" +#line 2319 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5050 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 258: -#line 2340 "cmDependsJavaParser.y" +#line 2328 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5062 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 259: -#line 2349 "cmDependsJavaParser.y" +#line 2337 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5074 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 260: -#line 2358 "cmDependsJavaParser.y" +#line 2346 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5085 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 261: -#line 2366 "cmDependsJavaParser.y" +#line 2354 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5097 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 262: -#line 2376 "cmDependsJavaParser.y" +#line 2364 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5109 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 263: -#line 2385 "cmDependsJavaParser.y" +#line 2373 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5121 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 264: -#line 2395 "cmDependsJavaParser.y" +#line 2383 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5133 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 265: -#line 2405 "cmDependsJavaParser.y" +#line 2393 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); } +#line 5142 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 266: -#line 2411 "cmDependsJavaParser.y" +#line 2399 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); } +#line 5151 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 267: -#line 2418 "cmDependsJavaParser.y" +#line 2406 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); - yyGetParser->DeallocateParserType(&(yyvsp[0].str)); + yyGetParser->DeallocateParserType(&((yyvsp[0].str))); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5164 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 268: -#line 2428 "cmDependsJavaParser.y" +#line 2416 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); - yyGetParser->DeallocateParserType(&(yyvsp[0].str)); + yyGetParser->DeallocateParserType(&((yyvsp[0].str))); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5177 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 269: -#line 2438 "cmDependsJavaParser.y" +#line 2426 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); - yyGetParser->DeallocateParserType(&(yyvsp[0].str)); + yyGetParser->DeallocateParserType(&((yyvsp[0].str))); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5190 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 270: -#line 2448 "cmDependsJavaParser.y" +#line 2436 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); - yyGetParser->DeallocateParserType(&(yyvsp[0].str)); + yyGetParser->DeallocateParserType(&((yyvsp[0].str))); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5203 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 271: -#line 2459 "cmDependsJavaParser.y" +#line 2447 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); - yyGetParser->DeallocateParserType(&(yyvsp[-3].str)); + yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); jpCheckEmpty(4); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5216 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 272: -#line 2469 "cmDependsJavaParser.y" +#line 2457 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(6); - yyGetParser->DeallocateParserType(&(yyvsp[-5].str)); - yyGetParser->DeallocateParserType(&(yyvsp[-3].str)); + yyGetParser->DeallocateParserType(&((yyvsp[-5].str))); + yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); jpCheckEmpty(6); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5230 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 273: -#line 2480 "cmDependsJavaParser.y" +#line 2468 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(6); - yyGetParser->DeallocateParserType(&(yyvsp[-3].str)); + yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); jpCheckEmpty(6); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5243 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 274: -#line 2490 "cmDependsJavaParser.y" +#line 2478 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(6); - yyGetParser->DeallocateParserType(&(yyvsp[-3].str)); + yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); jpCheckEmpty(6); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5256 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 275: -#line 2501 "cmDependsJavaParser.y" +#line 2489 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); - yyGetParser->DeallocateParserType(&(yyvsp[-3].str)); + yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); jpCheckEmpty(4); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5269 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 276: -#line 2511 "cmDependsJavaParser.y" +#line 2499 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5281 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 277: -#line 2521 "cmDependsJavaParser.y" +#line 2509 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5293 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 278: -#line 2530 "cmDependsJavaParser.y" +#line 2518 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); - yyGetParser->DeallocateParserType(&(yyvsp[0].str)); - yyval.str = 0; + yyGetParser->DeallocateParserType(&((yyvsp[0].str))); + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5305 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 279: -#line 2539 "cmDependsJavaParser.y" +#line 2527 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5317 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 280: -#line 2548 "cmDependsJavaParser.y" +#line 2536 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5329 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 281: -#line 2557 "cmDependsJavaParser.y" +#line 2545 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5341 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 282: -#line 2567 "cmDependsJavaParser.y" +#line 2555 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5353 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 283: -#line 2577 "cmDependsJavaParser.y" +#line 2565 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5365 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 284: -#line 2587 "cmDependsJavaParser.y" +#line 2575 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5377 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 285: -#line 2596 "cmDependsJavaParser.y" +#line 2584 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5389 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 286: -#line 2605 "cmDependsJavaParser.y" +#line 2593 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5401 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 287: -#line 2614 "cmDependsJavaParser.y" +#line 2602 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5413 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 288: -#line 2623 "cmDependsJavaParser.y" +#line 2611 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5425 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 289: -#line 2633 "cmDependsJavaParser.y" +#line 2621 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5437 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 290: -#line 2643 "cmDependsJavaParser.y" +#line 2631 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5449 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 291: -#line 2653 "cmDependsJavaParser.y" +#line 2641 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5461 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 292: -#line 2662 "cmDependsJavaParser.y" +#line 2650 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5473 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 293: -#line 2671 "cmDependsJavaParser.y" +#line 2659 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5485 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 294: -#line 2680 "cmDependsJavaParser.y" +#line 2668 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5497 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 295: -#line 2690 "cmDependsJavaParser.y" +#line 2678 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); jpCheckEmpty(5); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5509 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 296: -#line 2699 "cmDependsJavaParser.y" +#line 2687 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5521 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 297: -#line 2708 "cmDependsJavaParser.y" +#line 2696 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); } +#line 5530 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 298: -#line 2715 "cmDependsJavaParser.y" +#line 2703 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5542 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 299: -#line 2724 "cmDependsJavaParser.y" +#line 2712 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5554 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 300: -#line 2733 "cmDependsJavaParser.y" +#line 2721 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5566 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 301: -#line 2742 "cmDependsJavaParser.y" +#line 2730 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5578 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 302: -#line 2752 "cmDependsJavaParser.y" +#line 2740 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5590 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 303: -#line 2761 "cmDependsJavaParser.y" +#line 2749 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5602 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 304: -#line 2770 "cmDependsJavaParser.y" +#line 2758 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5614 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 305: -#line 2780 "cmDependsJavaParser.y" +#line 2768 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5626 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 306: -#line 2789 "cmDependsJavaParser.y" +#line 2777 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5638 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 307: -#line 2798 "cmDependsJavaParser.y" +#line 2786 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5650 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 308: -#line 2807 "cmDependsJavaParser.y" +#line 2795 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5662 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 309: -#line 2817 "cmDependsJavaParser.y" +#line 2805 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5674 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 310: -#line 2826 "cmDependsJavaParser.y" +#line 2814 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5686 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 311: -#line 2835 "cmDependsJavaParser.y" +#line 2823 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5698 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 312: -#line 2844 "cmDependsJavaParser.y" +#line 2832 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5710 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 313: -#line 2853 "cmDependsJavaParser.y" +#line 2841 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5722 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 314: -#line 2862 "cmDependsJavaParser.y" +#line 2850 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5734 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 315: -#line 2872 "cmDependsJavaParser.y" +#line 2860 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5746 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 316: -#line 2881 "cmDependsJavaParser.y" +#line 2869 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5758 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 317: -#line 2890 "cmDependsJavaParser.y" +#line 2878 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5770 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 318: -#line 2900 "cmDependsJavaParser.y" +#line 2888 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5782 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 319: -#line 2909 "cmDependsJavaParser.y" +#line 2897 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5794 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 320: -#line 2919 "cmDependsJavaParser.y" +#line 2907 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5806 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 321: -#line 2928 "cmDependsJavaParser.y" +#line 2916 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5818 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 322: -#line 2938 "cmDependsJavaParser.y" +#line 2926 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5830 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 323: -#line 2947 "cmDependsJavaParser.y" +#line 2935 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5842 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 324: -#line 2957 "cmDependsJavaParser.y" +#line 2945 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5854 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 325: -#line 2966 "cmDependsJavaParser.y" +#line 2954 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5866 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 326: -#line 2976 "cmDependsJavaParser.y" +#line 2964 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5878 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 327: -#line 2985 "cmDependsJavaParser.y" +#line 2973 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5890 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 328: -#line 2995 "cmDependsJavaParser.y" +#line 2983 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5902 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 329: -#line 3004 "cmDependsJavaParser.y" +#line 2992 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); jpCheckEmpty(5); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5914 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 330: -#line 3014 "cmDependsJavaParser.y" +#line 3002 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5926 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 331: -#line 3023 "cmDependsJavaParser.y" +#line 3011 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5938 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 332: -#line 3033 "cmDependsJavaParser.y" +#line 3021 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5950 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 333: -#line 3043 "cmDependsJavaParser.y" +#line 3031 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); - yyGetParser->DeallocateParserType(&(yyvsp[0].str)); + yyGetParser->DeallocateParserType(&((yyvsp[0].str))); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5963 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 334: -#line 3053 "cmDependsJavaParser.y" +#line 3041 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5975 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 335: -#line 3062 "cmDependsJavaParser.y" +#line 3050 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5987 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 336: -#line 3072 "cmDependsJavaParser.y" +#line 3060 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 5999 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 337: -#line 3081 "cmDependsJavaParser.y" +#line 3069 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 6011 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 338: -#line 3090 "cmDependsJavaParser.y" +#line 3078 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 6023 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 339: -#line 3099 "cmDependsJavaParser.y" +#line 3087 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 6035 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 340: -#line 3108 "cmDependsJavaParser.y" +#line 3096 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 6047 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 341: -#line 3117 "cmDependsJavaParser.y" +#line 3105 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 6059 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 342: -#line 3126 "cmDependsJavaParser.y" +#line 3114 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 6071 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 343: -#line 3135 "cmDependsJavaParser.y" +#line 3123 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 6083 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 344: -#line 3144 "cmDependsJavaParser.y" +#line 3132 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 6095 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 345: -#line 3153 "cmDependsJavaParser.y" +#line 3141 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 6107 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 346: -#line 3162 "cmDependsJavaParser.y" +#line 3150 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 6119 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 347: -#line 3171 "cmDependsJavaParser.y" +#line 3159 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 6131 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 348: -#line 3181 "cmDependsJavaParser.y" +#line 3169 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 6143 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 349: -#line 3191 "cmDependsJavaParser.y" +#line 3179 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 6155 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 350: -#line 3201 "cmDependsJavaParser.y" +#line 3189 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 6167 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 351: -#line 3210 "cmDependsJavaParser.y" +#line 3198 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); - jpStoreClass(yyvsp[-2].str); + jpStoreClass((yyvsp[-2].str)); jpCheckEmpty(3); - yyval.str = 0; + (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } +#line 6180 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; +#line 6184 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ + default: break; } - -/* Line 1010 of yacc.c. */ -#line 5780 "cmDependsJavaParser.cxx" - - yyvsp -= yylen; - yyssp -= yylen; - - + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; - - /* Now `shift' the result of the reduction. Determine what state + /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -5794,74 +6217,52 @@ yyreduce: goto yynewstate; -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; -#if YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (YYPACT_NINF < yyn && yyn < YYLAST) - { - YYSIZE_T yysize = 0; - int yytype = YYTRANSLATE (yychar); - const char* yyprefix; - char *yymsg; - int yyx; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 0; - - yyprefix = ", expecting "; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); - yycount += 1; - if (yycount == 5) - { - yysize = 0; - break; - } - } - yysize += (sizeof ("syntax error, unexpected ") - + yystrlen (yytname[yytype])); - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg != 0) +#if ! YYERROR_VERBOSE + yyerror (yyscanner, YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) { - char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); - yyp = yystpcpy (yyp, yytname[yytype]); - - if (yycount < 5) - { - yyprefix = ", expecting "; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) { - yyp = yystpcpy (yyp, yyprefix); - yyp = yystpcpy (yyp, yytname[yyx]); - yyprefix = " or "; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } } - } - yyerror (yymsg); - YYSTACK_FREE (yymsg); + yyerror (yyscanner, yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; } - else - yyerror ("syntax error; also virtual memory exhausted"); - } - else -#endif /* YYERROR_VERBOSE */ - yyerror ("syntax error"); +# undef YYSYNTAX_ERROR +#endif } @@ -5869,31 +6270,23 @@ yyerrlab: if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + error, discard it. */ if (yychar <= YYEOF) { - /* If at end of input, pop the error token, - then the rest of the stack, then return failure. */ - if (yychar == YYEOF) - for (;;) - { - YYPOPSTACK; - if (yyssp == yyss) - YYABORT; - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[*yyssp], yyvsp); - } + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; } else - { - YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); - yydestruct (yytoken, &yylval); - yychar = YYEMPTY; - - } + { + yydestruct ("Error: discarding", + yytoken, &yylval, yyscanner); + yychar = YYEMPTY; + } } +#if 0 /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -5904,15 +6297,17 @@ yyerrlab: `---------------------------------------------------*/ yyerrorlab: -#if defined(__GNUC__) || defined(__HP_aCC) - /* Pacify GCC when the user code never invokes YYERROR and the label - yyerrorlab therefore never appears in user code. */ - if (0) + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) goto yyerrorlab; -#endif - yyvsp -= yylen; - yyssp -= yylen; + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; @@ -5921,40 +6316,42 @@ yyerrorlab: | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ +#endif + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) - YYABORT; + YYABORT; - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[yystate], yyvsp); - YYPOPSTACK; + + yydestruct ("Error: popping", + yystos[yystate], yyvsp, yyscanner); + YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - - YYDPRINTF ((stderr, "Shifting error token, ")); - + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; @@ -5974,33 +6371,51 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow -/*----------------------------------------------. -| yyoverflowlab -- parser overflow comes here. | -`----------------------------------------------*/ -yyoverflowlab: - yyerror ("parser stack overflow"); +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (yyscanner, YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, yyscanner); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, yyscanner); + YYPOPSTACK (1); + } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif return yyresult; } - - -#line 3219 "cmDependsJavaParser.y" +#line 3207 "cmDependsJavaParser.y" /* yacc.c:1906 */ /* End of grammar */ /*--------------------------------------------------------------------------*/ -void cmDependsJavaError(yyscan_t yyscanner, const char* message) +void cmDependsJava_yyerror(yyscan_t yyscanner, const char* message) { yyGetParser->Error(message); } - - diff --git a/Source/cmDependsJavaParser.y b/Source/cmDependsJavaParser.y index 91ee7c8..150ac92 100644 --- a/Source/cmDependsJavaParser.y +++ b/Source/cmDependsJavaParser.y @@ -10,18 +10,16 @@ Run bison like this: bison --yacc --name-prefix=cmDependsJava_yy --defines=cmDependsJavaParserTokens.h -ocmDependsJavaParser.cxx cmDependsJavaParser.y Modify cmDependsJavaParser.cxx: - - remove TABs - - remove use of the 'register' storage class specifier - - add __HP_aCC to the #if test for yyerrorlab warning suppression + - "#if 0" out yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"] */ -/* Configure the parser to use a lexer object. */ -#define YYPARSE_PARAM yyscanner -#define YYLEX_PARAM yyscanner -#define YYERROR_VERBOSE 1 -#define cmDependsJava_yyerror(x) \ - cmDependsJavaError(yyscanner, x) +#include <cmConfigure.h> // IWYU pragma: keep + +#include <stdlib.h> +#include <string.h> +#include <string> + #define yyGetParser (cmDependsJava_yyget_extra(yyscanner)) /*-------------------------------------------------------------------------*/ @@ -32,10 +30,9 @@ Modify cmDependsJavaParser.cxx: /* Forward declare the lexer entry point. */ YY_DECL; -/* Internal utility functions. */ -static void cmDependsJavaError(yyscan_t yyscanner, const char* message); +/* Helper function to forward error callback from parser. */ +static void cmDependsJava_yyerror(yyscan_t yyscanner, const char* message); -#define YYDEBUG 1 #define YYMAXDEPTH 1000000 @@ -50,7 +47,13 @@ static void cmDependsJavaError(yyscan_t yyscanner, const char* message); %} /* Generate a reentrant parser object. */ -%pure_parser +%define api.pure + +/* Configure the parser to use a lexer object. */ +%lex-param {yyscan_t yyscanner} +%parse-param {yyscan_t yyscanner} + +%define parse.error verbose /* %union { @@ -3205,7 +3208,7 @@ Name jp_DOT jp_NEW /* End of grammar */ /*--------------------------------------------------------------------------*/ -void cmDependsJavaError(yyscan_t yyscanner, const char* message) +void cmDependsJava_yyerror(yyscan_t yyscanner, const char* message) { yyGetParser->Error(message); } diff --git a/Source/cmDependsJavaParserHelper.h b/Source/cmDependsJavaParserHelper.h index 71b939c..5f28f70 100644 --- a/Source/cmDependsJavaParserHelper.h +++ b/Source/cmDependsJavaParserHelper.h @@ -8,26 +8,18 @@ #include <string> #include <vector> -class cmDependsJavaParserHelper; - -#define YYSTYPE cmDependsJavaParserHelper::ParserType -#define YYSTYPE_IS_DECLARED -#define YY_EXTRA_TYPE cmDependsJavaParserHelper* -#define YY_DECL int cmDependsJava_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner) - /** \class cmDependsJavaParserHelper * \brief Helper class for parsing java source files * * Finds dependencies for java file and list of outputs */ - class cmDependsJavaParserHelper { public: - typedef struct + struct ParserType { char* str; - } ParserType; + }; cmDependsJavaParserHelper(); ~cmDependsJavaParserHelper(); @@ -96,4 +88,9 @@ private: void CleanupParser(); }; +#define YYSTYPE cmDependsJavaParserHelper::ParserType +#define YYSTYPE_IS_DECLARED +#define YY_EXTRA_TYPE cmDependsJavaParserHelper* +#define YY_DECL int cmDependsJava_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner) + #endif diff --git a/Source/cmDependsJavaParserTokens.h b/Source/cmDependsJavaParserTokens.h index c7a414f..7f18f1d 100644 --- a/Source/cmDependsJavaParserTokens.h +++ b/Source/cmDependsJavaParserTokens.h @@ -1,12 +1,13 @@ -/* A Bison parser, made by GNU Bison 1.875d. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ -/* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, - 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +/* Bison interface for Yacc-like parsers in C - This program is free software; you can redistribute it and/or modify + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -14,126 +15,142 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. -/* Tokens. */ + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +#ifndef YY_CMDEPENDSJAVA_YY_CMDEPENDSJAVAPARSERTOKENS_H_INCLUDED +# define YY_CMDEPENDSJAVA_YY_CMDEPENDSJAVAPARSERTOKENS_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int cmDependsJava_yydebug; +#endif + +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - jp_ABSTRACT = 258, - jp_ASSERT = 259, - jp_BOOLEAN_TYPE = 260, - jp_BREAK = 261, - jp_BYTE_TYPE = 262, - jp_CASE = 263, - jp_CATCH = 264, - jp_CHAR_TYPE = 265, - jp_CLASS = 266, - jp_CONTINUE = 267, - jp_DEFAULT = 268, - jp_DO = 269, - jp_DOUBLE_TYPE = 270, - jp_ELSE = 271, - jp_EXTENDS = 272, - jp_FINAL = 273, - jp_FINALLY = 274, - jp_FLOAT_TYPE = 275, - jp_FOR = 276, - jp_IF = 277, - jp_IMPLEMENTS = 278, - jp_IMPORT = 279, - jp_INSTANCEOF = 280, - jp_INT_TYPE = 281, - jp_INTERFACE = 282, - jp_LONG_TYPE = 283, - jp_NATIVE = 284, - jp_NEW = 285, - jp_PACKAGE = 286, - jp_PRIVATE = 287, - jp_PROTECTED = 288, - jp_PUBLIC = 289, - jp_RETURN = 290, - jp_SHORT_TYPE = 291, - jp_STATIC = 292, - jp_STRICTFP = 293, - jp_SUPER = 294, - jp_SWITCH = 295, - jp_SYNCHRONIZED = 296, - jp_THIS = 297, - jp_THROW = 298, - jp_THROWS = 299, - jp_TRANSIENT = 300, - jp_TRY = 301, - jp_VOID = 302, - jp_VOLATILE = 303, - jp_WHILE = 304, - jp_BOOLEANLITERAL = 305, - jp_CHARACTERLITERAL = 306, - jp_DECIMALINTEGERLITERAL = 307, - jp_FLOATINGPOINTLITERAL = 308, - jp_HEXINTEGERLITERAL = 309, - jp_NULLLITERAL = 310, - jp_STRINGLITERAL = 311, - jp_NAME = 312, - jp_AND = 313, - jp_ANDAND = 314, - jp_ANDEQUALS = 315, - jp_BRACKETEND = 316, - jp_BRACKETSTART = 317, - jp_CARROT = 318, - jp_CARROTEQUALS = 319, - jp_COLON = 320, - jp_COMMA = 321, - jp_CURLYEND = 322, - jp_CURLYSTART = 323, - jp_DIVIDE = 324, - jp_DIVIDEEQUALS = 325, - jp_DOLLAR = 326, - jp_DOT = 327, - jp_EQUALS = 328, - jp_EQUALSEQUALS = 329, - jp_EXCLAMATION = 330, - jp_EXCLAMATIONEQUALS = 331, - jp_GREATER = 332, - jp_GTEQUALS = 333, - jp_GTGT = 334, - jp_GTGTEQUALS = 335, - jp_GTGTGT = 336, - jp_GTGTGTEQUALS = 337, - jp_LESLESEQUALS = 338, - jp_LESSTHAN = 339, - jp_LTEQUALS = 340, - jp_LTLT = 341, - jp_MINUS = 342, - jp_MINUSEQUALS = 343, - jp_MINUSMINUS = 344, - jp_PAREEND = 345, - jp_PARESTART = 346, - jp_PERCENT = 347, - jp_PERCENTEQUALS = 348, - jp_PIPE = 349, - jp_PIPEEQUALS = 350, - jp_PIPEPIPE = 351, - jp_PLUS = 352, - jp_PLUSEQUALS = 353, - jp_PLUSPLUS = 354, - jp_QUESTION = 355, - jp_SEMICOL = 356, - jp_TILDE = 357, - jp_TIMES = 358, - jp_TIMESEQUALS = 359, - jp_ERROR = 360 - }; + enum yytokentype + { + jp_ABSTRACT = 258, + jp_ASSERT = 259, + jp_BOOLEAN_TYPE = 260, + jp_BREAK = 261, + jp_BYTE_TYPE = 262, + jp_CASE = 263, + jp_CATCH = 264, + jp_CHAR_TYPE = 265, + jp_CLASS = 266, + jp_CONTINUE = 267, + jp_DEFAULT = 268, + jp_DO = 269, + jp_DOUBLE_TYPE = 270, + jp_ELSE = 271, + jp_EXTENDS = 272, + jp_FINAL = 273, + jp_FINALLY = 274, + jp_FLOAT_TYPE = 275, + jp_FOR = 276, + jp_IF = 277, + jp_IMPLEMENTS = 278, + jp_IMPORT = 279, + jp_INSTANCEOF = 280, + jp_INT_TYPE = 281, + jp_INTERFACE = 282, + jp_LONG_TYPE = 283, + jp_NATIVE = 284, + jp_NEW = 285, + jp_PACKAGE = 286, + jp_PRIVATE = 287, + jp_PROTECTED = 288, + jp_PUBLIC = 289, + jp_RETURN = 290, + jp_SHORT_TYPE = 291, + jp_STATIC = 292, + jp_STRICTFP = 293, + jp_SUPER = 294, + jp_SWITCH = 295, + jp_SYNCHRONIZED = 296, + jp_THIS = 297, + jp_THROW = 298, + jp_THROWS = 299, + jp_TRANSIENT = 300, + jp_TRY = 301, + jp_VOID = 302, + jp_VOLATILE = 303, + jp_WHILE = 304, + jp_BOOLEANLITERAL = 305, + jp_CHARACTERLITERAL = 306, + jp_DECIMALINTEGERLITERAL = 307, + jp_FLOATINGPOINTLITERAL = 308, + jp_HEXINTEGERLITERAL = 309, + jp_NULLLITERAL = 310, + jp_STRINGLITERAL = 311, + jp_NAME = 312, + jp_AND = 313, + jp_ANDAND = 314, + jp_ANDEQUALS = 315, + jp_BRACKETEND = 316, + jp_BRACKETSTART = 317, + jp_CARROT = 318, + jp_CARROTEQUALS = 319, + jp_COLON = 320, + jp_COMMA = 321, + jp_CURLYEND = 322, + jp_CURLYSTART = 323, + jp_DIVIDE = 324, + jp_DIVIDEEQUALS = 325, + jp_DOLLAR = 326, + jp_DOT = 327, + jp_EQUALS = 328, + jp_EQUALSEQUALS = 329, + jp_EXCLAMATION = 330, + jp_EXCLAMATIONEQUALS = 331, + jp_GREATER = 332, + jp_GTEQUALS = 333, + jp_GTGT = 334, + jp_GTGTEQUALS = 335, + jp_GTGTGT = 336, + jp_GTGTGTEQUALS = 337, + jp_LESLESEQUALS = 338, + jp_LESSTHAN = 339, + jp_LTEQUALS = 340, + jp_LTLT = 341, + jp_MINUS = 342, + jp_MINUSEQUALS = 343, + jp_MINUSMINUS = 344, + jp_PAREEND = 345, + jp_PARESTART = 346, + jp_PERCENT = 347, + jp_PERCENTEQUALS = 348, + jp_PIPE = 349, + jp_PIPEEQUALS = 350, + jp_PIPEPIPE = 351, + jp_PLUS = 352, + jp_PLUSEQUALS = 353, + jp_PLUSPLUS = 354, + jp_QUESTION = 355, + jp_SEMICOL = 356, + jp_TILDE = 357, + jp_TIMES = 358, + jp_TIMESEQUALS = 359, + jp_ERROR = 360 + }; #endif +/* Tokens. */ #define jp_ABSTRACT 258 #define jp_ASSERT 259 #define jp_BOOLEAN_TYPE 260 @@ -238,17 +255,10 @@ #define jp_TIMESEQUALS 359 #define jp_ERROR 360 +/* Value type. */ -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -typedef int YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 -#endif - - - - +int cmDependsJava_yyparse (yyscan_t yyscanner); +#endif /* !YY_CMDEPENDSJAVA_YY_CMDEPENDSJAVAPARSERTOKENS_H_INCLUDED */ diff --git a/Source/cmDisallowedCommand.cxx b/Source/cmDisallowedCommand.cxx new file mode 100644 index 0000000..ce1965d --- /dev/null +++ b/Source/cmDisallowedCommand.cxx @@ -0,0 +1,31 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmDisallowedCommand.h" + +#include "cmMakefile.h" +#include "cmake.h" + +class cmExecutionStatus; + +bool cmDisallowedCommand::InitialPass(std::vector<std::string> const& args, + cmExecutionStatus& status) +{ + switch (this->Makefile->GetPolicyStatus(this->Policy)) { + case cmPolicies::WARN: + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, + cmPolicies::GetPolicyWarning(this->Policy)); + break; + case cmPolicies::OLD: + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + this->Makefile->IssueMessage(cmake::FATAL_ERROR, this->Message); + return true; + } + + this->Command->SetMakefile(this->GetMakefile()); + bool const ret = this->Command->InitialPass(args, status); + this->SetError(this->Command->GetError()); + return ret; +} diff --git a/Source/cmDisallowedCommand.h b/Source/cmDisallowedCommand.h new file mode 100644 index 0000000..00b0183 --- /dev/null +++ b/Source/cmDisallowedCommand.h @@ -0,0 +1,57 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmDisallowedCommand_h +#define cmDisallowedCommand_h + +#include <cmConfigure.h> +#include <string> +#include <vector> + +#include "cmCommand.h" +#include "cmPolicies.h" + +class cmExecutionStatus; + +class cmDisallowedCommand : public cmCommand +{ +public: + cmDisallowedCommand(cmCommand* command, cmPolicies::PolicyID policy, + const char* message) + : Command(command) + , Policy(policy) + , Message(message) + { + } + + ~cmDisallowedCommand() CM_OVERRIDE { delete this->Command; } + + cmCommand* Clone() CM_OVERRIDE + { + return new cmDisallowedCommand(this->Command->Clone(), this->Policy, + this->Message); + } + + bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus& status) CM_OVERRIDE; + + void FinalPass() CM_OVERRIDE { this->Command->FinalPass(); } + + bool HasFinalPass() const CM_OVERRIDE + { + return this->Command->HasFinalPass(); + } + + bool IsScriptable() const CM_OVERRIDE + { + return this->Command->IsScriptable(); + } + + std::string GetName() const CM_OVERRIDE { return this->Command->GetName(); } + +private: + cmCommand* Command; + cmPolicies::PolicyID Policy; + const char* Message; +}; + +#endif diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx index a30b642..39a59fc 100644 --- a/Source/cmDynamicLoader.cxx +++ b/Source/cmDynamicLoader.cxx @@ -4,7 +4,6 @@ #include <cmConfigure.h> -#include <cmsys/DynamicLoader.hxx> #include <map> #include <string> #include <utility> diff --git a/Source/cmDynamicLoader.h b/Source/cmDynamicLoader.h index d14f81e..5d69400 100644 --- a/Source/cmDynamicLoader.h +++ b/Source/cmDynamicLoader.h @@ -10,7 +10,7 @@ #include <cmConfigure.h> // IWYU pragma: keep -#include <cmsys/DynamicLoader.hxx> +#include "cmsys/DynamicLoader.hxx" // IWYU pragma: export class cmDynamicLoader { diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 8102276..09c01e9 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -279,7 +279,6 @@ bool cmExportCommand::HandlePackage(std::vector<std::string> const& args) #if defined(_WIN32) && !defined(__CYGWIN__) #include <windows.h> -#undef GetCurrentDirectory void cmExportCommand::ReportRegistryError(std::string const& msg, std::string const& key, long err) { diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h index 99dac7d..a0224d0 100644 --- a/Source/cmExportCommand.h +++ b/Source/cmExportCommand.h @@ -41,6 +41,7 @@ public: std::string GetName() const CM_OVERRIDE { return "export"; } private: + cmCommandArgumentsHelper Helper; cmCommandArgumentGroup ArgumentGroup; cmCAStringVector Targets; cmCAEnabler Append; diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 64ea3c8..3b76a87 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -195,8 +195,10 @@ void cmExportInstallFileGenerator::GenerateImportPrefix(std::ostream& os) << " \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n"; if (cmHasLiteralPrefix(absDestS.c_str(), "/lib/") || cmHasLiteralPrefix(absDestS.c_str(), "/lib64/") || + cmHasLiteralPrefix(absDestS.c_str(), "/libx32/") || cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib/") || - cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib64/")) { + cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib64/") || + cmHasLiteralPrefix(absDestS.c_str(), "/usr/libx32/")) { // Handle "/usr move" symlinks created by some Linux distros. /* clang-format off */ os << diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index ac4f040..deecad8 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -9,7 +9,6 @@ #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" -#include "cmPolicies.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" @@ -23,12 +22,6 @@ class cmExecutionStatus; bool cmExportLibraryDependenciesCommand::InitialPass( std::vector<std::string> const& args, cmExecutionStatus&) { - if (this->Disallowed( - cmPolicies::CMP0033, - "The export_library_dependencies command should not be called; " - "see CMP0033.")) { - return true; - } if (args.empty()) { this->SetError("called with incorrect number of arguments"); return false; diff --git a/Source/cmExprParser.cxx b/Source/cmExprParser.cxx index d11d0b6..a9088a6 100644 --- a/Source/cmExprParser.cxx +++ b/Source/cmExprParser.cxx @@ -85,14 +85,17 @@ Modify cmExprParser.cxx: */ +#include <cmConfigure.h> // IWYU pragma: keep + +#include <stdlib.h> +#include <string.h> + /*-------------------------------------------------------------------------*/ #define YYDEBUG 1 #include "cmExprParserHelper.h" /* Interface to parser object. */ #include "cmExprLexer.h" /* Interface to lexer object. */ #include "cmExprParserTokens.h" /* Need YYSTYPE for YY_DECL. */ -#include <math.h> - /* Forward declare the lexer entry point. */ YY_DECL; @@ -105,7 +108,7 @@ static void cmExpr_yyerror(yyscan_t yyscanner, const char* message); # pragma warning (disable: 4065) /* Switch statement contains default but no case. */ #endif -#line 109 "cmExprParser.cxx" /* yacc.c:339 */ +#line 112 "cmExprParser.cxx" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus @@ -182,7 +185,7 @@ int cmExpr_yyparse (yyscan_t yyscanner); /* Copy the second part of user declarations. */ -#line 186 "cmExprParser.cxx" /* yacc.c:358 */ +#line 189 "cmExprParser.cxx" /* yacc.c:358 */ #ifdef short # undef short @@ -481,9 +484,9 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 70, 70, 75, 78, 83, 86, 91, 94, 99, - 102, 105, 110, 113, 116, 121, 124, 127, 130, 135, - 138, 141, 146, 149 + 0, 73, 73, 78, 81, 86, 89, 94, 97, 102, + 105, 108, 113, 116, 119, 124, 127, 130, 133, 138, + 141, 144, 149, 152 }; #endif @@ -1278,183 +1281,183 @@ yyreduce: switch (yyn) { case 2: -#line 70 "cmExprParser.y" /* yacc.c:1646 */ +#line 73 "cmExprParser.y" /* yacc.c:1646 */ { cmExpr_yyget_extra(yyscanner)->SetResult((yyvsp[0].Number)); } -#line 1286 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1289 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 3: -#line 75 "cmExprParser.y" /* yacc.c:1646 */ +#line 78 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1294 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1297 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 4: -#line 78 "cmExprParser.y" /* yacc.c:1646 */ +#line 81 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) | (yyvsp[0].Number); } -#line 1302 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1305 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 5: -#line 83 "cmExprParser.y" /* yacc.c:1646 */ +#line 86 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1310 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1313 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 6: -#line 86 "cmExprParser.y" /* yacc.c:1646 */ +#line 89 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) ^ (yyvsp[0].Number); } -#line 1318 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1321 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 7: -#line 91 "cmExprParser.y" /* yacc.c:1646 */ +#line 94 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1326 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1329 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 8: -#line 94 "cmExprParser.y" /* yacc.c:1646 */ +#line 97 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) & (yyvsp[0].Number); } -#line 1334 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1337 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 9: -#line 99 "cmExprParser.y" /* yacc.c:1646 */ +#line 102 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1342 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1345 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 10: -#line 102 "cmExprParser.y" /* yacc.c:1646 */ +#line 105 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) << (yyvsp[0].Number); } -#line 1350 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1353 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 11: -#line 105 "cmExprParser.y" /* yacc.c:1646 */ +#line 108 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) >> (yyvsp[0].Number); } -#line 1358 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1361 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 12: -#line 110 "cmExprParser.y" /* yacc.c:1646 */ +#line 113 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1366 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1369 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 13: -#line 113 "cmExprParser.y" /* yacc.c:1646 */ +#line 116 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) + (yyvsp[0].Number); } -#line 1374 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1377 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 14: -#line 116 "cmExprParser.y" /* yacc.c:1646 */ +#line 119 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) - (yyvsp[0].Number); } -#line 1382 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1385 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 15: -#line 121 "cmExprParser.y" /* yacc.c:1646 */ +#line 124 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1390 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1393 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 16: -#line 124 "cmExprParser.y" /* yacc.c:1646 */ +#line 127 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) * (yyvsp[0].Number); } -#line 1398 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1401 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 17: -#line 127 "cmExprParser.y" /* yacc.c:1646 */ +#line 130 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) / (yyvsp[0].Number); } -#line 1406 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1409 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 18: -#line 130 "cmExprParser.y" /* yacc.c:1646 */ +#line 133 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) % (yyvsp[0].Number); } -#line 1414 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1417 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 19: -#line 135 "cmExprParser.y" /* yacc.c:1646 */ +#line 138 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1422 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1425 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 20: -#line 138 "cmExprParser.y" /* yacc.c:1646 */ +#line 141 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = + (yyvsp[0].Number); } -#line 1430 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1433 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 21: -#line 141 "cmExprParser.y" /* yacc.c:1646 */ +#line 144 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = - (yyvsp[0].Number); } -#line 1438 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1441 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 22: -#line 146 "cmExprParser.y" /* yacc.c:1646 */ +#line 149 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1446 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1449 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 23: -#line 149 "cmExprParser.y" /* yacc.c:1646 */ +#line 152 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-1].Number); } -#line 1454 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1457 "cmExprParser.cxx" /* yacc.c:1646 */ break; -#line 1458 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1461 "cmExprParser.cxx" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1684,7 +1687,7 @@ yyreturn: #endif return yyresult; } -#line 154 "cmExprParser.y" /* yacc.c:1906 */ +#line 157 "cmExprParser.y" /* yacc.c:1906 */ /* End of grammar */ diff --git a/Source/cmExprParser.y b/Source/cmExprParser.y index c7c4a7b..0429663 100644 --- a/Source/cmExprParser.y +++ b/Source/cmExprParser.y @@ -14,14 +14,17 @@ Modify cmExprParser.cxx: */ +#include <cmConfigure.h> // IWYU pragma: keep + +#include <stdlib.h> +#include <string.h> + /*-------------------------------------------------------------------------*/ #define YYDEBUG 1 #include "cmExprParserHelper.h" /* Interface to parser object. */ #include "cmExprLexer.h" /* Interface to lexer object. */ #include "cmExprParserTokens.h" /* Need YYSTYPE for YY_DECL. */ -#include <math.h> - /* Forward declare the lexer entry point. */ YY_DECL; diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h index 8f00f1d..df365fc 100644 --- a/Source/cmExprParserHelper.h +++ b/Source/cmExprParserHelper.h @@ -8,23 +8,13 @@ #include <string> #include <vector> -#define YYSTYPE cmExprParserHelper::ParserType -#define YYSTYPE_IS_DECLARED -#define YY_EXTRA_TYPE cmExprParserHelper* -#define YY_DECL int cmExpr_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner) - -/** \class cmExprParserHelper - * \brief Helper class for parsing java source files - * - * Finds dependencies for java file and list of outputs - */ class cmExprParserHelper { public: - typedef struct + struct ParserType { int Number; - } ParserType; + }; cmExprParserHelper(); ~cmExprParserHelper(); @@ -57,4 +47,9 @@ private: std::string ErrorString; }; +#define YYSTYPE cmExprParserHelper::ParserType +#define YYSTYPE_IS_DECLARED +#define YY_EXTRA_TYPE cmExprParserHelper* +#define YY_DECL int cmExpr_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner) + #endif diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index fd7da18..856d42e 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -349,6 +349,87 @@ void cmExtraCodeLiteGenerator::FindMatchingHeaderfiles( } } +void cmExtraCodeLiteGenerator::CreateFoldersAndFiles( + std::set<std::string>& cFiles, cmXMLWriter& xml, + const std::string& projectPath) +{ + std::vector<std::string> tmp_path; + std::vector<std::string> components; + size_t numOfEndEl = 0; + + for (std::set<std::string>::const_iterator it = cFiles.begin(); + it != cFiles.end(); ++it) { + std::string frelapath = + cmSystemTools::RelativePath(projectPath.c_str(), it->c_str()); + cmsys::SystemTools::SplitPath(frelapath, components, false); + components.pop_back(); // erase last member -> it is file, not folder + components.erase(components.begin()); // erase "root" + + size_t sizeOfSkip = 0; + + for (size_t i = 0; i < components.size(); ++i) { + // skip relative path + if (components[i] == ".." || components[i] == ".") { + sizeOfSkip++; + continue; + } + + // same folder + if (tmp_path.size() > i - sizeOfSkip && + tmp_path[i - sizeOfSkip] == components[i]) { + continue; + } + + // delete "old" subfolders + if (tmp_path.size() > i - sizeOfSkip) { + numOfEndEl = tmp_path.size() - i + sizeOfSkip; + tmp_path.erase(tmp_path.end() - numOfEndEl, tmp_path.end()); + for (; numOfEndEl--;) { + xml.EndElement(); + } + } + + // add folder + xml.StartElement("VirtualDirectory"); + xml.Attribute("Name", components[i]); + tmp_path.push_back(components[i]); + } + + // delete "old" subfolders + numOfEndEl = tmp_path.size() - components.size() + sizeOfSkip; + if (numOfEndEl) { + tmp_path.erase(tmp_path.end() - numOfEndEl, tmp_path.end()); + for (; numOfEndEl--;) { + xml.EndElement(); + } + } + + // add file + xml.StartElement("File"); + xml.Attribute("Name", frelapath); + xml.EndElement(); + } + + // end of folders + numOfEndEl = tmp_path.size(); + for (; numOfEndEl--;) { + xml.EndElement(); + } +} + +void cmExtraCodeLiteGenerator::CreateFoldersAndFiles( + std::map<std::string, cmSourceFile*>& cFiles, cmXMLWriter& xml, + const std::string& projectPath) +{ + std::set<std::string> s; + for (std::map<std::string, cmSourceFile*>::const_iterator it = + cFiles.begin(); + it != cFiles.end(); ++it) { + s.insert(it->first); + } + this->CreateFoldersAndFiles(s, xml, projectPath); +} + void cmExtraCodeLiteGenerator::CreateProjectSourceEntries( std::map<std::string, cmSourceFile*>& cFiles, std::set<std::string>& otherFiles, cmXMLWriter* _xml, @@ -366,26 +447,12 @@ void cmExtraCodeLiteGenerator::CreateProjectSourceEntries( // insert all source files in the codelite project // first the C/C++ implementation files, then all others - for (std::map<std::string, cmSourceFile*>::const_iterator sit = - cFiles.begin(); - sit != cFiles.end(); ++sit) { - xml.StartElement("File"); - std::string fpath(sit->first); - std::string frelapath = - cmSystemTools::RelativePath(projectPath.c_str(), sit->first.c_str()); - xml.Attribute("Name", frelapath); - xml.EndElement(); - } + this->CreateFoldersAndFiles(cFiles, xml, projectPath); xml.EndElement(); // VirtualDirectory + xml.StartElement("VirtualDirectory"); xml.Attribute("Name", "include"); - for (std::set<std::string>::const_iterator sit = otherFiles.begin(); - sit != otherFiles.end(); ++sit) { - xml.StartElement("File"); - xml.Attribute( - "Name", cmSystemTools::RelativePath(projectPath.c_str(), sit->c_str())); - xml.EndElement(); - } + this->CreateFoldersAndFiles(otherFiles, xml, projectPath); xml.EndElement(); // VirtualDirectory // Get the number of CPUs. We use this information for the make -jN diff --git a/Source/cmExtraCodeLiteGenerator.h b/Source/cmExtraCodeLiteGenerator.h index 773515d..3263eb6 100644 --- a/Source/cmExtraCodeLiteGenerator.h +++ b/Source/cmExtraCodeLiteGenerator.h @@ -50,6 +50,10 @@ protected: const cmMakefile* mf, const std::string& projectType, const std::string& targetName); + void CreateFoldersAndFiles(std::set<std::string>& cFiles, cmXMLWriter& xml, + const std::string& projectPath); + void CreateFoldersAndFiles(std::map<std::string, cmSourceFile*>& cFiles, + cmXMLWriter& xml, const std::string& projectPath); public: cmExtraCodeLiteGenerator(); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 91cecb3..63012a5 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -16,10 +16,6 @@ #include <stdlib.h> #include <string.h> -#include <sys/types.h> -// include sys/stat.h after sys/types.h -#include <sys/stat.h> - #include "cmAlgorithms.h" #include "cmCommandArgumentsHelper.h" #include "cmCryptoHash.h" @@ -35,11 +31,17 @@ #include "cmSystemTools.h" #include "cmTimestamp.h" #include "cm_auto_ptr.hxx" +#include "cm_sys_stat.h" #include "cmake.h" #if defined(CMAKE_BUILD_WITH_CMAKE) #include "cmCurl.h" #include "cmFileLockResult.h" +#include <cm_curl.h> +#endif + +#if defined(CMAKE_USE_ELF_PARSER) +#include "cmELF.h" #endif class cmSystemToolsFileTime; @@ -166,6 +168,9 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args, if (subCommand == "RPATH_REMOVE") { return this->HandleRPathRemoveCommand(args); } + if (subCommand == "READ_ELF") { + return this->HandleReadElfCommand(args); + } if (subCommand == "RELATIVE_PATH") { return this->HandleRelativePathCommand(args); } @@ -1024,8 +1029,6 @@ protected: { } }; - struct MatchRule; - friend struct MatchRule; struct MatchRule { cmsys::RegularExpression Regex; @@ -1482,6 +1485,9 @@ bool cmFileCopier::InstallSymlink(const char* fromFile, const char* toFile) // Remove the destination file so we can always create the symlink. cmSystemTools::RemoveFile(toFile); + // Create destination directory if it doesn't exist + cmSystemTools::MakeDirectory(cmSystemTools::GetFilenamePath(toFile)); + // Create the symlink. if (!cmSystemTools::CreateSymlink(symlinkTarget, toFile)) { std::ostringstream e; @@ -2177,6 +2183,68 @@ bool cmFileCommand::HandleRPathCheckCommand( return true; } +bool cmFileCommand::HandleReadElfCommand(std::vector<std::string> const& args) +{ + if (args.size() < 4) { + this->SetError("READ_ELF must be called with at least three additional " + "arguments."); + return false; + } + + cmCommandArgumentsHelper argHelper; + cmCommandArgumentGroup group; + + cmCAString readArg(&argHelper, "READ_ELF"); + cmCAString fileNameArg(&argHelper, CM_NULLPTR); + + cmCAString rpathArg(&argHelper, "RPATH", &group); + cmCAString runpathArg(&argHelper, "RUNPATH", &group); + cmCAString errorArg(&argHelper, "CAPTURE_ERROR", &group); + + readArg.Follows(CM_NULLPTR); + fileNameArg.Follows(&readArg); + group.Follows(&fileNameArg); + argHelper.Parse(&args, CM_NULLPTR); + + if (!cmSystemTools::FileExists(fileNameArg.GetString(), true)) { + std::ostringstream e; + e << "READ_ELF given FILE \"" << fileNameArg.GetString() + << "\" that does not exist."; + this->SetError(e.str()); + return false; + } + +#if defined(CMAKE_USE_ELF_PARSER) + cmELF elf(fileNameArg.GetCString()); + + if (!rpathArg.GetString().empty()) { + if (cmELF::StringEntry const* se_rpath = elf.GetRPath()) { + std::string rpath(se_rpath->Value); + std::replace(rpath.begin(), rpath.end(), ':', ';'); + this->Makefile->AddDefinition(rpathArg.GetString(), rpath.c_str()); + } + } + if (!runpathArg.GetString().empty()) { + if (cmELF::StringEntry const* se_runpath = elf.GetRunPath()) { + std::string runpath(se_runpath->Value); + std::replace(runpath.begin(), runpath.end(), ':', ';'); + this->Makefile->AddDefinition(runpathArg.GetString(), runpath.c_str()); + } + } + + return true; +#else + std::string error = "ELF parser not available on this platform."; + if (errorArg.GetString().empty()) { + this->SetError(error); + return false; + } else { + this->Makefile->AddDefinition(errorArg.GetString(), error.c_str()); + return true; + } +#endif +} + bool cmFileCommand::HandleInstallCommand(std::vector<std::string> const& args) { cmFileInstaller installer(this); diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index 319864c..2d82a23 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -53,6 +53,7 @@ protected: bool HandleRelativePathCommand(std::vector<std::string> const& args); bool HandleCMakePathCommand(std::vector<std::string> const& args, bool nativePath); + bool HandleReadElfCommand(std::vector<std::string> const& args); bool HandleRPathChangeCommand(std::vector<std::string> const& args); bool HandleRPathCheckCommand(std::vector<std::string> const& args); bool HandleRPathRemoveCommand(std::vector<std::string> const& args); diff --git a/Source/cmFileMonitor.h b/Source/cmFileMonitor.h index 48169b8..2957328 100644 --- a/Source/cmFileMonitor.h +++ b/Source/cmFileMonitor.h @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #pragma once +#include <cmConfigure.h> // IWYU pragma: keep + #include <functional> #include <string> #include <vector> diff --git a/Source/cmFilePathChecksum.cxx b/Source/cmFilePathChecksum.cxx index 3d8b695..62f52e5 100644 --- a/Source/cmFilePathChecksum.cxx +++ b/Source/cmFilePathChecksum.cxx @@ -45,7 +45,7 @@ void cmFilePathChecksum::setupParentDirs(const std::string& currentSrcDir, parentDirs[3].second = "ProjectBinary"; } -std::string cmFilePathChecksum::get(const std::string& filePath) +std::string cmFilePathChecksum::get(const std::string& filePath) const { std::string relPath; std::string relSeed; @@ -82,7 +82,7 @@ std::string cmFilePathChecksum::get(const std::string& filePath) } std::string cmFilePathChecksum::getPart(const std::string& filePath, - size_t length) + size_t length) const { return get(filePath).substr(0, length); } diff --git a/Source/cmFilePathChecksum.h b/Source/cmFilePathChecksum.h index df19053..59ca34c 100644 --- a/Source/cmFilePathChecksum.h +++ b/Source/cmFilePathChecksum.h @@ -47,13 +47,13 @@ public: /* @brief Calculates the path checksum for the parent directory of a file * */ - std::string get(const std::string& filePath); + std::string get(const std::string& filePath) const; /* @brief Same as get() but returns only the first length characters * */ std::string getPart(const std::string& filePath, - size_t length = partLengthDefault); + size_t length = partLengthDefault) const; private: /// Size of the parent directory list diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeComparison.cxx index 991ebb8..ef4337b 100644 --- a/Source/cmFileTimeComparison.cxx +++ b/Source/cmFileTimeComparison.cxx @@ -10,7 +10,7 @@ // Use a platform-specific API to get file times efficiently. #if !defined(_WIN32) || defined(__CYGWIN__) -#include <sys/stat.h> +#include "cm_sys_stat.h" #define cmFileTimeComparison_Type struct stat #else #include <cmsys/Encoding.hxx> diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index c86f9c1..e92d672 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -43,20 +43,29 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn, return true; } - if (this->Makefile->GetState()->GetGlobalPropertyAsBool( - "FIND_LIBRARY_USE_LIB32_PATHS")) { - // add special 32 bit paths if this is a 32 bit compile. - if (this->Makefile->PlatformIs32Bit()) { - this->AddArchitecturePaths("32"); - } + // add custom lib<qual> paths instead of using fixed lib32, lib64 or + // libx32 + if (const char* customLib = this->Makefile->GetDefinition( + "CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX")) { + this->AddArchitecturePaths(customLib); } - - if (this->Makefile->GetState()->GetGlobalPropertyAsBool( - "FIND_LIBRARY_USE_LIB64_PATHS")) { - // add special 64 bit paths if this is a 64 bit compile. - if (this->Makefile->PlatformIs64Bit()) { - this->AddArchitecturePaths("64"); - } + // add special 32 bit paths if this is a 32 bit compile. + else if (this->Makefile->PlatformIs32Bit() && + this->Makefile->GetState()->GetGlobalPropertyAsBool( + "FIND_LIBRARY_USE_LIB32_PATHS")) { + this->AddArchitecturePaths("32"); + } + // add special 64 bit paths if this is a 64 bit compile. + else if (this->Makefile->PlatformIs64Bit() && + this->Makefile->GetState()->GetGlobalPropertyAsBool( + "FIND_LIBRARY_USE_LIB64_PATHS")) { + this->AddArchitecturePaths("64"); + } + // add special 32 bit paths if this is an x32 compile. + else if (this->Makefile->PlatformIsx32() && + this->Makefile->GetState()->GetGlobalPropertyAsBool( + "FIND_LIBRARY_USE_LIBX32_PATHS")) { + this->AddArchitecturePaths("x32"); } std::string library = this->FindLibrary(); diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 60de74f..fe4cc54 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -92,6 +92,7 @@ cmFindPackageCommand::cmFindPackageCommand() this->DebugMode = false; this->UseLib32Paths = false; this->UseLib64Paths = false; + this->UseLibx32Paths = false; this->PolicyScope = true; this->VersionMajor = 0; this->VersionMinor = 0; @@ -173,6 +174,13 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args, this->UseLib64Paths = true; } + // Lookup whether libx32 paths should be used. + if (this->Makefile->PlatformIsx32() && + this->Makefile->GetState()->GetGlobalPropertyAsBool( + "FIND_LIBRARY_USE_LIBX32_PATHS")) { + this->UseLibx32Paths = true; + } + // Check if User Package Registry should be disabled if (this->Makefile->IsOn("CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY")) { this->NoUserRegistry = true; @@ -1165,7 +1173,6 @@ void cmFindPackageCommand::FillPrefixesSystemRegistry() #if defined(_WIN32) && !defined(__CYGWIN__) #include <windows.h> -#undef GetCurrentDirectory // http://msdn.microsoft.com/en-us/library/aa384253%28v=vs.85%29.aspx #if !defined(KEY_WOW64_32KEY) #define KEY_WOW64_32KEY 0x0200 @@ -2002,6 +2009,9 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in) if (this->UseLib64Paths) { common.push_back("lib64"); } + if (this->UseLibx32Paths) { + common.push_back("libx32"); + } common.push_back("lib"); common.push_back("share"); diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index d454892..61a8dd6 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -169,6 +169,7 @@ private: bool DebugMode; bool UseLib32Paths; bool UseLib64Paths; + bool UseLibx32Paths; bool PolicyScope; std::string LibraryArchitecture; std::vector<std::string> Names; diff --git a/Source/cmFortranParser.cxx b/Source/cmFortranParser.cxx index 896e589..c67227f 100644 --- a/Source/cmFortranParser.cxx +++ b/Source/cmFortranParser.cxx @@ -97,13 +97,17 @@ Modify cmFortranParser.cxx: - "#if 0" out yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"] */ +#include <cmConfigure.h> // IWYU pragma: keep + +#include <cmsys/String.h> +#include <stdlib.h> +#include <string.h> + /*-------------------------------------------------------------------------*/ #define cmFortranParser_cxx #include "cmFortranParser.h" /* Interface to parser object. */ #include "cmFortranParserTokens.h" /* Need YYSTYPE for YY_DECL. */ -#include <cmsys/String.h> - /* Forward declare the lexer entry point. */ YY_DECL; @@ -124,7 +128,7 @@ static void cmFortran_yyerror(yyscan_t yyscanner, const char* message) # pragma warning (disable: 4244) /* Conversion to smaller type, data loss. */ #endif -#line 137 "cmFortranParser.cxx" /* yacc.c:339 */ +#line 132 "cmFortranParser.cxx" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus @@ -244,11 +248,11 @@ extern int cmFortran_yydebug; union YYSTYPE { -#line 75 "cmFortranParser.y" /* yacc.c:355 */ +#line 70 "cmFortranParser.y" /* yacc.c:355 */ char* string; -#line 261 "cmFortranParser.cxx" /* yacc.c:355 */ +#line 256 "cmFortranParser.cxx" /* yacc.c:355 */ }; typedef union YYSTYPE YYSTYPE; @@ -264,7 +268,7 @@ int cmFortran_yyparse (yyscan_t yyscanner); /* Copy the second part of user declarations. */ -#line 277 "cmFortranParser.cxx" /* yacc.c:358 */ +#line 272 "cmFortranParser.cxx" /* yacc.c:358 */ #ifdef short # undef short @@ -565,13 +569,13 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 103, 103, 103, 106, 110, 115, 124, 130, 137, - 142, 146, 151, 159, 164, 169, 174, 179, 184, 189, - 194, 199, 203, 207, 211, 215, 216, 221, 221, 221, - 222, 222, 223, 223, 224, 224, 225, 225, 226, 226, - 227, 227, 228, 228, 229, 229, 230, 230, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248 + 0, 98, 98, 98, 101, 105, 110, 119, 125, 132, + 137, 141, 146, 154, 159, 164, 169, 174, 179, 184, + 189, 194, 198, 202, 206, 210, 211, 216, 216, 216, + 217, 217, 218, 218, 219, 219, 220, 220, 221, 221, + 222, 222, 223, 223, 224, 224, 225, 225, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243 }; #endif @@ -1523,26 +1527,26 @@ yyreduce: switch (yyn) { case 4: -#line 106 "cmFortranParser.y" /* yacc.c:1646 */ +#line 101 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_SetInInterface(parser, true); } -#line 1541 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1536 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 5: -#line 110 "cmFortranParser.y" /* yacc.c:1646 */ +#line 105 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1551 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1546 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 6: -#line 115 "cmFortranParser.y" /* yacc.c:1646 */ +#line 110 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); if (cmsysString_strcasecmp((yyvsp[-2].string), "function") != 0 && @@ -1552,22 +1556,22 @@ yyreduce: } free((yyvsp[-2].string)); } -#line 1565 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1560 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 7: -#line 124 "cmFortranParser.y" /* yacc.c:1646 */ +#line 119 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUse(parser, (yyvsp[-4].string)); free((yyvsp[-4].string)); free((yyvsp[-2].string)); } -#line 1576 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1571 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 8: -#line 130 "cmFortranParser.y" /* yacc.c:1646 */ +#line 125 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUse(parser, (yyvsp[-6].string)); @@ -1575,40 +1579,40 @@ yyreduce: free((yyvsp[-4].string)); free((yyvsp[-2].string)); } -#line 1588 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1583 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 9: -#line 137 "cmFortranParser.y" /* yacc.c:1646 */ +#line 132 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_SetInInterface(parser, true); free((yyvsp[-2].string)); } -#line 1598 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1593 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 10: -#line 142 "cmFortranParser.y" /* yacc.c:1646 */ +#line 137 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_SetInInterface(parser, false); } -#line 1607 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1602 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 11: -#line 146 "cmFortranParser.y" /* yacc.c:1646 */ +#line 141 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1617 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1612 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 12: -#line 151 "cmFortranParser.y" /* yacc.c:1646 */ +#line 146 "cmFortranParser.y" /* yacc.c:1646 */ { if (cmsysString_strcasecmp((yyvsp[-4].string), "non_intrinsic") == 0) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); @@ -1617,139 +1621,139 @@ yyreduce: free((yyvsp[-4].string)); free((yyvsp[-2].string)); } -#line 1630 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1625 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 13: -#line 159 "cmFortranParser.y" /* yacc.c:1646 */ +#line 154 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1640 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1635 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 14: -#line 164 "cmFortranParser.y" /* yacc.c:1646 */ +#line 159 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleLineDirective(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1650 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1645 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 15: -#line 169 "cmFortranParser.y" /* yacc.c:1646 */ +#line 164 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1660 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1655 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 16: -#line 174 "cmFortranParser.y" /* yacc.c:1646 */ +#line 169 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1670 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1665 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 17: -#line 179 "cmFortranParser.y" /* yacc.c:1646 */ +#line 174 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleDefine(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1680 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1675 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 18: -#line 184 "cmFortranParser.y" /* yacc.c:1646 */ +#line 179 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUndef(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1690 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1685 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 19: -#line 189 "cmFortranParser.y" /* yacc.c:1646 */ +#line 184 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIfdef(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1700 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1695 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 20: -#line 194 "cmFortranParser.y" /* yacc.c:1646 */ +#line 189 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIfndef(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1710 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1705 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 21: -#line 199 "cmFortranParser.y" /* yacc.c:1646 */ +#line 194 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIf(parser); } -#line 1719 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1714 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 22: -#line 203 "cmFortranParser.y" /* yacc.c:1646 */ +#line 198 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleElif(parser); } -#line 1728 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1723 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 23: -#line 207 "cmFortranParser.y" /* yacc.c:1646 */ +#line 202 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleElse(parser); } -#line 1737 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1732 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 24: -#line 211 "cmFortranParser.y" /* yacc.c:1646 */ +#line 206 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleEndif(parser); } -#line 1746 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1741 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 48: -#line 233 "cmFortranParser.y" /* yacc.c:1646 */ +#line 228 "cmFortranParser.y" /* yacc.c:1646 */ { free ((yyvsp[0].string)); } -#line 1752 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1747 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 55: -#line 240 "cmFortranParser.y" /* yacc.c:1646 */ +#line 235 "cmFortranParser.y" /* yacc.c:1646 */ { free ((yyvsp[0].string)); } -#line 1758 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1753 "cmFortranParser.cxx" /* yacc.c:1646 */ break; -#line 1762 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1757 "cmFortranParser.cxx" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1979,6 +1983,6 @@ yyreturn: #endif return yyresult; } -#line 251 "cmFortranParser.y" /* yacc.c:1906 */ +#line 246 "cmFortranParser.y" /* yacc.c:1906 */ /* End of grammar */ diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h index 06985d2..024b00a 100644 --- a/Source/cmFortranParser.h +++ b/Source/cmFortranParser.h @@ -6,7 +6,9 @@ #if !defined(cmFortranLexer_cxx) && !defined(cmFortranParser_cxx) #include <cmConfigure.h> -#include "cmStandardIncludes.h" +#include <set> +#include <string> +#include <vector> #endif #include <stddef.h> /* size_t */ @@ -52,8 +54,7 @@ void cmFortranParser_RuleElse(cmFortranParser* parser); void cmFortranParser_RuleEndif(cmFortranParser* parser); /* Define the parser stack element type. */ -typedef union cmFortran_yystype_u cmFortran_yystype; -union cmFortran_yystype_u +struct cmFortran_yystype { char* string; }; diff --git a/Source/cmFortranParser.y b/Source/cmFortranParser.y index 7eb5ef5..3d68134 100644 --- a/Source/cmFortranParser.y +++ b/Source/cmFortranParser.y @@ -26,13 +26,17 @@ Modify cmFortranParser.cxx: - "#if 0" out yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"] */ +#include <cmConfigure.h> // IWYU pragma: keep + +#include <cmsys/String.h> +#include <stdlib.h> +#include <string.h> + /*-------------------------------------------------------------------------*/ #define cmFortranParser_cxx #include "cmFortranParser.h" /* Interface to parser object. */ #include "cmFortranParserTokens.h" /* Need YYSTYPE for YY_DECL. */ -#include <cmsys/String.h> - /* Forward declare the lexer entry point. */ YY_DECL; diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx index 1a5e6c5..1abe673 100644 --- a/Source/cmFortranParserImpl.cxx +++ b/Source/cmFortranParserImpl.cxx @@ -1,7 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmFortranParser.h" -#include "cmFortranLexer.h" #include "cmSystemTools.h" #include <assert.h> diff --git a/Source/cmFortranParserTokens.h b/Source/cmFortranParserTokens.h index 18b9e0a..8d6a5fe 100644 --- a/Source/cmFortranParserTokens.h +++ b/Source/cmFortranParserTokens.h @@ -130,7 +130,7 @@ extern int cmFortran_yydebug; union YYSTYPE { -#line 75 "cmFortranParser.y" /* yacc.c:1909 */ +#line 70 "cmFortranParser.y" /* yacc.c:1909 */ char* string; diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h index 26135df..1223ffd 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.h +++ b/Source/cmGeneratorExpressionEvaluationFile.h @@ -11,12 +11,7 @@ #include "cmGeneratorExpression.h" #include "cm_auto_ptr.hxx" - -#if defined(_MSC_VER) -typedef unsigned short mode_t; -#else -#include <sys/types.h> -#endif +#include "cm_sys_stat.h" class cmLocalGenerator; diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 66202df..4443499 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1504,6 +1504,8 @@ class ArtifactNameTag; class ArtifactPathTag; class ArtifactPdbTag; class ArtifactSonameTag; +class ArtifactBundleDirTag; +class ArtifactBundleContentDirTag; template <typename ArtifactT> struct TargetFilesystemArtifactResultCreator @@ -1600,6 +1602,56 @@ struct TargetFilesystemArtifactResultCreator<ArtifactLinkerTag> }; template <> +struct TargetFilesystemArtifactResultCreator<ArtifactBundleDirTag> +{ + static std::string Create(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content) + { + if (target->IsImported()) { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_BUNDLE_DIR not allowed for IMPORTED targets."); + return std::string(); + } + if (!target->IsBundleOnApple()) { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_BUNDLE_DIR is allowed only for Bundle targets."); + return std::string(); + } + + std::string outpath = target->GetDirectory(context->Config) + '/'; + return target->BuildBundleDirectory(outpath, context->Config, + cmGeneratorTarget::BundleDirLevel); + } +}; + +template <> +struct TargetFilesystemArtifactResultCreator<ArtifactBundleContentDirTag> +{ + static std::string Create(cmGeneratorTarget* target, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content) + { + if (target->IsImported()) { + ::reportError( + context, content->GetOriginalExpression(), + "TARGET_BUNDLE_CONTENT_DIR not allowed for IMPORTED targets."); + return std::string(); + } + if (!target->IsBundleOnApple()) { + ::reportError( + context, content->GetOriginalExpression(), + "TARGET_BUNDLE_CONTENT_DIR is allowed only for Bundle targets."); + return std::string(); + } + + std::string outpath = target->GetDirectory(context->Config) + '/'; + return target->BuildBundleDirectory(outpath, context->Config, + cmGeneratorTarget::ContentLevel); + } +}; + +template <> struct TargetFilesystemArtifactResultCreator<ArtifactNameTag> { static std::string Create(cmGeneratorTarget* target, @@ -1716,6 +1768,13 @@ static const TargetFilesystemArtifactNodeGroup<ArtifactSonameTag> static const TargetFilesystemArtifactNodeGroup<ArtifactPdbTag> targetPdbNodeGroup; +static const TargetFilesystemArtifact<ArtifactBundleDirTag, ArtifactPathTag> + targetBundleDirNode; + +static const TargetFilesystemArtifact<ArtifactBundleContentDirTag, + ArtifactPathTag> + targetBundleContentDirNode; + static const struct ShellPathNode : public cmGeneratorExpressionNode { ShellPathNode() {} @@ -1772,6 +1831,8 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerNodeGroup.FileDir; nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameNodeGroup.FileDir; nodeMap["TARGET_PDB_FILE_DIR"] = &targetPdbNodeGroup.FileDir; + nodeMap["TARGET_BUNDLE_DIR"] = &targetBundleDirNode; + nodeMap["TARGET_BUNDLE_CONTENT_DIR"] = &targetBundleContentDirNode; nodeMap["STREQUAL"] = &strEqualNode; nodeMap["EQUAL"] = &equalNode; nodeMap["LOWER_CASE"] = &lowerCaseNode; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 3fe5c83..6779641 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -75,197 +75,6 @@ public: }; cmLinkImplItem cmGeneratorTarget::TargetPropertyEntry::NoLinkImplItem; -void reportBadObjLib(std::vector<cmSourceFile*> const& badObjLib, - cmGeneratorTarget const* target, cmake* cm) -{ - if (!badObjLib.empty()) { - std::ostringstream e; - e << "OBJECT library \"" << target->GetName() << "\" contains:\n"; - for (std::vector<cmSourceFile*>::const_iterator i = badObjLib.begin(); - i != badObjLib.end(); ++i) { - e << " " << (*i)->GetLocation().GetName() << "\n"; - } - e << "but may contain only sources that compile, header files, and " - "other files that would not affect linking of a normal library."; - cm->IssueMessage(cmake::FATAL_ERROR, e.str(), target->GetBacktrace()); - } -} - -struct ObjectSourcesTag -{ -}; -struct CustomCommandsTag -{ -}; -struct ExtraSourcesTag -{ -}; -struct HeaderSourcesTag -{ -}; -struct ExternalObjectsTag -{ -}; -struct IDLSourcesTag -{ -}; -struct ResxTag -{ -}; -struct ModuleDefinitionFileTag -{ -}; -struct AppManifestTag -{ -}; -struct ManifestsTag -{ -}; -struct CertificatesTag -{ -}; -struct XamlTag -{ -}; - -template <typename Tag, typename OtherTag> -struct IsSameTag -{ - enum - { - Result = false - }; -}; - -template <typename Tag> -struct IsSameTag<Tag, Tag> -{ - enum - { - Result = true - }; -}; - -template <bool> -struct DoAccept -{ - template <typename T> - static void Do(T& /*unused*/, cmSourceFile* /*unused*/) - { - } -}; - -template <> -struct DoAccept<true> -{ - static void Do(std::vector<cmSourceFile const*>& files, cmSourceFile* f) - { - files.push_back(f); - } - static void Do(cmGeneratorTarget::ResxData& data, cmSourceFile* f) - { - // Build and save the name of the corresponding .h file - // This relationship will be used later when building the project files. - // Both names would have been auto generated from Visual Studio - // where the user supplied the file name and Visual Studio - // appended the suffix. - std::string resx = f->GetFullPath(); - std::string hFileName = resx.substr(0, resx.find_last_of('.')) + ".h"; - data.ExpectedResxHeaders.insert(hFileName); - data.ResxSources.push_back(f); - } - static void Do(cmGeneratorTarget::XamlData& data, cmSourceFile* f) - { - // Build and save the name of the corresponding .h and .cpp file - // This relationship will be used later when building the project files. - // Both names would have been auto generated from Visual Studio - // where the user supplied the file name and Visual Studio - // appended the suffix. - std::string xaml = f->GetFullPath(); - std::string hFileName = xaml + ".h"; - std::string cppFileName = xaml + ".cpp"; - data.ExpectedXamlHeaders.insert(hFileName); - data.ExpectedXamlSources.insert(cppFileName); - data.XamlSources.push_back(f); - } - static void Do(std::string& data, cmSourceFile* f) - { - data = f->GetFullPath(); - } -}; - -template <typename Tag, typename DataType = std::vector<cmSourceFile const*> > -struct TagVisitor -{ - DataType& Data; - std::vector<cmSourceFile*> BadObjLibFiles; - cmGeneratorTarget const* Target; - cmGlobalGenerator* GlobalGenerator; - cmsys::RegularExpression Header; - bool IsObjLib; - - TagVisitor(cmGeneratorTarget const* target, DataType& data) - : Data(data) - , Target(target) - , GlobalGenerator(target->GetLocalGenerator()->GetGlobalGenerator()) - , Header(CM_HEADER_REGEX) - , IsObjLib(target->GetType() == cmStateEnums::OBJECT_LIBRARY) - { - } - - ~TagVisitor() - { - reportBadObjLib(this->BadObjLibFiles, this->Target, - this->GlobalGenerator->GetCMakeInstance()); - } - - void Accept(cmSourceFile* sf) - { - std::string ext = cmSystemTools::LowerCase(sf->GetExtension()); - if (sf->GetCustomCommand()) { - DoAccept<IsSameTag<Tag, CustomCommandsTag>::Result>::Do(this->Data, sf); - } else if (this->Target->GetType() == cmStateEnums::UTILITY) { - DoAccept<IsSameTag<Tag, ExtraSourcesTag>::Result>::Do(this->Data, sf); - } else if (sf->GetPropertyAsBool("HEADER_FILE_ONLY")) { - DoAccept<IsSameTag<Tag, HeaderSourcesTag>::Result>::Do(this->Data, sf); - } else if (sf->GetPropertyAsBool("EXTERNAL_OBJECT")) { - DoAccept<IsSameTag<Tag, ExternalObjectsTag>::Result>::Do(this->Data, sf); - if (this->IsObjLib) { - this->BadObjLibFiles.push_back(sf); - } - } else if (!sf->GetLanguage().empty()) { - DoAccept<IsSameTag<Tag, ObjectSourcesTag>::Result>::Do(this->Data, sf); - } else if (ext == "def") { - DoAccept<IsSameTag<Tag, ModuleDefinitionFileTag>::Result>::Do(this->Data, - sf); - if (this->IsObjLib) { - this->BadObjLibFiles.push_back(sf); - } - } else if (ext == "idl") { - DoAccept<IsSameTag<Tag, IDLSourcesTag>::Result>::Do(this->Data, sf); - if (this->IsObjLib) { - this->BadObjLibFiles.push_back(sf); - } - } else if (ext == "resx") { - DoAccept<IsSameTag<Tag, ResxTag>::Result>::Do(this->Data, sf); - } else if (ext == "appxmanifest") { - DoAccept<IsSameTag<Tag, AppManifestTag>::Result>::Do(this->Data, sf); - } else if (ext == "manifest") { - DoAccept<IsSameTag<Tag, ManifestsTag>::Result>::Do(this->Data, sf); - } else if (ext == "pfx") { - DoAccept<IsSameTag<Tag, CertificatesTag>::Result>::Do(this->Data, sf); - } else if (ext == "xaml") { - DoAccept<IsSameTag<Tag, XamlTag>::Result>::Do(this->Data, sf); - } else if (this->Header.find(sf->GetFullPath().c_str())) { - DoAccept<IsSameTag<Tag, HeaderSourcesTag>::Result>::Do(this->Data, sf); - } else if (this->GlobalGenerator->IgnoreFile(sf->GetExtension().c_str())) { - DoAccept<IsSameTag<Tag, ExtraSourcesTag>::Result>::Do(this->Data, sf); - } else { - DoAccept<IsSameTag<Tag, ExtraSourcesTag>::Result>::Do(this->Data, sf); - } - } -}; - void CreatePropertyGeneratorExpressions( cmStringRange const& entries, cmBacktraceRange const& backtraces, std::vector<cmGeneratorTarget::TargetPropertyEntry*>& items, @@ -286,6 +95,7 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) , FortranModuleDirectoryCreated(false) , SourceFileFlagsConstructed(false) , PolicyWarnedCMP0022(false) + , PolicyReportedCMP0069(false) , DebugIncludesDone(false) , DebugCompileOptionsDone(false) , DebugCompileFeaturesDone(false) @@ -515,7 +325,7 @@ void cmGeneratorTarget::AddSourceCommon(const std::string& src) CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(src); cge->SetEvaluateForBuildsystem(true); this->SourceEntries.push_back(new TargetPropertyEntry(cge)); - this->SourceFilesMap.clear(); + this->KindedSourcesMap.clear(); this->LinkImplementationLanguageIsContextDependent = true; } @@ -587,27 +397,22 @@ static void handleSystemIncludesDep( } /* clang-format off */ -#define IMPLEMENT_VISIT_IMPL(DATA, DATATYPE) \ +#define IMPLEMENT_VISIT(KIND) \ { \ - std::vector<cmSourceFile*> sourceFiles; \ - this->GetSourceFiles(sourceFiles, config); \ - TagVisitor< DATA##Tag DATATYPE > visitor(this, data); \ - for (std::vector<cmSourceFile*>::const_iterator si = sourceFiles.begin(); \ - si != sourceFiles.end(); ++si) { \ - visitor.Accept(*si); \ + KindedSources const& kinded = this->GetKindedSources(config); \ + for (std::vector<SourceAndKind>::const_iterator \ + si = kinded.Sources.begin(); si != kinded.Sources.end(); ++si) { \ + if (si->Kind == KIND) { \ + data.push_back(si->Source); \ + } \ } \ } /* clang-format on */ -#define IMPLEMENT_VISIT(DATA) IMPLEMENT_VISIT_IMPL(DATA, EMPTY) - -#define EMPTY -#define COMMA , - void cmGeneratorTarget::GetObjectSources( std::vector<cmSourceFile const*>& data, const std::string& config) const { - IMPLEMENT_VISIT(ObjectSources); + IMPLEMENT_VISIT(SourceKindObjectSource); if (!this->Objects.empty()) { return; @@ -656,10 +461,65 @@ const char* cmGeneratorTarget::GetFeature(const std::string& feature, return this->LocalGenerator->GetFeature(feature, config); } -bool cmGeneratorTarget::GetFeatureAsBool(const std::string& feature, - const std::string& config) const +bool cmGeneratorTarget::IsIPOEnabled(const std::string& config) const { - return cmSystemTools::IsOn(this->GetFeature(feature, config)); + const char* feature = "INTERPROCEDURAL_OPTIMIZATION"; + const bool result = cmSystemTools::IsOn(this->GetFeature(feature, config)); + + if (!result) { + // 'INTERPROCEDURAL_OPTIMIZATION' is off, no need to check policies + return false; + } + + cmPolicies::PolicyStatus cmp0069 = this->GetPolicyStatusCMP0069(); + + if (cmp0069 == cmPolicies::OLD || cmp0069 == cmPolicies::WARN) { + if (this->Makefile->IsOn("_CMAKE_IPO_LEGACY_BEHAVIOR")) { + return true; + } + if (this->PolicyReportedCMP0069) { + // problem is already reported, no need to issue a message + return false; + } + if (cmp0069 == cmPolicies::WARN) { + std::ostringstream w; + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0069) << "\n"; + w << "INTERPROCEDURAL_OPTIMIZATION property will be ignored for target " + << "'" << this->GetName() << "'."; + this->LocalGenerator->GetCMakeInstance()->IssueMessage( + cmake::AUTHOR_WARNING, w.str(), this->GetBacktrace()); + + this->PolicyReportedCMP0069 = true; + } + return false; + } + + // Note: check consistency with messages from CheckIPOSupported + const char* message = CM_NULLPTR; + if (!this->Makefile->IsOn("_CMAKE_IPO_SUPPORTED_BY_CMAKE")) { + message = "CMake doesn't support IPO for current compiler"; + } else if (!this->Makefile->IsOn( + "_CMAKE_IPO_MAY_BE_SUPPORTED_BY_COMPILER")) { + message = "Compiler doesn't support IPO"; + } else if (!this->GlobalGenerator->IsIPOSupported()) { + message = "CMake doesn't support IPO for current generator"; + } + + if (!message) { + // No error/warning messages + return true; + } + + if (this->PolicyReportedCMP0069) { + // problem is already reported, no need to issue a message + return false; + } + + this->PolicyReportedCMP0069 = true; + + this->LocalGenerator->GetCMakeInstance()->IssueMessage( + cmake::FATAL_ERROR, message, this->GetBacktrace()); + return false; } const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file) @@ -681,84 +541,85 @@ bool cmGeneratorTarget::HasExplicitObjectName(cmSourceFile const* file) const return it != this->ExplicitObjectName.end(); } +void cmGeneratorTarget::GetModuleDefinitionSources( + std::vector<cmSourceFile const*>& data, const std::string& config) const +{ + IMPLEMENT_VISIT(SourceKindModuleDefinition); +} + void cmGeneratorTarget::GetIDLSources(std::vector<cmSourceFile const*>& data, const std::string& config) const { - IMPLEMENT_VISIT(IDLSources); + IMPLEMENT_VISIT(SourceKindIDL); } void cmGeneratorTarget::GetHeaderSources( std::vector<cmSourceFile const*>& data, const std::string& config) const { - IMPLEMENT_VISIT(HeaderSources); + IMPLEMENT_VISIT(SourceKindHeader); } void cmGeneratorTarget::GetExtraSources(std::vector<cmSourceFile const*>& data, const std::string& config) const { - IMPLEMENT_VISIT(ExtraSources); + IMPLEMENT_VISIT(SourceKindExtra); } void cmGeneratorTarget::GetCustomCommands( std::vector<cmSourceFile const*>& data, const std::string& config) const { - IMPLEMENT_VISIT(CustomCommands); + IMPLEMENT_VISIT(SourceKindCustomCommand); } void cmGeneratorTarget::GetExternalObjects( std::vector<cmSourceFile const*>& data, const std::string& config) const { - IMPLEMENT_VISIT(ExternalObjects); + IMPLEMENT_VISIT(SourceKindExternalObject); } -void cmGeneratorTarget::GetExpectedResxHeaders(std::set<std::string>& srcs, +void cmGeneratorTarget::GetExpectedResxHeaders(std::set<std::string>& headers, const std::string& config) const { - ResxData data; - IMPLEMENT_VISIT_IMPL(Resx, COMMA cmGeneratorTarget::ResxData) - srcs = data.ExpectedResxHeaders; + KindedSources const& kinded = this->GetKindedSources(config); + headers = kinded.ExpectedResxHeaders; } -void cmGeneratorTarget::GetResxSources(std::vector<cmSourceFile const*>& srcs, +void cmGeneratorTarget::GetResxSources(std::vector<cmSourceFile const*>& data, const std::string& config) const { - ResxData data; - IMPLEMENT_VISIT_IMPL(Resx, COMMA cmGeneratorTarget::ResxData) - srcs = data.ResxSources; + IMPLEMENT_VISIT(SourceKindResx); } void cmGeneratorTarget::GetAppManifest(std::vector<cmSourceFile const*>& data, const std::string& config) const { - IMPLEMENT_VISIT(AppManifest); + IMPLEMENT_VISIT(SourceKindAppManifest); } void cmGeneratorTarget::GetManifests(std::vector<cmSourceFile const*>& data, const std::string& config) const { - IMPLEMENT_VISIT(Manifests); + IMPLEMENT_VISIT(SourceKindManifest); } void cmGeneratorTarget::GetCertificates(std::vector<cmSourceFile const*>& data, const std::string& config) const { - IMPLEMENT_VISIT(Certificates); + IMPLEMENT_VISIT(SourceKindCertificate); } void cmGeneratorTarget::GetExpectedXamlHeaders(std::set<std::string>& headers, const std::string& config) const { - XamlData data; - IMPLEMENT_VISIT_IMPL(Xaml, COMMA cmGeneratorTarget::XamlData) - headers = data.ExpectedXamlHeaders; + KindedSources const& kinded = this->GetKindedSources(config); + headers = kinded.ExpectedXamlHeaders; } void cmGeneratorTarget::GetExpectedXamlSources(std::set<std::string>& srcs, const std::string& config) const { - XamlData data; - IMPLEMENT_VISIT_IMPL(Xaml, COMMA cmGeneratorTarget::XamlData) - srcs = data.ExpectedXamlSources; + KindedSources const& kinded = this->GetKindedSources(config); + srcs = kinded.ExpectedXamlSources; } std::set<cmLinkItem> const& cmGeneratorTarget::GetUtilityItems() const @@ -776,12 +637,10 @@ std::set<cmLinkItem> const& cmGeneratorTarget::GetUtilityItems() const return this->UtilityItems; } -void cmGeneratorTarget::GetXamlSources(std::vector<cmSourceFile const*>& srcs, +void cmGeneratorTarget::GetXamlSources(std::vector<cmSourceFile const*>& data, const std::string& config) const { - XamlData data; - IMPLEMENT_VISIT_IMPL(Xaml, COMMA cmGeneratorTarget::XamlData) - srcs = data.XamlSources; + IMPLEMENT_VISIT(SourceKindXaml); } const char* cmGeneratorTarget::GetLocation(const std::string& config) const @@ -840,7 +699,7 @@ const char* cmGeneratorTarget::GetLocationForBuild() const } if (this->IsAppBundleOnApple()) { - std::string macdir = this->BuildMacContentDirectory("", "", false); + std::string macdir = this->BuildBundleDirectory("", "", FullLevel); if (!macdir.empty()) { location += "/"; location += macdir; @@ -1088,32 +947,131 @@ void cmGeneratorTarget::GetSourceFiles(std::vector<std::string>& files, void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*>& files, const std::string& config) const { + KindedSources const& kinded = this->GetKindedSources(config); + files.reserve(kinded.Sources.size()); + for (std::vector<SourceAndKind>::const_iterator si = kinded.Sources.begin(); + si != kinded.Sources.end(); ++si) { + files.push_back(si->Source); + } +} - // Lookup any existing link implementation for this configuration. - std::string key = cmSystemTools::UpperCase(config); - +cmGeneratorTarget::KindedSources const& cmGeneratorTarget::GetKindedSources( + std::string const& config) const +{ + // If we already processed one configuration and found no dependenc + // on configuration then always use the one result. if (!this->LinkImplementationLanguageIsContextDependent) { - files = this->SourceFilesMap.begin()->second; - return; + return this->KindedSourcesMap.begin()->second; } - SourceFilesMapType::iterator it = this->SourceFilesMap.find(key); - if (it != this->SourceFilesMap.end()) { - files = it->second; - } else { - std::vector<std::string> srcs; - this->GetSourceFiles(srcs, config); + // Lookup any existing link implementation for this configuration. + std::string const key = cmSystemTools::UpperCase(config); + KindedSourcesMapType::iterator it = this->KindedSourcesMap.find(key); + if (it != this->KindedSourcesMap.end()) { + return it->second; + } - std::set<cmSourceFile*> emitted; + // Add an entry to the map for this configuration. + KindedSources& files = this->KindedSourcesMap[key]; + this->ComputeKindedSources(files, config); + return files; +} - for (std::vector<std::string>::const_iterator i = srcs.begin(); - i != srcs.end(); ++i) { - cmSourceFile* sf = this->Makefile->GetOrCreateSource(*i); - if (emitted.insert(sf).second) { - files.push_back(sf); +void cmGeneratorTarget::ComputeKindedSources(KindedSources& files, + std::string const& config) const +{ + // Get the source file paths by string. + std::vector<std::string> srcs; + this->GetSourceFiles(srcs, config); + + cmsys::RegularExpression header_regex(CM_HEADER_REGEX); + std::vector<cmSourceFile*> badObjLib; + + std::set<cmSourceFile*> emitted; + for (std::vector<std::string>::const_iterator i = srcs.begin(); + i != srcs.end(); ++i) { + // Create each source at most once. + cmSourceFile* sf = this->Makefile->GetOrCreateSource(*i); + if (!emitted.insert(sf).second) { + continue; + } + + // Compute the kind (classification) of this source file. + SourceKind kind; + std::string ext = cmSystemTools::LowerCase(sf->GetExtension()); + if (sf->GetCustomCommand()) { + kind = SourceKindCustomCommand; + } else if (this->Target->GetType() == cmStateEnums::UTILITY) { + kind = SourceKindExtra; + } else if (sf->GetPropertyAsBool("HEADER_FILE_ONLY")) { + kind = SourceKindHeader; + } else if (sf->GetPropertyAsBool("EXTERNAL_OBJECT")) { + kind = SourceKindExternalObject; + if (this->GetType() == cmStateEnums::OBJECT_LIBRARY) { + badObjLib.push_back(sf); + } + } else if (!sf->GetLanguage().empty()) { + kind = SourceKindObjectSource; + } else if (ext == "def") { + kind = SourceKindModuleDefinition; + if (this->GetType() == cmStateEnums::OBJECT_LIBRARY) { + badObjLib.push_back(sf); + } + } else if (ext == "idl") { + kind = SourceKindIDL; + if (this->GetType() == cmStateEnums::OBJECT_LIBRARY) { + badObjLib.push_back(sf); } + } else if (ext == "resx") { + kind = SourceKindResx; + // Build and save the name of the corresponding .h file + // This relationship will be used later when building the project files. + // Both names would have been auto generated from Visual Studio + // where the user supplied the file name and Visual Studio + // appended the suffix. + std::string resx = sf->GetFullPath(); + std::string hFileName = resx.substr(0, resx.find_last_of('.')) + ".h"; + files.ExpectedResxHeaders.insert(hFileName); + } else if (ext == "appxmanifest") { + kind = SourceKindAppManifest; + } else if (ext == "manifest") { + kind = SourceKindManifest; + } else if (ext == "pfx") { + kind = SourceKindCertificate; + } else if (ext == "xaml") { + kind = SourceKindXaml; + // Build and save the name of the corresponding .h and .cpp file + // This relationship will be used later when building the project files. + // Both names would have been auto generated from Visual Studio + // where the user supplied the file name and Visual Studio + // appended the suffix. + std::string xaml = sf->GetFullPath(); + std::string hFileName = xaml + ".h"; + std::string cppFileName = xaml + ".cpp"; + files.ExpectedXamlHeaders.insert(hFileName); + files.ExpectedXamlSources.insert(cppFileName); + } else if (header_regex.find(sf->GetFullPath().c_str())) { + kind = SourceKindHeader; + } else { + kind = SourceKindExtra; + } + + // Save this classified source file in the result vector. + SourceAndKind entry = { sf, kind }; + files.Sources.push_back(entry); + } + + if (!badObjLib.empty()) { + std::ostringstream e; + e << "OBJECT library \"" << this->GetName() << "\" contains:\n"; + for (std::vector<cmSourceFile*>::const_iterator i = badObjLib.begin(); + i != badObjLib.end(); ++i) { + e << " " << (*i)->GetLocation().GetName() << "\n"; } - this->SourceFilesMap[key] = files; + e << "but may contain only sources that compile, header files, and " + "other files that would not affect linking of a normal library."; + this->GlobalGenerator->GetCMakeInstance()->IssueMessage( + cmake::FATAL_ERROR, e.str(), this->GetBacktrace()); } } @@ -1321,8 +1279,7 @@ bool cmGeneratorTarget::HasMacOSXRpathInstallNameDir( return false; } const char* install_name = this->GetProperty("INSTALL_NAME_DIR"); - bool use_install_name = - this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"); + bool use_install_name = this->MacOSXUseInstallNameDir(); if (install_name && use_install_name && std::string(install_name) == "@rpath") { install_name_is_rpath = true; @@ -1395,6 +1352,53 @@ bool cmGeneratorTarget::MacOSXRpathInstallNameDirDefault() const return cmp0042 == cmPolicies::NEW; } +bool cmGeneratorTarget::MacOSXUseInstallNameDir() const +{ + const char* build_with_install_name = + this->GetProperty("BUILD_WITH_INSTALL_NAME_DIR"); + if (build_with_install_name) { + return cmSystemTools::IsOn(build_with_install_name); + } + + cmPolicies::PolicyStatus cmp0068 = this->GetPolicyStatusCMP0068(); + if (cmp0068 == cmPolicies::NEW) { + return false; + } + + bool use_install_name = this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"); + + if (use_install_name && cmp0068 == cmPolicies::WARN) { + this->LocalGenerator->GetGlobalGenerator()->AddCMP0068WarnTarget( + this->GetName()); + } + + return use_install_name; +} + +bool cmGeneratorTarget::CanGenerateInstallNameDir( + InstallNameType name_type) const +{ + cmPolicies::PolicyStatus cmp0068 = this->GetPolicyStatusCMP0068(); + + if (cmp0068 == cmPolicies::NEW) { + return true; + } + + bool skip = this->Makefile->IsOn("CMAKE_SKIP_RPATH"); + if (name_type == INSTALL_NAME_FOR_INSTALL) { + skip |= this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH"); + } else { + skip |= this->GetPropertyAsBool("SKIP_BUILD_RPATH"); + } + + if (skip && cmp0068 == cmPolicies::WARN) { + this->LocalGenerator->GetGlobalGenerator()->AddCMP0068WarnTarget( + this->GetName()); + } + + return !skip; +} + std::string cmGeneratorTarget::GetSOName(const std::string& config) const { if (this->IsImported()) { @@ -1424,8 +1428,19 @@ std::string cmGeneratorTarget::GetSOName(const std::string& config) const return soName; } -std::string cmGeneratorTarget::GetAppBundleDirectory(const std::string& config, - bool contentOnly) const +static bool shouldAddFullLevel(cmGeneratorTarget::BundleDirectoryLevel level) +{ + return level == cmGeneratorTarget::FullLevel; +} + +static bool shouldAddContentLevel( + cmGeneratorTarget::BundleDirectoryLevel level) +{ + return level == cmGeneratorTarget::ContentLevel || shouldAddFullLevel(level); +} + +std::string cmGeneratorTarget::GetAppBundleDirectory( + const std::string& config, BundleDirectoryLevel level) const { std::string fpath = this->GetFullName(config, false); fpath += "."; @@ -1434,9 +1449,9 @@ std::string cmGeneratorTarget::GetAppBundleDirectory(const std::string& config, ext = "app"; } fpath += ext; - if (!this->Makefile->PlatformIsAppleIos()) { + if (shouldAddContentLevel(level) && !this->Makefile->PlatformIsAppleIos()) { fpath += "/Contents"; - if (!contentOnly) { + if (shouldAddFullLevel(level)) { fpath += "/MacOS"; } } @@ -1449,8 +1464,8 @@ bool cmGeneratorTarget::IsBundleOnApple() const this->IsCFBundleOnApple(); } -std::string cmGeneratorTarget::GetCFBundleDirectory(const std::string& config, - bool contentOnly) const +std::string cmGeneratorTarget::GetCFBundleDirectory( + const std::string& config, BundleDirectoryLevel level) const { std::string fpath; fpath += this->GetOutputName(config, false); @@ -1464,17 +1479,17 @@ std::string cmGeneratorTarget::GetCFBundleDirectory(const std::string& config, } } fpath += ext; - if (!this->Makefile->PlatformIsAppleIos()) { + if (shouldAddContentLevel(level) && !this->Makefile->PlatformIsAppleIos()) { fpath += "/Contents"; - if (!contentOnly) { + if (shouldAddFullLevel(level)) { fpath += "/MacOS"; } } return fpath; } -std::string cmGeneratorTarget::GetFrameworkDirectory(const std::string& config, - bool rootDir) const +std::string cmGeneratorTarget::GetFrameworkDirectory( + const std::string& config, BundleDirectoryLevel level) const { std::string fpath; fpath += this->GetOutputName(config, false); @@ -1484,7 +1499,7 @@ std::string cmGeneratorTarget::GetFrameworkDirectory(const std::string& config, ext = "framework"; } fpath += ext; - if (!rootDir && !this->Makefile->PlatformIsAppleIos()) { + if (shouldAddFullLevel(level) && !this->Makefile->PlatformIsAppleIos()) { fpath += "/Versions/"; fpath += this->GetFrameworkVersion(); } @@ -1503,24 +1518,25 @@ std::string cmGeneratorTarget::GetFullName(const std::string& config, std::string cmGeneratorTarget::GetInstallNameDirForBuildTree( const std::string& config) const { - // If building directly for installation then the build tree install_name - // is the same as the install tree. - if (this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH")) { - return this->GetInstallNameDirForInstallTree(); - } + if (this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) { - // Use the build tree directory for the target. - if (this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME") && - !this->Makefile->IsOn("CMAKE_SKIP_RPATH") && - !this->GetPropertyAsBool("SKIP_BUILD_RPATH")) { - std::string dir; - if (this->MacOSXRpathInstallNameDirDefault()) { - dir = "@rpath"; - } else { - dir = this->GetDirectory(config); + // If building directly for installation then the build tree install_name + // is the same as the install tree. + if (this->MacOSXUseInstallNameDir()) { + return this->GetInstallNameDirForInstallTree(); + } + + // Use the build tree directory for the target. + if (this->CanGenerateInstallNameDir(INSTALL_NAME_FOR_BUILD)) { + std::string dir; + if (this->MacOSXRpathInstallNameDirDefault()) { + dir = "@rpath"; + } else { + dir = this->GetDirectory(config); + } + dir += "/"; + return dir; } - dir += "/"; - return dir; } return ""; } @@ -1531,8 +1547,7 @@ std::string cmGeneratorTarget::GetInstallNameDirForInstallTree() const std::string dir; const char* install_name_dir = this->GetProperty("INSTALL_NAME_DIR"); - if (!this->Makefile->IsOn("CMAKE_SKIP_RPATH") && - !this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH")) { + if (this->CanGenerateInstallNameDir(INSTALL_NAME_FOR_INSTALL)) { if (install_name_dir && *install_name_dir) { dir = install_name_dir; dir += "/"; @@ -1799,18 +1814,19 @@ void cmGeneratorTarget::GetFullNameComponents(std::string& prefix, this->GetFullNameInternal(config, implib, prefix, base, suffix); } -std::string cmGeneratorTarget::BuildMacContentDirectory( - const std::string& base, const std::string& config, bool contentOnly) const +std::string cmGeneratorTarget::BuildBundleDirectory( + const std::string& base, const std::string& config, + BundleDirectoryLevel level) const { std::string fpath = base; if (this->IsAppBundleOnApple()) { - fpath += this->GetAppBundleDirectory(config, contentOnly); + fpath += this->GetAppBundleDirectory(config, level); } if (this->IsFrameworkOnApple()) { - fpath += this->GetFrameworkDirectory(config, contentOnly); + fpath += this->GetFrameworkDirectory(config, level); } if (this->IsCFBundleOnApple()) { - fpath += this->GetCFBundleDirectory(config, contentOnly); + fpath += this->GetCFBundleDirectory(config, level); } return fpath; } @@ -1821,13 +1837,13 @@ std::string cmGeneratorTarget::GetMacContentDirectory( // Start with the output directory for the target. std::string fpath = this->GetDirectory(config, implib); fpath += "/"; - bool contentOnly = true; + BundleDirectoryLevel level = ContentLevel; if (this->IsFrameworkOnApple()) { // additional files with a framework go into the version specific // directory - contentOnly = false; + level = FullLevel; } - fpath = this->BuildMacContentDirectory(fpath, config, contentOnly); + fpath = this->BuildBundleDirectory(fpath, config, level); return fpath; } @@ -1880,17 +1896,46 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo( return &i->second; } -cmSourceFile const* cmGeneratorTarget::GetModuleDefinitionFile( - const std::string& config) const +cmGeneratorTarget::ModuleDefinitionInfo const* +cmGeneratorTarget::GetModuleDefinitionInfo(std::string const& config) const { - std::vector<cmSourceFile const*> data; - IMPLEMENT_VISIT_IMPL(ModuleDefinitionFile, - COMMA std::vector<cmSourceFile const*>) - if (!data.empty()) { - return data.front(); + // A module definition file only makes sense on certain target types. + if (this->GetType() != cmStateEnums::SHARED_LIBRARY && + this->GetType() != cmStateEnums::MODULE_LIBRARY && + !this->IsExecutableWithExports()) { + return CM_NULLPTR; } - return CM_NULLPTR; + // Lookup/compute/cache the compile information for this configuration. + std::string config_upper; + if (!config.empty()) { + config_upper = cmSystemTools::UpperCase(config); + } + ModuleDefinitionInfoMapType::const_iterator i = + this->ModuleDefinitionInfoMap.find(config_upper); + if (i == this->ModuleDefinitionInfoMap.end()) { + ModuleDefinitionInfo info; + this->ComputeModuleDefinitionInfo(config, info); + ModuleDefinitionInfoMapType::value_type entry(config_upper, info); + i = this->ModuleDefinitionInfoMap.insert(entry).first; + } + return &i->second; +} + +void cmGeneratorTarget::ComputeModuleDefinitionInfo( + std::string const& config, ModuleDefinitionInfo& info) const +{ + this->GetModuleDefinitionSources(info.Sources, config); + info.WindowsExportAllSymbols = + this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS") && + this->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"); + info.DefFileGenerated = + info.WindowsExportAllSymbols || info.Sources.size() > 1; + if (info.DefFileGenerated) { + info.DefFile = this->ObjectDirectory /* has slash */ + "exports.def"; + } else if (!info.Sources.empty()) { + info.DefFile = info.Sources.front()->GetFullPath(); + } } bool cmGeneratorTarget::IsDLLPlatform() const @@ -2317,19 +2362,28 @@ void cmGeneratorTarget::GetAppleArchs(const std::string& config, } } +//---------------------------------------------------------------------------- +std::string cmGeneratorTarget::GetFeatureSpecificLinkRuleVariable( + std::string const& var, std::string const& config) const +{ + if (this->IsIPOEnabled(config)) { + std::string varIPO = var + "_IPO"; + if (this->Makefile->IsDefinitionSet(varIPO)) { + return varIPO; + } + } + + return var; +} + +//---------------------------------------------------------------------------- std::string cmGeneratorTarget::GetCreateRuleVariable( std::string const& lang, std::string const& config) const { switch (this->GetType()) { case cmStateEnums::STATIC_LIBRARY: { std::string var = "CMAKE_" + lang + "_CREATE_STATIC_LIBRARY"; - if (this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION", config)) { - std::string varIPO = var + "_IPO"; - if (this->Makefile->GetDefinition(varIPO)) { - return varIPO; - } - } - return var; + return this->GetFeatureSpecificLinkRuleVariable(var, config); } case cmStateEnums::SHARED_LIBRARY: return "CMAKE_" + lang + "_CREATE_SHARED_LIBRARY"; @@ -2839,7 +2893,7 @@ std::string cmGeneratorTarget::NormalGetFullPath(const std::string& config, std::string fpath = this->GetDirectory(config, implib); fpath += "/"; if (this->IsAppBundleOnApple()) { - fpath = this->BuildMacContentDirectory(fpath, config, false); + fpath = this->BuildBundleDirectory(fpath, config, FullLevel); fpath += "/"; } @@ -3123,20 +3177,14 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config, // frameworks have directory prefix but no suffix std::string fw_prefix; if (this->IsFrameworkOnApple()) { - fw_prefix = this->GetOutputName(config, false); - fw_prefix += "."; - const char* ext = this->GetProperty("BUNDLE_EXTENSION"); - if (!ext) { - ext = "framework"; - } - fw_prefix += ext; + fw_prefix = this->GetFrameworkDirectory(config, ContentLevel); fw_prefix += "/"; targetPrefix = fw_prefix.c_str(); targetSuffix = CM_NULLPTR; } if (this->IsCFBundleOnApple()) { - fw_prefix = this->GetCFBundleDirectory(config, false); + fw_prefix = this->GetCFBundleDirectory(config, FullLevel); fw_prefix += "/"; targetPrefix = fw_prefix.c_str(); targetSuffix = CM_NULLPTR; @@ -3222,8 +3270,18 @@ cmGeneratorTarget::GetTargetSourceFileFlags(const cmSourceFile* sf) const // were not listed in one of the other lists. if (const char* location = sf->GetProperty("MACOSX_PACKAGE_LOCATION")) { flags.MacFolder = location; + const bool stripResources = + this->GlobalGenerator->ShouldStripResourcePath(this->Makefile); if (strcmp(location, "Resources") == 0) { flags.Type = cmGeneratorTarget::SourceFileTypeResource; + if (stripResources) { + flags.MacFolder = ""; + } + } else if (cmSystemTools::StringStartsWith(location, "Resources/")) { + flags.Type = cmGeneratorTarget::SourceFileTypeDeepResource; + if (stripResources) { + flags.MacFolder += strlen("Resources/"); + } } else { flags.Type = cmGeneratorTarget::SourceFileTypeMacContent; } @@ -3277,7 +3335,7 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const if (cmSourceFile* sf = this->Makefile->GetSource(*it)) { SourceFileFlags& flags = this->SourceFlagsMap[sf]; flags.MacFolder = ""; - if (!this->Makefile->PlatformIsAppleIos()) { + if (!this->GlobalGenerator->ShouldStripResourcePath(this->Makefile)) { flags.MacFolder = "Resources"; } flags.Type = cmGeneratorTarget::SourceFileTypeResource; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index f568699..00df14b 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -70,6 +70,43 @@ public: void GetSourceFiles(std::vector<cmSourceFile*>& files, const std::string& config) const; + /** Source file kinds (classifications). + Generators use this to decide how to treat a source file. */ + enum SourceKind + { + SourceKindAppManifest, + SourceKindCertificate, + SourceKindCustomCommand, + SourceKindExternalObject, + SourceKindExtra, + SourceKindHeader, + SourceKindIDL, + SourceKindManifest, + SourceKindModuleDefinition, + SourceKindObjectSource, + SourceKindResx, + SourceKindXaml + }; + + /** A source file paired with a kind (classification). */ + struct SourceAndKind + { + cmSourceFile* Source; + SourceKind Kind; + }; + + /** All sources needed for a configuration with kinds assigned. */ + struct KindedSources + { + std::vector<SourceAndKind> Sources; + std::set<std::string> ExpectedResxHeaders; + std::set<std::string> ExpectedXamlHeaders; + std::set<std::string> ExpectedXamlSources; + }; + + /** Get all sources needed for a configuration with kinds assigned. */ + KindedSources const& GetKindedSources(std::string const& config) const; + void GetObjectSources(std::vector<cmSourceFile const*>&, const std::string& config) const; const std::string& GetObjectName(cmSourceFile const* file); @@ -77,6 +114,8 @@ public: bool HasExplicitObjectName(cmSourceFile const* file) const; void AddExplicitObjectName(cmSourceFile const* sf); + void GetModuleDefinitionSources(std::vector<cmSourceFile const*>&, + const std::string& config) const; void GetResxSources(std::vector<cmSourceFile const*>&, const std::string& config) const; void GetIDLSources(std::vector<cmSourceFile const*>&, @@ -110,8 +149,8 @@ public: const char* GetFeature(const std::string& feature, const std::string& config) const; - bool GetFeatureAsBool(const std::string& feature, - const std::string& config) const; + + bool IsIPOEnabled(const std::string& config) const; bool IsLinkInterfaceDependentBoolProperty(const std::string& p, const std::string& config) const; @@ -158,9 +197,17 @@ public: bool realname) const; std::string NormalGetRealName(const std::string& config) const; + /** What hierarchy level should the reported directory contain */ + enum BundleDirectoryLevel + { + BundleDirLevel, + ContentLevel, + FullLevel + }; + /** @return the Mac App directory without the base */ std::string GetAppBundleDirectory(const std::string& config, - bool contentOnly) const; + BundleDirectoryLevel level) const; /** Return whether this target is an executable Bundle, a framework or CFBundle on Apple. */ @@ -173,7 +220,7 @@ public: /** @return the Mac framework directory without the base. */ std::string GetFrameworkDirectory(const std::string& config, - bool rootDir) const; + BundleDirectoryLevel level) const; /** Return the framework version string. Undefined if IsFrameworkOnApple returns false. */ @@ -181,7 +228,7 @@ public: /** @return the Mac CFBundle directory without the base */ std::string GetCFBundleDirectory(const std::string& config, - bool contentOnly) const; + BundleDirectoryLevel level) const; /** Return the install name directory for the target in the * build tree. For example: "\@rpath/", "\@loader_path/", @@ -216,10 +263,11 @@ public: const std::string& config = "", bool implib = false) const; - /** Append to @a base the mac content directory and return it. */ - std::string BuildMacContentDirectory(const std::string& base, - const std::string& config = "", - bool contentOnly = true) const; + /** Append to @a base the bundle directory hierarchy up to a certain @a level + * and return it. */ + std::string BuildBundleDirectory(const std::string& base, + const std::string& config, + BundleDirectoryLevel level) const; /** @return the mac content directory for this target. */ std::string GetMacContentDirectory(const std::string& config = CM_NULLPTR, @@ -233,7 +281,15 @@ public: cmLocalGenerator* LocalGenerator; cmGlobalGenerator const* GlobalGenerator; - cmSourceFile const* GetModuleDefinitionFile(const std::string& config) const; + struct ModuleDefinitionInfo + { + std::string DefFile; + bool DefFileGenerated; + bool WindowsExportAllSymbols; + std::vector<cmSourceFile const*> Sources; + }; + ModuleDefinitionInfo const* GetModuleDefinitionInfo( + std::string const& config) const; /** Return whether or not the target is for a DLL platform. */ bool IsDLLPlatform() const; @@ -299,6 +355,9 @@ public: void GetAppleArchs(const std::string& config, std::vector<std::string>& archVec) const; + std::string GetFeatureSpecificLinkRuleVariable( + std::string const& var, std::string const& config) const; + /** Return the rule variable used to create this type of target. */ std::string GetCreateRuleVariable(std::string const& lang, std::string const& config) const; @@ -412,7 +471,9 @@ public: SourceFileTypePublicHeader, // is in "PUBLIC_HEADER" target property SourceFileTypeResource, // is in "RESOURCE" target property *or* // has MACOSX_PACKAGE_LOCATION=="Resources" - SourceFileTypeMacContent // has MACOSX_PACKAGE_LOCATION!="Resources" + SourceFileTypeDeepResource, // MACOSX_PACKAGE_LOCATION starts with + // "Resources/" + SourceFileTypeMacContent // has MACOSX_PACKAGE_LOCATION!="Resources[/]" }; struct SourceFileFlags { @@ -498,19 +559,6 @@ public: struct SourceFileFlags GetTargetSourceFileFlags( const cmSourceFile* sf) const; - struct ResxData - { - mutable std::set<std::string> ExpectedResxHeaders; - mutable std::vector<cmSourceFile const*> ResxSources; - }; - - struct XamlData - { - std::set<std::string> ExpectedXamlHeaders; - std::set<std::string> ExpectedXamlSources; - std::vector<cmSourceFile const*> XamlSources; - }; - void ReportPropertyOrigin(const std::string& p, const std::string& result, const std::string& report, const std::string& compatibilityType) const; @@ -525,6 +573,16 @@ public: /** Whether this library defaults to \@rpath. */ bool MacOSXRpathInstallNameDirDefault() const; + enum InstallNameType + { + INSTALL_NAME_FOR_BUILD, + INSTALL_NAME_FOR_INSTALL + }; + /** Whether to use INSTALL_NAME_DIR. */ + bool MacOSXUseInstallNameDir() const; + /** Whether to generate an install_name. */ + bool CanGenerateInstallNameDir(InstallNameType t) const; + /** Test for special case of a third-party shared library that has no soname at all. */ bool IsImportedSharedLibWithoutSOName(const std::string& config) const; @@ -673,9 +731,10 @@ private: const std::string& config, const cmGeneratorTarget* head, bool usage_requirements_only) const; - typedef std::map<std::string, std::vector<cmSourceFile*> > - SourceFilesMapType; - mutable SourceFilesMapType SourceFilesMap; + typedef std::map<std::string, KindedSources> KindedSourcesMapType; + mutable KindedSourcesMapType KindedSourcesMap; + void ComputeKindedSources(KindedSources& files, + std::string const& config) const; std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries; std::vector<TargetPropertyEntry*> CompileOptionsEntries; @@ -711,12 +770,19 @@ private: typedef std::map<std::string, OutputInfo> OutputInfoMapType; mutable OutputInfoMapType OutputInfoMap; + typedef std::map<std::string, ModuleDefinitionInfo> + ModuleDefinitionInfoMapType; + mutable ModuleDefinitionInfoMapType ModuleDefinitionInfoMap; + void ComputeModuleDefinitionInfo(std::string const& config, + ModuleDefinitionInfo& info) const; + typedef std::pair<std::string, bool> OutputNameKey; typedef std::map<OutputNameKey, std::string> OutputNameMapType; mutable OutputNameMapType OutputNameMap; mutable std::set<cmLinkItem> UtilityItems; cmPolicies::PolicyMap PolicyMap; mutable bool PolicyWarnedCMP0022; + mutable bool PolicyReportedCMP0069; mutable bool DebugIncludesDone; mutable bool DebugCompileOptionsDone; mutable bool DebugCompileFeaturesDone; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index f118250..ce83e2e 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1,12 +1,5 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#if defined(_WIN32) && !defined(__CYGWIN__) -#include "windows.h" // this must be first to define GetCurrentDirectory -#if defined(_MSC_VER) && _MSC_VER >= 1800 -#define KWSYS_WINDOWS_DEPRECATED_GetVersionEx -#endif -#endif - #include "cmGlobalGenerator.h" #include <algorithm> @@ -19,6 +12,10 @@ #include <stdlib.h> #include <string.h> +#if defined(_WIN32) && !defined(__CYGWIN__) +#include <windows.h> +#endif + #include "cmAlgorithms.h" #include "cmCPackPropertiesGenerator.h" #include "cmComputeTargetDepends.h" @@ -42,6 +39,7 @@ #include "cmStateDirectory.h" #include "cmStateTypes.h" #include "cmVersion.h" +#include "cmWorkingDirectory.h" #include "cmake.h" #if defined(CMAKE_BUILD_WITH_CMAKE) @@ -50,6 +48,10 @@ #include <cm_jsoncpp_writer.h> #endif +#if defined(_MSC_VER) && _MSC_VER >= 1800 +#define KWSYS_WINDOWS_DEPRECATED_GetVersionEx +#endif + const std::string kCMAKE_PLATFORM_INFO_INITIALIZED = "CMAKE_PLATFORM_INFO_INITIALIZED"; @@ -94,6 +96,7 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm) this->ConfigureDoneCMP0026AndCMP0024 = false; this->FirstTimeProgress = 0.0f; + cm->GetState()->SetIsGeneratorMultiConfig(false); cm->GetState()->SetMinGWMake(false); cm->GetState()->SetMSYSShell(false); cm->GetState()->SetNMake(false); @@ -1194,6 +1197,11 @@ void cmGlobalGenerator::AddCMP0042WarnTarget(const std::string& target) this->CMP0042WarnTargets.insert(target); } +void cmGlobalGenerator::AddCMP0068WarnTarget(const std::string& target) +{ + this->CMP0068WarnTargets.insert(target); +} + bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const { // If the property is not enabled then okay. @@ -1235,6 +1243,8 @@ bool cmGlobalGenerator::Compute() // clear targets to issue warning CMP0042 for this->CMP0042WarnTargets.clear(); + // clear targets to issue warning CMP0068 for + this->CMP0068WarnTargets.clear(); // Check whether this generator is allowed to run. if (!this->CheckALLOW_DUPLICATE_CUSTOM_TARGETS()) { @@ -1366,6 +1376,24 @@ void cmGlobalGenerator::Generate() this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str()); } + if (!this->CMP0068WarnTargets.empty()) { + std::ostringstream w; + /* clang-format off */ + w << + cmPolicies::GetPolicyWarning(cmPolicies::CMP0068) << "\n" + "For compatibility with older versions of CMake, the install_name " + "fields for the following targets are still affected by RPATH " + "settings:\n" + ; + /* clang-format on */ + for (std::set<std::string>::iterator iter = + this->CMP0068WarnTargets.begin(); + iter != this->CMP0068WarnTargets.end(); ++iter) { + w << " " << *iter << "\n"; + } + this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + } + this->CMakeInstance->UpdateProgress("Generating done", -1); } @@ -1738,8 +1766,7 @@ int cmGlobalGenerator::Build(const std::string& /*unused*/, /** * Run an executable command and put the stdout in output. */ - std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(bindir); + cmWorkingDirectory workdir(bindir); output += "Change Dir: "; output += bindir; output += "\n"; @@ -1779,8 +1806,6 @@ int cmGlobalGenerator::Build(const std::string& /*unused*/, output += *outputPtr; output += "\nGenerator: execution of make clean failed.\n"; - // return to the original directory - cmSystemTools::ChangeDirectory(cwd); return 1; } output += *outputPtr; @@ -1803,8 +1828,6 @@ int cmGlobalGenerator::Build(const std::string& /*unused*/, output += "\nGenerator: execution of make failed. Make command was: " + makeCommandStr + "\n"; - // return to the original directory - cmSystemTools::ChangeDirectory(cwd); return 1; } output += *outputPtr; @@ -1817,7 +1840,6 @@ int cmGlobalGenerator::Build(const std::string& /*unused*/, retVal = 1; } - cmSystemTools::ChangeDirectory(cwd); return retVal; } @@ -2466,6 +2488,11 @@ std::string cmGlobalGenerator::GenerateRuleFile( return ruleFile; } +bool cmGlobalGenerator::ShouldStripResourcePath(cmMakefile* mf) const +{ + return mf->PlatformIsAppleIos(); +} + std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage( std::string const& l) const { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 18e3730..b228d41 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -333,10 +333,16 @@ public: virtual bool UseFolderProperty() const; + virtual bool IsIPOSupported() const { return false; } + /** Return whether the generator should use EFFECTIVE_PLATFORM_NAME. This is relevant for mixed macOS and iOS builds. */ virtual bool UseEffectivePlatformName(cmMakefile*) const { return false; } + /** Return whether the "Resources" folder prefix should be stripped from + MacFolder. */ + virtual bool ShouldStripResourcePath(cmMakefile*) const; + std::string GetSharedLibFlagsForLanguage(std::string const& lang) const; /** Generate an <output>.rule file path for a given command output. */ @@ -357,6 +363,7 @@ public: cmExportBuildFileGenerator* GetExportedTargetsFile( const std::string& filename) const; void AddCMP0042WarnTarget(const std::string& target); + void AddCMP0068WarnTarget(const std::string& target); virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; @@ -562,6 +569,8 @@ private: // track targets to issue CMP0042 warning for. std::set<std::string> CMP0042WarnTargets; + // track targets to issue CMP0068 warning for. + std::set<std::string> CMP0068WarnTargets; mutable std::map<cmSourceFile*, std::set<cmGeneratorTarget const*> > FilenameTargetDepends; diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index a51e919..956af51 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -99,6 +99,8 @@ public: */ static bool SupportsPlatform() { return false; } + bool IsIPOSupported() const CM_OVERRIDE { return true; } + /** * Write a build statement to @a os with the @a comment using * the @a rule the list of @a outputs files and inputs. diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 67d7bc9..bbf9f0f 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -149,6 +149,8 @@ public: /** Does the make tool tolerate .DELETE_ON_ERROR? */ virtual bool AllowDeleteOnError() const { return true; } + bool IsIPOSupported() const CM_OVERRIDE { return true; } + void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const CM_OVERRIDE; std::string IncludeDirective; diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index e27615a..ca98e6c 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -10,14 +10,25 @@ #include "cmSourceFile.h" #include "cmVS10CLFlagTable.h" #include "cmVS10CSharpFlagTable.h" +#include "cmVS10CudaFlagTable.h" +#include "cmVS10CudaHostFlagTable.h" #include "cmVS10LibFlagTable.h" #include "cmVS10LinkFlagTable.h" #include "cmVS10MASMFlagTable.h" +#include "cmVS10NASMFlagTable.h" #include "cmVS10RCFlagTable.h" +#include "cmVersion.h" #include "cmVisualStudioSlnData.h" #include "cmVisualStudioSlnParser.h" +#include "cmXMLWriter.h" #include "cmake.h" +#include <cmsys/FStream.hxx> +#include <cmsys/Glob.hxx> +#include <cmsys/RegularExpression.hxx> + +#include <algorithm> + static const char vs10generatorName[] = "Visual Studio 10 2010"; // Map generator name without year to name with year. @@ -94,6 +105,7 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0\\Setup\\VC;" "ProductDir", vc10Express, cmSystemTools::KeyWOW64_32); + this->CudaEnabled = false; this->SystemIsWindowsCE = false; this->SystemIsWindowsPhone = false; this->SystemIsWindowsStore = false; @@ -112,7 +124,10 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( this->DefaultCSharpFlagTable = cmVS10CSharpFlagTable; this->DefaultLibFlagTable = cmVS10LibFlagTable; this->DefaultLinkFlagTable = cmVS10LinkFlagTable; + this->DefaultCudaFlagTable = cmVS10CudaFlagTable; + this->DefaultCudaHostFlagTable = cmVS10CudaHostFlagTable; this->DefaultMasmFlagTable = cmVS10MASMFlagTable; + this->DefaultNasmFlagTable = cmVS10NASMFlagTable; this->DefaultRcFlagTable = cmVS10RCFlagTable; this->Version = VS10; } @@ -153,6 +168,13 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorPlatform( return true; } +static void cmCudaToolVersion(std::string& s) +{ + // "CUDA x.y.props" => "x.y" + s = s.substr(5); + s = s.substr(0, s.size() - 6); +} + bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( std::string const& ts, cmMakefile* mf) { @@ -168,36 +190,119 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( if (!this->ParseGeneratorToolset(ts, mf)) { return false; } + + if (!this->FindVCTargetsPath(mf)) { + return false; + } + + if (this->GeneratorToolsetCuda.empty()) { + // Find the highest available version of the CUDA tools. + std::vector<std::string> cudaTools; + std::string const bcDir = this->VCTargetsPath + "/BuildCustomizations"; + cmsys::Glob gl; + gl.SetRelative(bcDir.c_str()); + if (gl.FindFiles(bcDir + "/CUDA *.props")) { + cudaTools = gl.GetFiles(); + } + if (!cudaTools.empty()) { + std::for_each(cudaTools.begin(), cudaTools.end(), cmCudaToolVersion); + std::sort(cudaTools.begin(), cudaTools.end(), + cmSystemTools::VersionCompareGreater); + this->GeneratorToolsetCuda = cudaTools.at(0); + } + } + if (const char* toolset = this->GetPlatformToolset()) { mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET", toolset); } if (const char* hostArch = this->GetPlatformToolsetHostArchitecture()) { mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE", hostArch); } + if (const char* cuda = this->GetPlatformToolsetCuda()) { + mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_CUDA", cuda); + } return true; } bool cmGlobalVisualStudio10Generator::ParseGeneratorToolset( std::string const& ts, cmMakefile* mf) { - if (ts.find_first_of(",=") != ts.npos) { - std::ostringstream e; - /* clang-format off */ - e << - "Generator\n" - " " << this->GetName() << "\n" - "does not recognize the toolset\n" - " " << ts << "\n" - "that was specified."; - /* clang-format on */ - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); - return false; + std::vector<std::string> const fields = cmSystemTools::tokenize(ts, ","); + std::vector<std::string>::const_iterator fi = fields.begin(); + if (fi == fields.end()) { + return true; + } + + // The first field may be the VS platform toolset. + if (fi->find('=') == fi->npos) { + this->GeneratorToolset = *fi; + ++fi; + } + + std::set<std::string> handled; + + // The rest of the fields must be key=value pairs. + for (; fi != fields.end(); ++fi) { + std::string::size_type pos = fi->find('='); + if (pos == fi->npos) { + std::ostringstream e; + /* clang-format off */ + e << + "Generator\n" + " " << this->GetName() << "\n" + "given toolset specification\n" + " " << ts << "\n" + "that contains a field after the first ',' with no '='." + ; + /* clang-format on */ + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; + } + std::string const key = fi->substr(0, pos); + std::string const value = fi->substr(pos + 1); + if (!handled.insert(key).second) { + std::ostringstream e; + /* clang-format off */ + e << + "Generator\n" + " " << this->GetName() << "\n" + "given toolset specification\n" + " " << ts << "\n" + "that contains duplicate field key '" << key << "'." + ; + /* clang-format on */ + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; + } + if (!this->ProcessGeneratorToolsetField(key, value)) { + std::ostringstream e; + /* clang-format off */ + e << + "Generator\n" + " " << this->GetName() << "\n" + "given toolset specification\n" + " " << ts << "\n" + "that contains invalid field '" << *fi << "'." + ; + /* clang-format on */ + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; + } } - this->GeneratorToolset = ts; return true; } +bool cmGlobalVisualStudio10Generator::ProcessGeneratorToolsetField( + std::string const& key, std::string const& value) +{ + if (key == "cuda") { + this->GeneratorToolsetCuda = value; + return true; + } + return false; +} + bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf) { if (this->SystemName == "Windows") { @@ -354,6 +459,16 @@ void cmGlobalVisualStudio10Generator::Generate() void cmGlobalVisualStudio10Generator::EnableLanguage( std::vector<std::string> const& lang, cmMakefile* mf, bool optional) { + for (std::vector<std::string>::const_iterator it = lang.begin(); + it != lang.end(); ++it) { + if (*it == "ASM_NASM") { + this->NasmEnabled = true; + } + if (*it == "CUDA") { + this->CudaEnabled = true; + } + } + this->AddPlatformDefinitions(mf); cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional); } @@ -388,6 +503,20 @@ cmGlobalVisualStudio10Generator::GetPlatformToolsetHostArchitecture() const return CM_NULLPTR; } +const char* cmGlobalVisualStudio10Generator::GetPlatformToolsetCuda() const +{ + if (!this->GeneratorToolsetCuda.empty()) { + return this->GeneratorToolsetCuda.c_str(); + } + return CM_NULLPTR; +} + +std::string const& +cmGlobalVisualStudio10Generator::GetPlatformToolsetCudaString() const +{ + return this->GeneratorToolsetCuda; +} + bool cmGlobalVisualStudio10Generator::FindMakeProgram(cmMakefile* mf) { if (!this->cmGlobalVisualStudio8Generator::FindMakeProgram(mf)) { @@ -442,6 +571,208 @@ std::string cmGlobalVisualStudio10Generator::FindDevEnvCommand() return this->cmGlobalVisualStudio71Generator::FindDevEnvCommand(); } +bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) +{ + // Skip this in special cases within our own test suite. + if (this->GetPlatformName() == "Test Platform" || + this->GetPlatformToolsetString() == "Test Toolset") { + return true; + } + + std::string wd; + if (!this->ConfiguredFilesPath.empty()) { + // In a try-compile we are given the outer CMakeFiles directory. + wd = this->ConfiguredFilesPath; + } else { + wd = this->GetCMakeInstance()->GetHomeOutputDirectory(); + wd += cmake::GetCMakeFilesDirectory(); + } + wd += "/"; + wd += cmVersion::GetCMakeVersion(); + + // We record the result persistently in a file. + std::string const txt = wd + "/VCTargetsPath.txt"; + + // If we have a recorded result, use it. + { + cmsys::ifstream fin(txt.c_str()); + if (fin && cmSystemTools::GetLineFromStream(fin, this->VCTargetsPath) && + cmSystemTools::FileIsDirectory(this->VCTargetsPath)) { + cmSystemTools::ConvertToUnixSlashes(this->VCTargetsPath); + return true; + } + } + + // Prepare the work directory. + if (!cmSystemTools::MakeDirectory(wd)) { + std::string e = "Failed to make directory:\n " + wd; + mf->IssueMessage(cmake::FATAL_ERROR, e.c_str()); + cmSystemTools::SetFatalErrorOccured(); + return false; + } + + // Generate a project file for MSBuild to tell us the VCTargetsPath value. + std::string const vcxproj = "VCTargetsPath.vcxproj"; + { + std::string const vcxprojAbs = wd + "/" + vcxproj; + cmsys::ofstream fout(vcxprojAbs.c_str()); + cmXMLWriter xw(fout); + + /* clang-format off */ + xw.StartDocument(); + xw.StartElement("Project"); + xw.Attribute("DefaultTargets", "Build"); + xw.Attribute("ToolsVersion", "4.0"); + xw.Attribute("xmlns", + "http://schemas.microsoft.com/developer/msbuild/2003"); + if (this->IsNsightTegra()) { + xw.StartElement("PropertyGroup"); + xw.Attribute("Label", "NsightTegraProject"); + xw.StartElement("NsightTegraProjectRevisionNumber"); + xw.Content("6"); + xw.EndElement(); // NsightTegraProjectRevisionNumber + xw.EndElement(); // PropertyGroup + } + xw.StartElement("ItemGroup"); + xw.Attribute("Label", "ProjectConfigurations"); + xw.StartElement("ProjectConfiguration"); + xw.Attribute("Include", "Debug|" + this->GetPlatformName()); + xw.StartElement("Configuration"); + xw.Content("Debug"); + xw.EndElement(); // Configuration + xw.StartElement("Platform"); + xw.Content(this->GetPlatformName()); + xw.EndElement(); // Platform + xw.EndElement(); // ProjectConfiguration + xw.EndElement(); // ItemGroup + xw.StartElement("PropertyGroup"); + xw.Attribute("Label", "Globals"); + xw.StartElement("ProjectGUID"); + xw.Content("{F3FC6D86-508D-3FB1-96D2-995F08B142EC}"); + xw.EndElement(); // ProjectGUID + xw.StartElement("Keyword"); + xw.Content("Win32Proj"); + xw.EndElement(); // Keyword + xw.StartElement("Platform"); + xw.Content(this->GetPlatformName()); + xw.EndElement(); // Platform + if (this->GetSystemName() == "WindowsPhone") { + xw.StartElement("ApplicationType"); + xw.Content("Windows Phone"); + xw.EndElement(); // ApplicationType + xw.StartElement("ApplicationTypeRevision"); + xw.Content(this->GetSystemVersion()); + xw.EndElement(); // ApplicationTypeRevision + } else if (this->GetSystemName() == "WindowsStore") { + xw.StartElement("ApplicationType"); + xw.Content("Windows Store"); + xw.EndElement(); // ApplicationType + xw.StartElement("ApplicationTypeRevision"); + xw.Content(this->GetSystemVersion()); + xw.EndElement(); // ApplicationTypeRevision + } + if (!this->WindowsTargetPlatformVersion.empty()) { + xw.StartElement("WindowsTargetPlatformVersion"); + xw.Content(this->WindowsTargetPlatformVersion); + xw.EndElement(); // WindowsTargetPlatformVersion + } + if (this->GetPlatformName() == "ARM") { + xw.StartElement("WindowsSDKDesktopARMSupport"); + xw.Content("true"); + xw.EndElement(); // WindowsSDKDesktopARMSupport + } + xw.EndElement(); // PropertyGroup + xw.StartElement("Import"); + xw.Attribute("Project", + "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); + xw.EndElement(); // Import + if (!this->GeneratorToolsetHostArchitecture.empty()) { + xw.StartElement("PropertyGroup"); + xw.StartElement("PreferredToolArchitecture"); + xw.Content(this->GeneratorToolsetHostArchitecture); + xw.EndElement(); // PreferredToolArchitecture + xw.EndElement(); // PropertyGroup + } + xw.StartElement("PropertyGroup"); + xw.Attribute("Label", "Configuration"); + xw.StartElement("ConfigurationType"); + if (this->IsNsightTegra()) { + // Tegra-Android platform does not understand "Utility". + xw.Content("StaticLibrary"); + } else { + xw.Content("Utility"); + } + xw.EndElement(); // ConfigurationType + xw.StartElement("CharacterSet"); + xw.Content("MultiByte"); + xw.EndElement(); // CharacterSet + if (this->IsNsightTegra()) { + xw.StartElement("NdkToolchainVersion"); + xw.Content(this->GetPlatformToolsetString()); + xw.EndElement(); // NdkToolchainVersion + } else { + xw.StartElement("PlatformToolset"); + xw.Content(this->GetPlatformToolsetString()); + xw.EndElement(); // PlatformToolset + } + xw.EndElement(); // PropertyGroup + xw.StartElement("Import"); + xw.Attribute("Project", "$(VCTargetsPath)\\Microsoft.Cpp.props"); + xw.EndElement(); // Import + xw.StartElement("ItemDefinitionGroup"); + xw.StartElement("PostBuildEvent"); + xw.StartElement("Command"); + xw.Content("echo VCTargetsPath=$(VCTargetsPath)"); + xw.EndElement(); // Command + xw.EndElement(); // PostBuildEvent + xw.EndElement(); // ItemDefinitionGroup + xw.StartElement("Import"); + xw.Attribute("Project", + "$(VCTargetsPath)\\Microsoft.Cpp.targets"); + xw.EndElement(); // Import + xw.EndElement(); // Project + xw.EndDocument(); + /* clang-format on */ + } + + std::vector<std::string> cmd; + cmd.push_back(this->GetMSBuildCommand()); + cmd.push_back(vcxproj); + cmd.push_back(std::string("/p:VisualStudioVersion=") + + this->GetIDEVersion()); + std::string out; + int ret = 0; + cmsys::RegularExpression regex("\n *VCTargetsPath=([^%\r\n]+)[\r\n]"); + if (!cmSystemTools::RunSingleCommand(cmd, &out, &out, &ret, wd.c_str(), + cmSystemTools::OUTPUT_NONE) || + ret != 0 || !regex.find(out)) { + cmSystemTools::ReplaceString(out, "\n", "\n "); + std::ostringstream e; + /* clang-format off */ + e << + "Failed to run MSBuild command:\n" + " " << cmd[0] << "\n" + "to get the value of VCTargetsPath:\n" + " " << out << "\n" + ; + /* clang-format on */ + if (ret != 0) { + e << "Exit code: " << ret << "\n"; + } + mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + cmSystemTools::SetFatalErrorOccured(); + return false; + } + this->VCTargetsPath = regex.match(1); + cmSystemTools::ConvertToUnixSlashes(this->VCTargetsPath); + + { + cmsys::ofstream fout(txt.c_str()); + fout << this->VCTargetsPath << "\n"; + } + return true; +} + void cmGlobalVisualStudio10Generator::GenerateBuildCommand( std::vector<std::string>& makeCommand, const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, @@ -656,6 +987,17 @@ cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetLinkFlagTable() const return (table != CM_NULLPTR) ? table : this->DefaultLinkFlagTable; } +cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetCudaFlagTable() const +{ + return this->DefaultCudaFlagTable; +} + +cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetCudaHostFlagTable() + const +{ + return this->DefaultCudaHostFlagTable; +} + cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetMasmFlagTable() const { cmIDEFlagTable const* table = this->ToolsetOptions.GetMasmFlagTable( @@ -663,3 +1005,8 @@ cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetMasmFlagTable() const return (table != CM_NULLPTR) ? table : this->DefaultMasmFlagTable; } + +cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetNasmFlagTable() const +{ + return this->DefaultNasmFlagTable; +} diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 5bfaf38..20f992a 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -23,7 +23,6 @@ public: virtual bool SetSystemName(std::string const& s, cmMakefile* mf); virtual bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf); virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf); - virtual bool ParseGeneratorToolset(std::string const& ts, cmMakefile* mf); virtual void GenerateBuildCommand( std::vector<std::string>& makeCommand, const std::string& makeProgram, @@ -43,6 +42,8 @@ public: cmMakefile*, bool optional); virtual void WriteSLNHeader(std::ostream& fout); + bool IsCudaEnabled() const { return this->CudaEnabled; } + /** Generating for Nsight Tegra VS plugin? */ bool IsNsightTegra() const; std::string GetNsightTegraVersion() const; @@ -54,6 +55,10 @@ public: /** The toolset host architecture name (e.g. x64 for 64-bit host tools). */ const char* GetPlatformToolsetHostArchitecture() const; + /** The cuda toolset version. */ + const char* GetPlatformToolsetCuda() const; + std::string const& GetPlatformToolsetCudaString() const; + /** Return the CMAKE_SYSTEM_NAME. */ std::string const& GetSystemName() const { return this->SystemName; } @@ -95,7 +100,10 @@ public: cmIDEFlagTable const* GetRcFlagTable() const; cmIDEFlagTable const* GetLibFlagTable() const; cmIDEFlagTable const* GetLinkFlagTable() const; + cmIDEFlagTable const* GetCudaFlagTable() const; + cmIDEFlagTable const* GetCudaHostFlagTable() const; cmIDEFlagTable const* GetMasmFlagTable() const; + cmIDEFlagTable const* GetNasmFlagTable() const; protected: virtual void Generate(); @@ -105,6 +113,9 @@ protected: virtual bool InitializeWindowsPhone(cmMakefile* mf); virtual bool InitializeWindowsStore(cmMakefile* mf); + virtual bool ProcessGeneratorToolsetField(std::string const& key, + std::string const& value); + virtual std::string SelectWindowsCEToolset() const; virtual bool SelectWindowsPhoneToolset(std::string& toolset) const; virtual bool SelectWindowsStoreToolset(std::string& toolset) const; @@ -115,6 +126,7 @@ protected: std::string GeneratorToolset; std::string GeneratorToolsetHostArchitecture; + std::string GeneratorToolsetCuda; std::string DefaultPlatformToolset; std::string WindowsTargetPlatformVersion; std::string SystemName; @@ -124,7 +136,10 @@ protected: cmIDEFlagTable const* DefaultCSharpFlagTable; cmIDEFlagTable const* DefaultLibFlagTable; cmIDEFlagTable const* DefaultLinkFlagTable; + cmIDEFlagTable const* DefaultCudaFlagTable; + cmIDEFlagTable const* DefaultCudaHostFlagTable; cmIDEFlagTable const* DefaultMasmFlagTable; + cmIDEFlagTable const* DefaultNasmFlagTable; cmIDEFlagTable const* DefaultRcFlagTable; bool SystemIsWindowsCE; bool SystemIsWindowsPhone; @@ -154,6 +169,13 @@ private: virtual std::string FindDevEnvCommand(); virtual std::string GetVSMakeProgram() { return this->GetMSBuildCommand(); } + bool ParseGeneratorToolset(std::string const& ts, cmMakefile* mf); + + std::string VCTargetsPath; + bool FindVCTargetsPath(cmMakefile* mf); + + bool CudaEnabled; + // We do not use the reload macros for VS >= 10. virtual std::string GetUserMacrosDirectory() { return ""; } }; diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 2656dcc..de62ff0 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -109,19 +109,15 @@ bool cmGlobalVisualStudio12Generator::MatchesGeneratorName( return false; } -bool cmGlobalVisualStudio12Generator::ParseGeneratorToolset( - std::string const& ts, cmMakefile* mf) +bool cmGlobalVisualStudio12Generator::ProcessGeneratorToolsetField( + std::string const& key, std::string const& value) { - std::string::size_type ts_end = ts.size(); - if (cmHasLiteralSuffix(ts, ",host=x64")) { + if (key == "host" && value == "x64") { this->GeneratorToolsetHostArchitecture = "x64"; - ts_end -= 9; - } else if (ts == "host=x64") { - this->GeneratorToolsetHostArchitecture = "x64"; - ts_end = 0; + return true; } - return this->cmGlobalVisualStudio11Generator::ParseGeneratorToolset( - ts.substr(0, ts_end), mf); + return this->cmGlobalVisualStudio11Generator::ProcessGeneratorToolsetField( + key, value); } bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf) diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h index 79efe52..3453628 100644 --- a/Source/cmGlobalVisualStudio12Generator.h +++ b/Source/cmGlobalVisualStudio12Generator.h @@ -31,8 +31,8 @@ public: // version number virtual const char* GetToolsVersion() { return "12.0"; } protected: - bool ParseGeneratorToolset(std::string const& ts, - cmMakefile* mf) CM_OVERRIDE; + bool ProcessGeneratorToolsetField(std::string const& key, + std::string const& value) CM_OVERRIDE; virtual bool InitializeWindowsPhone(cmMakefile* mf); virtual bool InitializeWindowsStore(cmMakefile* mf); diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 81c305c..d2ac36b 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -238,8 +238,7 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion() // Skip SDKs that do not contain <um/windows.h> because that indicates that // only the UCRT MSIs were installed for them. - sdks.erase(std::remove_if(sdks.begin(), sdks.end(), NoWindowsH()), - sdks.end()); + cmEraseIf(sdks, NoWindowsH()); if (!sdks.empty()) { // Only use the filename, which will be the SDK version. diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 55a788f..3f8d381 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -249,7 +249,7 @@ void cmGlobalVisualStudio71Generator::WriteExternalProject( // Write a dsp file into the SLN file, Note, that dependencies from // executables to the libraries it uses are also done here void cmGlobalVisualStudio71Generator::WriteProjectConfigurations( - std::ostream& fout, const std::string& name, cmStateEnums::TargetType, + std::ostream& fout, const std::string& name, cmGeneratorTarget const& target, std::vector<std::string> const& configs, const std::set<std::string>& configsPartOfDefaultBuild, std::string const& platformMapping) @@ -259,13 +259,18 @@ void cmGlobalVisualStudio71Generator::WriteProjectConfigurations( std::string guid = this->GetGUID(name); for (std::vector<std::string>::const_iterator i = configs.begin(); i != configs.end(); ++i) { - fout << "\t\t{" << guid << "}." << *i << ".ActiveCfg = " << *i << "|" - << platformName << std::endl; + const char* dstConfig = target.GetProperty("MAP_IMPORTED_CONFIG_" + + cmSystemTools::UpperCase(*i)); + if (dstConfig == CM_NULLPTR) { + dstConfig = i->c_str(); + } + fout << "\t\t{" << guid << "}." << *i << ".ActiveCfg = " << dstConfig + << "|" << platformName << std::endl; std::set<std::string>::const_iterator ci = configsPartOfDefaultBuild.find(*i); if (!(ci == configsPartOfDefaultBuild.end())) { - fout << "\t\t{" << guid << "}." << *i << ".Build.0 = " << *i << "|" - << platformName << std::endl; + fout << "\t\t{" << guid << "}." << *i << ".Build.0 = " << dstConfig + << "|" << platformName << std::endl; } } } diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index 9953047..c65a84a 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -56,8 +56,8 @@ protected: const char* path, cmGeneratorTarget const* t); virtual void WriteProjectConfigurations( - std::ostream& fout, const std::string& name, cmStateEnums::TargetType type, - std::vector<std::string> const& configs, + std::ostream& fout, const std::string& name, + cmGeneratorTarget const& target, std::vector<std::string> const& configs, const std::set<std::string>& configsPartOfDefaultBuild, const std::string& platformMapping = ""); virtual void WriteExternalProject(std::ostream& fout, diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 602666e..2d0abf9 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -1,7 +1,5 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#include "windows.h" // this must be first to define GetCurrentDirectory - #include "cmGlobalVisualStudio7Generator.h" #include "cmGeneratedFileStream.h" @@ -14,6 +12,7 @@ #include <cmsys/Encoding.hxx> #include <assert.h> +#include <windows.h> static cmVS7FlagTable cmVS7ExtraFlagTable[] = { // Precompiled header and related options. Note that the @@ -47,6 +46,7 @@ cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator( this->IntelProjectVersion = 0; this->DevEnvCommandInitialized = false; this->MasmEnabled = false; + this->NasmEnabled = false; if (platformName.empty()) { this->DefaultPlatformName = "Win32"; @@ -356,16 +356,16 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( if (expath) { std::set<std::string> allConfigurations(configs.begin(), configs.end()); const char* mapping = target->GetProperty("VS_PLATFORM_MAPPING"); - this->WriteProjectConfigurations( - fout, target->GetName().c_str(), target->GetType(), configs, - allConfigurations, mapping ? mapping : ""); + this->WriteProjectConfigurations(fout, target->GetName().c_str(), + *target, configs, allConfigurations, + mapping ? mapping : ""); } else { const std::set<std::string>& configsPartOfDefaultBuild = this->IsPartOfDefaultBuild(configs, projectTargets, target); const char* vcprojName = target->GetProperty("GENERATOR_FILE_NAME"); if (vcprojName) { - this->WriteProjectConfigurations(fout, vcprojName, target->GetType(), - configs, configsPartOfDefaultBuild); + this->WriteProjectConfigurations(fout, vcprojName, *target, configs, + configsPartOfDefaultBuild); } } } diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 62194c3..32a8d60 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -95,6 +95,7 @@ public: /** Is the Microsoft Assembler enabled? */ bool IsMasmEnabled() const { return this->MasmEnabled; } + bool IsNasmEnabled() const { return this->NasmEnabled; } // Encoding for Visual Studio files virtual std::string Encoding(); @@ -120,8 +121,8 @@ protected: const char* path, cmGeneratorTarget const* t) = 0; virtual void WriteProjectConfigurations( - std::ostream& fout, const std::string& name, cmStateEnums::TargetType type, - std::vector<std::string> const& configs, + std::ostream& fout, const std::string& name, + cmGeneratorTarget const& target, std::vector<std::string> const& configs, const std::set<std::string>& configsPartOfDefaultBuild, const std::string& platformMapping = "") = 0; virtual void WriteSLNGlobalSections(std::ostream& fout, @@ -163,6 +164,7 @@ protected: std::string GeneratorPlatform; std::string DefaultPlatformName; bool MasmEnabled; + bool NasmEnabled; private: char* IntelProjectVersion; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 8353a3f..634db7f 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -353,7 +353,7 @@ void cmGlobalVisualStudio8Generator::WriteSolutionConfigurations( } void cmGlobalVisualStudio8Generator::WriteProjectConfigurations( - std::ostream& fout, const std::string& name, cmStateEnums::TargetType type, + std::ostream& fout, const std::string& name, cmGeneratorTarget const& target, std::vector<std::string> const& configs, const std::set<std::string>& configsPartOfDefaultBuild, std::string const& platformMapping) @@ -361,8 +361,13 @@ void cmGlobalVisualStudio8Generator::WriteProjectConfigurations( std::string guid = this->GetGUID(name); for (std::vector<std::string>::const_iterator i = configs.begin(); i != configs.end(); ++i) { + const char* dstConfig = target.GetProperty("MAP_IMPORTED_CONFIG_" + + cmSystemTools::UpperCase(*i)); + if (dstConfig == CM_NULLPTR) { + dstConfig = i->c_str(); + } fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName() - << ".ActiveCfg = " << *i << "|" + << ".ActiveCfg = " << dstConfig << "|" << (!platformMapping.empty() ? platformMapping : this->GetPlatformName()) << "\n"; @@ -370,14 +375,14 @@ void cmGlobalVisualStudio8Generator::WriteProjectConfigurations( configsPartOfDefaultBuild.find(*i); if (!(ci == configsPartOfDefaultBuild.end())) { fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName() - << ".Build.0 = " << *i << "|" + << ".Build.0 = " << dstConfig << "|" << (!platformMapping.empty() ? platformMapping : this->GetPlatformName()) << "\n"; } - if (this->NeedsDeploy(type)) { + if (this->NeedsDeploy(target.GetType())) { fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName() - << ".Deploy.0 = " << *i << "|" + << ".Deploy.0 = " << dstConfig << "|" << (!platformMapping.empty() ? platformMapping : this->GetPlatformName()) << "\n"; diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 53feb47..03fa077 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -82,8 +82,8 @@ protected: virtual void WriteSolutionConfigurations( std::ostream& fout, std::vector<std::string> const& configs); virtual void WriteProjectConfigurations( - std::ostream& fout, const std::string& name, cmStateEnums::TargetType type, - std::vector<std::string> const& configs, + std::ostream& fout, const std::string& name, + cmGeneratorTarget const& target, std::vector<std::string> const& configs, const std::set<std::string>& configsPartOfDefaultBuild, const std::string& platformMapping = ""); virtual bool ComputeTargetDepends(); diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index ced0c26..6d16881 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -5,6 +5,7 @@ #include <cmsys/Encoding.hxx> #include <iostream> +#include <windows.h> #include "cmAlgorithms.h" #include "cmCallVisualStudioMacro.h" @@ -19,6 +20,7 @@ cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator(cmake* cm) : cmGlobalGenerator(cm) { + cm->GetState()->SetIsGeneratorMultiConfig(true); cm->GetState()->SetWindowsShell(true); cm->GetState()->SetWindowsVSIDE(true); } @@ -441,8 +443,6 @@ std::string cmGlobalVisualStudioGenerator::GetStartupProjectName( return this->GetAllTargetName(); } -#include <windows.h> - bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile, const std::string& regKeyBase, std::string& nextAvailableSubKeyName) @@ -730,12 +730,26 @@ bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly( return false; } } + // If there's only one source language, Fortran has to be used + // in order for the sources to compile. + // Note: Via linker propagation, LINKER_LANGUAGE could become CXX in + // this situation and mismatch from the actual language of the linker. gt->GetLanguages(languages, ""); if (languages.size() == 1) { if (*languages.begin() == "Fortran") { return true; } } + + // In the case of mixed object files or sources mixed with objects, + // decide the language based on the value of LINKER_LANGUAGE. + // This will not make it possible to mix source files of different + // languages, but object libraries will be linked together in the + // same fashion as other generators do. + if (gt->GetLinkerLanguage("") == "Fortran") { + return true; + } + return false; } @@ -814,10 +828,14 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand( cmGeneratorTarget* gt, std::vector<cmCustomCommand>& commands, std::string const& configName) { + cmGeneratorTarget::ModuleDefinitionInfo const* mdi = + gt->GetModuleDefinitionInfo(configName); + if (!mdi || !mdi->DefFileGenerated) { + return; + } + std::vector<std::string> outputs; - std::string deffile = gt->ObjectDirectory; - deffile += "/exportall.def"; - outputs.push_back(deffile); + outputs.push_back(mdi->DefFile); std::vector<std::string> empty; std::vector<cmSourceFile const*> objectSources; gt->GetObjectSources(objectSources, configName); @@ -835,50 +853,59 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand( cmdl.push_back(cmakeCommand); cmdl.push_back("-E"); cmdl.push_back("__create_def"); - cmdl.push_back(deffile); + cmdl.push_back(mdi->DefFile); std::string obj_dir_expanded = obj_dir; cmSystemTools::ReplaceString(obj_dir_expanded, this->GetCMakeCFGIntDir(), configName.c_str()); - std::string objs_file = obj_dir_expanded; - cmSystemTools::MakeDirectory(objs_file.c_str()); - objs_file += "/objects.txt"; + cmSystemTools::MakeDirectory(obj_dir_expanded); + std::string const objs_file = obj_dir_expanded + "/objects.txt"; cmdl.push_back(objs_file); cmGeneratedFileStream fout(objs_file.c_str()); if (!fout) { cmSystemTools::Error("could not open ", objs_file.c_str()); return; } - std::vector<std::string> objs; - for (std::vector<cmSourceFile const*>::const_iterator it = - objectSources.begin(); - it != objectSources.end(); ++it) { - // Find the object file name corresponding to this source file. - std::map<cmSourceFile const*, std::string>::const_iterator map_it = - mapping.find(*it); - // It must exist because we populated the mapping just above. - assert(!map_it->second.empty()); - std::string objFile = obj_dir + map_it->second; - objs.push_back(objFile); - } - std::vector<cmSourceFile const*> externalObjectSources; - gt->GetExternalObjects(externalObjectSources, configName); - for (std::vector<cmSourceFile const*>::const_iterator it = - externalObjectSources.begin(); - it != externalObjectSources.end(); ++it) { - objs.push_back((*it)->GetFullPath()); - } - gt->UseObjectLibraries(objs, configName); - for (std::vector<std::string>::iterator it = objs.begin(); it != objs.end(); - ++it) { - std::string objFile = *it; - // replace $(ConfigurationName) in the object names - cmSystemTools::ReplaceString(objFile, this->GetCMakeCFGIntDir(), - configName.c_str()); - if (cmHasLiteralSuffix(objFile, ".obj")) { - fout << objFile << "\n"; + if (mdi->WindowsExportAllSymbols) { + std::vector<std::string> objs; + for (std::vector<cmSourceFile const*>::const_iterator it = + objectSources.begin(); + it != objectSources.end(); ++it) { + // Find the object file name corresponding to this source file. + std::map<cmSourceFile const*, std::string>::const_iterator map_it = + mapping.find(*it); + // It must exist because we populated the mapping just above. + assert(!map_it->second.empty()); + std::string objFile = obj_dir + map_it->second; + objs.push_back(objFile); + } + std::vector<cmSourceFile const*> externalObjectSources; + gt->GetExternalObjects(externalObjectSources, configName); + for (std::vector<cmSourceFile const*>::const_iterator it = + externalObjectSources.begin(); + it != externalObjectSources.end(); ++it) { + objs.push_back((*it)->GetFullPath()); + } + + gt->UseObjectLibraries(objs, configName); + for (std::vector<std::string>::iterator it = objs.begin(); + it != objs.end(); ++it) { + std::string objFile = *it; + // replace $(ConfigurationName) in the object names + cmSystemTools::ReplaceString(objFile, this->GetCMakeCFGIntDir(), + configName.c_str()); + if (cmHasLiteralSuffix(objFile, ".obj")) { + fout << objFile << "\n"; + } } } + + for (std::vector<cmSourceFile const*>::const_iterator i = + mdi->Sources.begin(); + i != mdi->Sources.end(); ++i) { + fout << (*i)->GetFullPath() << "\n"; + } + cmCustomCommandLines commandLines; commandLines.push_back(cmdl); cmCustomCommand command(gt->Target->GetMakefile(), outputs, empty, empty, diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index dd771b1..febe95d 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -28,6 +28,7 @@ #include "cmTarget.h" #include "cmXCode21Object.h" #include "cmXCodeObject.h" +#include "cmXCodeScheme.h" #include "cm_auto_ptr.hxx" #include "cmake.h" @@ -150,6 +151,8 @@ cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(cmake* cm, this->CurrentMakefile = 0; this->CurrentLocalGenerator = 0; this->XcodeBuildCommandInitialized = false; + + cm->GetState()->SetIsGeneratorMultiConfig(true); } cmGlobalGeneratorFactory* cmGlobalXCodeGenerator::NewFactory() @@ -423,14 +426,12 @@ void cmGlobalXCodeGenerator::AddExtraTargets( // Add XCODE depend helper std::string dir = root->GetCurrentBinaryDirectory(); cmCustomCommandLine makeHelper; - if (this->XcodeVersion < 50) { - makeHelper.push_back("make"); - makeHelper.push_back("-C"); - makeHelper.push_back(dir); - makeHelper.push_back("-f"); - makeHelper.push_back(this->CurrentXCodeHackMakefile); - makeHelper.push_back(""); // placeholder, see below - } + makeHelper.push_back("make"); + makeHelper.push_back("-C"); + makeHelper.push_back(dir); + makeHelper.push_back("-f"); + makeHelper.push_back(this->CurrentXCodeHackMakefile); + makeHelper.push_back(""); // placeholder, see below // Add ZERO_CHECK bool regenerate = !mf->IsOn("CMAKE_SUPPRESS_REGENERATION"); @@ -475,13 +476,12 @@ void cmGlobalXCodeGenerator::AddExtraTargets( // run the depend check makefile as a post build rule // this will make sure that when the next target is built // things are up-to-date - if (!makeHelper.empty() && - (target->GetType() == cmStateEnums::EXECUTABLE || - // Nope - no post-build for OBJECT_LIRBRARY - // target->GetType() == cmStateEnums::OBJECT_LIBRARY || - target->GetType() == cmStateEnums::STATIC_LIBRARY || - target->GetType() == cmStateEnums::SHARED_LIBRARY || - target->GetType() == cmStateEnums::MODULE_LIBRARY)) { + if (target->GetType() == cmStateEnums::OBJECT_LIBRARY || + (this->XcodeVersion < 50 && + (target->GetType() == cmStateEnums::EXECUTABLE || + target->GetType() == cmStateEnums::STATIC_LIBRARY || + target->GetType() == cmStateEnums::SHARED_LIBRARY || + target->GetType() == cmStateEnums::MODULE_LIBRARY))) { makeHelper[makeHelper.size() - 1] = // fill placeholder this->PostBuildMakeTarget(target->GetName(), "$(CONFIGURATION)"); cmCustomCommandLines commandLines; @@ -489,7 +489,8 @@ void cmGlobalXCodeGenerator::AddExtraTargets( std::vector<std::string> no_byproducts; lg->GetMakefile()->AddCustomCommandToTarget( target->GetName(), no_byproducts, no_depends, commandLines, - cmTarget::POST_BUILD, "Depend check for xcode", dir.c_str()); + cmTarget::POST_BUILD, "Depend check for xcode", dir.c_str(), true, + false, "", false, cmMakefile::AcceptObjectLibraryCommands); } if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY && @@ -1155,8 +1156,12 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( // dstPath in frameworks is relative to Versions/<version> ostr << mit->first; } else if (mit->first != "MacOS") { - // dstPath in bundles is relative to Contents/MacOS - ostr << "../" << mit->first.c_str(); + if (gtgt->Target->GetMakefile()->PlatformIsAppleIos()) { + ostr << mit->first; + } else { + // dstPath in bundles is relative to Contents/MacOS + ostr << "../" << mit->first; + } } copyFilesBuildPhase->AddAttribute("dstPath", this->CreateString(ostr.str())); @@ -1174,6 +1179,45 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( } } + // create vector of "resource content file" build phases - only for + // framework or bundle targets + if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) { + typedef std::map<std::string, std::vector<cmSourceFile*> > + mapOfVectorOfSourceFiles; + mapOfVectorOfSourceFiles bundleFiles; + for (std::vector<cmSourceFile*>::const_iterator i = classes.begin(); + i != classes.end(); ++i) { + cmGeneratorTarget::SourceFileFlags tsFlags = + gtgt->GetTargetSourceFileFlags(*i); + if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeDeepResource) { + bundleFiles[tsFlags.MacFolder].push_back(*i); + } + } + mapOfVectorOfSourceFiles::iterator mit; + for (mit = bundleFiles.begin(); mit != bundleFiles.end(); ++mit) { + cmXCodeObject* copyFilesBuildPhase = + this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase); + copyFilesBuildPhase->SetComment("Copy files"); + copyFilesBuildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + copyFilesBuildPhase->AddAttribute("dstSubfolderSpec", + this->CreateString("7")); + copyFilesBuildPhase->AddAttribute("dstPath", + this->CreateString(mit->first)); + copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + copyFilesBuildPhase->AddAttribute("files", buildFiles); + std::vector<cmSourceFile*>::iterator sfIt; + for (sfIt = mit->second.begin(); sfIt != mit->second.end(); ++sfIt) { + cmXCodeObject* xsf = this->CreateXCodeSourceFile( + this->CurrentLocalGenerator, *sfIt, gtgt); + buildFiles->AddObject(xsf); + } + contentBuildPhases.push_back(copyFilesBuildPhase); + } + } + // create framework build phase cmXCodeObject* frameworkBuildPhase = 0; if (!externalObjFiles.empty()) { @@ -1665,6 +1709,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, return; } + // Check IPO related warning/error. + gtgt->IsIPOEnabled(configName); + // Add define flags this->CurrentLocalGenerator->AppendFlags( defFlags, this->CurrentMakefile->GetDefineFlags()); @@ -3133,10 +3180,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( cmXCodeObject* t = *i; this->AddDependAndLinkInformation(t); } - if (this->XcodeVersion < 50) { - // now create xcode depend hack makefile - this->CreateXCodeDependHackTarget(targets); - } + this->CreateXCodeDependHackTarget(targets); // now add all targets to the root object cmXCodeObject* allTargets = this->CreateObject(cmXCodeObject::OBJECT_LIST); for (std::vector<cmXCodeObject*>::iterator i = targets.begin(); @@ -3187,29 +3231,9 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( "default:\n" "\techo \"Do not invoke directly\"\n" "\n"; - makefileStream - << "# For each target create a dummy rule " - "so the target does not have to exist\n"; /* clang-format on */ - std::set<std::string> emitted; - for (std::vector<cmXCodeObject*>::iterator i = targets.begin(); - i != targets.end(); ++i) { - cmXCodeObject* target = *i; - std::map<std::string, cmXCodeObject::StringVec> const& deplibs = - target->GetDependLibraries(); - for (std::map<std::string, cmXCodeObject::StringVec>::const_iterator ci = - deplibs.begin(); - ci != deplibs.end(); ++ci) { - for (cmXCodeObject::StringVec::const_iterator d = ci->second.begin(); - d != ci->second.end(); ++d) { - if (emitted.insert(*d).second) { - makefileStream << this->ConvertToRelativeForMake(d->c_str()) - << ":\n"; - } - } - } - } - makefileStream << "\n\n"; + + std::set<std::string> dummyRules; // Write rules to help Xcode relink things at the right time. /* clang-format off */ @@ -3228,8 +3252,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( cmGeneratorTarget* gt = target->GetTarget(); if (gt->GetType() == cmStateEnums::EXECUTABLE || - // Nope - no post-build for OBJECT_LIRBRARY - // gt->GetType() == cmStateEnums::OBJECT_LIBRARY || + gt->GetType() == cmStateEnums::OBJECT_LIBRARY || gt->GetType() == cmStateEnums::STATIC_LIBRARY || gt->GetType() == cmStateEnums::SHARED_LIBRARY || gt->GetType() == cmStateEnums::MODULE_LIBRARY) { @@ -3239,6 +3262,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( } if (gt->GetType() == cmStateEnums::EXECUTABLE || + gt->GetType() == cmStateEnums::STATIC_LIBRARY || gt->GetType() == cmStateEnums::SHARED_LIBRARY || gt->GetType() == cmStateEnums::MODULE_LIBRARY) { std::string tfull = gt->GetFullPath(configName); @@ -3256,6 +3280,15 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( } } + std::vector<cmGeneratorTarget*> objlibs; + gt->GetObjectLibrariesCMP0026(objlibs); + for (std::vector<cmGeneratorTarget*>::const_iterator it = + objlibs.begin(); + it != objlibs.end(); ++it) { + makefileStream << this->PostBuildMakeTarget((*it)->GetName(), *ct) + << ": " << trel << "\n"; + } + // Create a rule for this target. makefileStream << trel << ":"; @@ -3266,10 +3299,28 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( std::vector<std::string> const& deplibs = x->second; for (std::vector<std::string>::const_iterator d = deplibs.begin(); d != deplibs.end(); ++d) { - makefileStream << "\\\n\t" - << this->ConvertToRelativeForMake(d->c_str()); + std::string file = this->ConvertToRelativeForMake(d->c_str()); + makefileStream << "\\\n\t" << file; + dummyRules.insert(file); } } + + for (std::vector<cmGeneratorTarget*>::const_iterator it = + objlibs.begin(); + it != objlibs.end(); ++it) { + + const std::string objLibName = (*it)->GetName(); + std::string d = this->GetObjectsNormalDirectory(this->CurrentProject, + configName, *it); + d += "lib"; + d += objLibName; + d += ".a"; + + std::string dependency = this->ConvertToRelativeForMake(d.c_str()); + makefileStream << "\\\n\t" << dependency; + dummyRules.insert(dependency); + } + // Write the action to remove the target if it is out of date. makefileStream << "\n"; makefileStream << "\t/bin/rm -f " @@ -3297,6 +3348,14 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( } } } + + makefileStream << "\n\n" + << "# For each target create a dummy rule" + << "so the target does not have to exist\n"; + for (std::set<std::string>::const_iterator it = dummyRules.begin(); + it != dummyRules.end(); ++it) { + makefileStream << *it << ":\n"; + } } void cmGlobalXCodeGenerator::OutputXCodeProject( @@ -3331,6 +3390,15 @@ void cmGlobalXCodeGenerator::OutputXCodeProject( return; } this->WriteXCodePBXProj(fout, root, generators); + + // Since the lowest available Xcode version for testing was 7.0, + // I'm setting this as a limit then + if (root->GetMakefile()->IsOn("CMAKE_XCODE_GENERATE_SCHEME") && + this->XcodeVersion >= 70) { + this->OutputXCodeSharedSchemes(xcodeDir); + this->OutputXCodeWorkspaceSettings(xcodeDir); + } + this->ClearXCodeObjects(); // Since this call may have created new cache entries, save the cache: @@ -3339,6 +3407,54 @@ void cmGlobalXCodeGenerator::OutputXCodeProject( root->GetBinaryDirectory()); } +void cmGlobalXCodeGenerator::OutputXCodeSharedSchemes( + const std::string& xcProjDir) +{ + for (std::vector<cmXCodeObject*>::const_iterator i = + this->XCodeObjects.begin(); + i != this->XCodeObjects.end(); ++i) { + cmXCodeObject* obj = *i; + if (obj->GetType() == cmXCodeObject::OBJECT && + (obj->GetIsA() == cmXCodeObject::PBXNativeTarget || + obj->GetIsA() == cmXCodeObject::PBXAggregateTarget)) { + cmXCodeScheme schm(obj, this->CurrentConfigurationTypes, + this->XcodeVersion); + schm.WriteXCodeSharedScheme(xcProjDir, + this->RelativeToSource(xcProjDir.c_str())); + } + } +} + +void cmGlobalXCodeGenerator::OutputXCodeWorkspaceSettings( + const std::string& xcProjDir) +{ + std::string xcodeSharedDataDir = xcProjDir; + xcodeSharedDataDir += "/project.xcworkspace/xcshareddata"; + cmSystemTools::MakeDirectory(xcodeSharedDataDir); + + std::string workspaceSettingsFile = xcodeSharedDataDir; + workspaceSettingsFile += "/WorkspaceSettings.xcsettings"; + + cmGeneratedFileStream fout(workspaceSettingsFile.c_str()); + fout.SetCopyIfDifferent(true); + if (!fout) { + return; + } + + cmXMLWriter xout(fout); + xout.StartDocument(); + xout.Doctype("plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\"" + "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\""); + xout.StartElement("plist"); + xout.Attribute("version", "1.0"); + xout.StartElement("dict"); + xout.Element("key", "IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded"); + xout.Element("false"); + xout.EndElement(); // dict + xout.EndElement(); // plist + xout.EndDocument(); +} + void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout, cmLocalGenerator*, std::vector<cmLocalGenerator*>&) @@ -3593,6 +3709,12 @@ bool cmGlobalXCodeGenerator::UseEffectivePlatformName(cmMakefile* mf) const return cmSystemTools::IsOn(epnValue); } +bool cmGlobalXCodeGenerator::ShouldStripResourcePath(cmMakefile*) const +{ + // Xcode determines Resource location itself + return true; +} + void cmGlobalXCodeGenerator::ComputeTargetObjectDirectory( cmGeneratorTarget* gt) const { diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 1aaf9c7..172e414 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -88,6 +88,8 @@ public: bool UseEffectivePlatformName(cmMakefile* mf) const CM_OVERRIDE; + bool ShouldStripResourcePath(cmMakefile*) const CM_OVERRIDE; + bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf) CM_OVERRIDE; void AppendFlag(std::string& flags, std::string const& flag); @@ -165,6 +167,9 @@ private: std::vector<cmLocalGenerator*>& generators); void OutputXCodeProject(cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); + // Write shared scheme files for all the native targets + void OutputXCodeSharedSchemes(const std::string& xcProjDir); + void OutputXCodeWorkspaceSettings(const std::string& xcProjDir); void WriteXCodePBXProj(std::ostream& fout, cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); cmXCodeObject* CreateXCodeFileReferenceFromPath(const std::string& fullpath, diff --git a/Source/cmIDEFlagTable.h b/Source/cmIDEFlagTable.h index 64ade76..152e293 100644 --- a/Source/cmIDEFlagTable.h +++ b/Source/cmIDEFlagTable.h @@ -24,6 +24,9 @@ struct cmIDEFlagTable // IgnoreDefaultLibraryNames) UserFollowing = (1 << 5), // expect value in following argument CaseInsensitive = (1 << 6), // flag may be any case + SpaceAppendable = (1 << 7), // a flag that if specified multiple times + // should have its value appended to the + // old value with spaces UserValueIgnored = UserValue | UserIgnored, UserValueRequired = UserValue | UserRequired diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx index 8d07776..bda6b75 100644 --- a/Source/cmIDEOptions.cxx +++ b/Source/cmIDEOptions.cxx @@ -125,6 +125,8 @@ void cmIDEOptions::FlagMapUpdate(cmIDEFlagTable const* entry, this->FlagMap[entry->IDEName] = entry->value; } else if (entry->special & cmIDEFlagTable::SemicolonAppendable) { this->FlagMap[entry->IDEName].push_back(new_value); + } else if (entry->special & cmIDEFlagTable::SpaceAppendable) { + this->FlagMap[entry->IDEName].append_with_space(new_value); } else { // Use the user-specified value. this->FlagMap[entry->IDEName] = new_value; @@ -177,6 +179,12 @@ void cmIDEOptions::AppendFlag(std::string const& flag, std::copy(value.begin(), value.end(), std::back_inserter(fv)); } +void cmIDEOptions::AppendFlagString(std::string const& flag, + std::string const& value) +{ + this->FlagMap[flag].append_with_space(value); +} + void cmIDEOptions::RemoveFlag(const char* flag) { this->FlagMap.erase(flag); diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h index be2fd6d..11f8aba 100644 --- a/Source/cmIDEOptions.h +++ b/Source/cmIDEOptions.h @@ -31,6 +31,7 @@ public: void AppendFlag(std::string const& flag, std::string const& value); void AppendFlag(std::string const& flag, std::vector<std::string> const& value); + void AppendFlagString(std::string const& flag, std::string const& value); void RemoveFlag(const char* flag); bool HasFlag(std::string const& flag) const; const char* GetFlag(const char* flag); @@ -59,15 +60,22 @@ protected: this->derived::operator=(r); return *this; } + FlagValue& append_with_space(std::string const& r) + { + this->resize(1); + std::string& l = this->operator[](0); + if (!l.empty()) { + l += " "; + } + l += r; + return *this; + } }; std::map<std::string, FlagValue> FlagMap; // Preprocessor definitions. std::vector<std::string> Defines; - // Unrecognized flags that get no special handling. - std::string FlagString; - bool DoingDefine; bool AllowDefine; bool AllowSlash; diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index a8fa4f9..421c3dd 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -57,8 +57,19 @@ bool cmIfFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, // watch for our state change if (scopeDepth == 0 && !cmSystemTools::Strucmp(this->Functions[c].Name.c_str(), "else")) { + + if (this->ElseSeen) { + cmListFileBacktrace bt = mf.GetBacktrace(this->Functions[c]); + mf.GetCMakeInstance()->IssueMessage( + cmake::FATAL_ERROR, + "A duplicate ELSE command was found inside an IF block.", bt); + cmSystemTools::SetFatalErrorOccured(); + return true; + } + this->IsBlocking = this->HasRun; this->HasRun = true; + this->ElseSeen = true; // if trace is enabled, print a (trivially) evaluated "else" // statement @@ -68,6 +79,15 @@ bool cmIfFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, } else if (scopeDepth == 0 && !cmSystemTools::Strucmp(this->Functions[c].Name.c_str(), "elseif")) { + if (this->ElseSeen) { + cmListFileBacktrace bt = mf.GetBacktrace(this->Functions[c]); + mf.GetCMakeInstance()->IssueMessage( + cmake::FATAL_ERROR, + "An ELSEIF command was found after an ELSE command.", bt); + cmSystemTools::SetFatalErrorOccured(); + return true; + } + if (this->HasRun) { this->IsBlocking = true; } else { diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index 56eef30..f81db67 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -21,6 +21,7 @@ public: cmIfFunctionBlocker() { this->HasRun = false; + this->ElseSeen = false; this->ScopeDepth = 0; } ~cmIfFunctionBlocker() CM_OVERRIDE {} @@ -32,6 +33,7 @@ public: std::vector<cmListFileFunction> Functions; bool IsBlocking; bool HasRun; + bool ElseSeen; unsigned int ScopeDepth; }; diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx index 6a700ff..6789555 100644 --- a/Source/cmLinkLineDeviceComputer.cxx +++ b/Source/cmLinkLineDeviceComputer.cxx @@ -2,10 +2,18 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmLinkLineDeviceComputer.h" + +#include <set> +#include <sstream> +#include <vector> + #include "cmComputeLinkInformation.h" #include "cmGeneratorTarget.h" #include "cmGlobalNinjaGenerator.h" -#include "cmOutputConverter.h" +#include "cmStateDirectory.h" +#include "cmStateTypes.h" + +class cmOutputConverter; cmLinkLineDeviceComputer::cmLinkLineDeviceComputer( cmOutputConverter* outputConverter, cmStateDirectory stateDir) diff --git a/Source/cmLinkLineDeviceComputer.h b/Source/cmLinkLineDeviceComputer.h index f4bb3eb..f275a0d 100644 --- a/Source/cmLinkLineDeviceComputer.h +++ b/Source/cmLinkLineDeviceComputer.h @@ -4,8 +4,17 @@ #ifndef cmLinkLineDeviceComputer_h #define cmLinkLineDeviceComputer_h +#include <cmConfigure.h> + +#include <string> + #include "cmLinkLineComputer.h" + +class cmComputeLinkInformation; +class cmGeneratorTarget; class cmGlobalNinjaGenerator; +class cmOutputConverter; +class cmStateDirectory; class cmLinkLineDeviceComputer : public cmLinkLineComputer { diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index b1cd889..23b666e 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -80,6 +80,13 @@ bool cmListFileParser::ParseFile() return false; } + if (bom == cmListFileLexer_BOM_Broken) { + cmListFileLexer_SetFileName(this->Lexer, CM_NULLPTR, CM_NULLPTR); + this->IssueFileOpenError("Error while reading Byte-Order-Mark. " + "File not seekable?"); + return false; + } + // Verify the Byte-Order-Mark, if any. if (bom != cmListFileLexer_BOM_None && bom != cmListFileLexer_BOM_UTF8) { cmListFileLexer_SetFileName(this->Lexer, CM_NULLPTR, CM_NULLPTR); diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c index 56559f6..44d0894 100644 --- a/Source/cmListFileLexer.c +++ b/Source/cmListFileLexer.c @@ -2559,11 +2559,15 @@ static cmListFileLexer_BOM cmListFileLexer_ReadBOM(FILE* f) if (fread(b, 1, 2, f) == 2 && b[0] == 0 && b[1] == 0) { return cmListFileLexer_BOM_UTF32LE; } - fsetpos(f, &p); + if (fsetpos(f, &p) != 0) { + return cmListFileLexer_BOM_Broken; + } return cmListFileLexer_BOM_UTF16LE; } } - rewind(f); + if (fseek(f, 0, SEEK_SET) != 0) { + return cmListFileLexer_BOM_Broken; + } return cmListFileLexer_BOM_None; } diff --git a/Source/cmListFileLexer.h b/Source/cmListFileLexer.h index c9fb6da..f243010a 100644 --- a/Source/cmListFileLexer.h +++ b/Source/cmListFileLexer.h @@ -32,6 +32,7 @@ struct cmListFileLexer_Token_s enum cmListFileLexer_BOM_e { cmListFileLexer_BOM_None, + cmListFileLexer_BOM_Broken, cmListFileLexer_BOM_UTF8, cmListFileLexer_BOM_UTF16BE, cmListFileLexer_BOM_UTF16LE, diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index b6743f1..5cf1853 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -2,22 +2,21 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmLoadCommandCommand.h" +#include <signal.h> +#include <sstream> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + #include "cmCPluginAPI.cxx" #include "cmCPluginAPI.h" #include "cmDynamicLoader.h" #include "cmMakefile.h" -#include "cmPolicies.h" #include "cmState.h" #include "cmSystemTools.h" class cmExecutionStatus; -#include <signal.h> -#include <sstream> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - #ifdef __QNX__ #include <malloc.h> /* for malloc/free on QNX */ #endif @@ -174,11 +173,6 @@ cmLoadedCommand::~cmLoadedCommand() bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args, cmExecutionStatus&) { - if (this->Disallowed( - cmPolicies::CMP0031, - "The load_command command should not be called; see CMP0031.")) { - return true; - } if (args.empty()) { return true; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7077bbb..9333ed7 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -13,7 +13,6 @@ #include "cmInstallScriptGenerator.h" #include "cmInstallTargetGenerator.h" #include "cmLinkLineComputer.h" -#include "cmLinkLineDeviceComputer.h" #include "cmMakefile.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" @@ -1053,7 +1052,7 @@ void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target, // Add language-specific flags. this->AddLanguageFlags(flags, lang, config); - if (target->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION", config)) { + if (target->IsIPOEnabled(config)) { this->AppendFeatureOptions(flags, lang, "IPO"); } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 41a4caf..4388e75 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1864,10 +1864,7 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo( std::string binaryDir = this->GetState()->GetBinaryDirectory(); if (this->Makefile->IsOn("CMAKE_DEPENDS_IN_PROJECT_ONLY")) { const char* sourceDir = this->GetState()->GetSourceDirectory(); - std::vector<std::string>::iterator itr = - std::remove_if(includes.begin(), includes.end(), - ::NotInProjectDir(sourceDir, binaryDir)); - includes.erase(itr, includes.end()); + cmEraseIf(includes, ::NotInProjectDir(sourceDir, binaryDir)); } for (std::vector<std::string>::iterator i = includes.begin(); i != includes.end(); ++i) { diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 38dda04..260a84b 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -16,6 +16,7 @@ #include "cmGeneratedFileStream.h" #include <ctype.h> // for isspace +#include <windows.h> static bool cmLVS7G_IsFAT(const char* dir); @@ -669,6 +670,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( // Add the target-specific flags. this->AddCompileOptions(flags, target, linkLanguage, configName); + + // Check IPO related warning/error. + target->IsIPOEnabled(configName); } if (this->FortranProject) { @@ -745,11 +749,13 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( if (this->FortranProject) { // Intel Fortran >= 15.0 uses TargetName property. - std::string targetNameFull = target->GetFullName(configName); - std::string targetName = + std::string const targetNameFull = target->GetFullName(configName); + std::string const targetName = cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull); - std::string targetExt = - cmSystemTools::GetFilenameLastExtension(targetNameFull); + std::string const targetExt = + target->GetType() == cmStateEnums::OBJECT_LIBRARY + ? ".lib" + : cmSystemTools::GetFilenameLastExtension(targetNameFull); /* clang-format off */ fout << "\t\t\tTargetName=\"" << this->EscapeForXML(targetName) << "\"\n" @@ -787,7 +793,6 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( << this->ConvertToXMLOutputPath(modDir.c_str()) << "\\$(ConfigurationName)\"\n"; } - targetOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); fout << "\t\t\t\tAdditionalIncludeDirectories=\""; std::vector<std::string> includes; this->GetIncludeDirectories(includes, target, "C", configName); @@ -997,19 +1002,14 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( linkOptions.AddTable(cmLocalVisualStudio7GeneratorLinkFlagTable); linkOptions.Parse(extraLinkOptions.c_str()); - if (!this->ModuleDefinitionFile.empty()) { - std::string defFile = this->ConvertToOutputFormat( - this->ModuleDefinitionFile, cmOutputConverter::SHELL); + cmGeneratorTarget::ModuleDefinitionInfo const* mdi = + target->GetModuleDefinitionInfo(configName); + if (mdi && !mdi->DefFile.empty()) { + std::string defFile = + this->ConvertToOutputFormat(mdi->DefFile, cmOutputConverter::SHELL); linkOptions.AddFlag("ModuleDefinitionFile", defFile.c_str()); } - if ((target->GetType() == cmStateEnums::SHARED_LIBRARY || - target->IsExecutableWithExports()) && - this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) { - if (target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) { - linkOptions.AddFlag("ModuleDefinitionFile", "$(IntDir)/exportall.def"); - } - } switch (target->GetType()) { case cmStateEnums::UNKNOWN_LIBRARY: break; @@ -1090,7 +1090,6 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( if (!gg->NeedLinkLibraryDependencies(target)) { fout << "\t\t\t\tLinkLibraryDependencies=\"false\"\n"; } - linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); // Use the NOINHERIT macro to avoid getting VS project default // libraries which may be set by the user to something bad. fout << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) " @@ -1176,7 +1175,6 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( if (!gg->NeedLinkLibraryDependencies(target)) { fout << "\t\t\t\tLinkLibraryDependencies=\"false\"\n"; } - linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); // Use the NOINHERIT macro to avoid getting VS project default // libraries which may be set by the user to something bad. fout << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) " @@ -1365,7 +1363,6 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups(); // get the classes from the source lists then add them to the groups - this->ModuleDefinitionFile = ""; std::vector<cmSourceFile*> classes; if (!target->GetConfigCommonSourceFiles(classes)) { return; @@ -1377,9 +1374,6 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, } // Add the file to the list of sources. std::string source = (*i)->GetFullPath(); - if (cmSystemTools::UpperCase((*i)->GetExtension()) == "DEF") { - this->ModuleDefinitionFile = (*i)->GetFullPath(); - } cmSourceGroup* sourceGroup = this->Makefile->FindSourceGroup(source.c_str(), sourceGroups); sourceGroup->AssignSource(*i); @@ -1675,7 +1669,6 @@ bool cmLocalVisualStudio7Generator::WriteGroup( fileOptions.Parse(fc.CompileFlags.c_str()); fileOptions.AddDefines(fc.CompileDefs.c_str()); fileOptions.AddDefines(fc.CompileDefsConfig.c_str()); - fileOptions.OutputAdditionalOptions(fout, "\t\t\t\t\t", "\n"); fileOptions.OutputFlagMap(fout, "\t\t\t\t\t"); fileOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t\t", "\n", ppLang); @@ -1829,17 +1822,15 @@ void cmLocalVisualStudio7Generator::OutputTargetRules( tool = this->FortranProject ? "VFPreLinkEventTool" : "VCPreLinkEventTool"; event.Start(tool); bool addedPrelink = false; - if ((target->GetType() == cmStateEnums::SHARED_LIBRARY || - target->IsExecutableWithExports()) && - this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) { - if (target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) { - addedPrelink = true; - std::vector<cmCustomCommand> commands = target->GetPreLinkCommands(); - cmGlobalVisualStudioGenerator* gg = - static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator); - gg->AddSymbolExportCommand(target, commands, configName); - event.Write(commands); - } + cmGeneratorTarget::ModuleDefinitionInfo const* mdi = + target->GetModuleDefinitionInfo(configName); + if (mdi && mdi->DefFileGenerated) { + addedPrelink = true; + std::vector<cmCustomCommand> commands = target->GetPreLinkCommands(); + cmGlobalVisualStudioGenerator* gg = + static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator); + gg->AddSymbolExportCommand(target, commands, configName); + event.Write(commands); } if (!addedPrelink) { event.Write(target->GetPreLinkCommands()); @@ -2130,7 +2121,6 @@ std::string cmLocalVisualStudio7Generator::GetTargetDirectory( return dir; } -#include <windows.h> static bool cmLVS7G_IsFAT(const char* dir) { if (dir[0] && dir[1] == ':') { diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index d69cce1..ae6e2ed 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -128,7 +128,6 @@ private: friend class EventWriter; - std::string ModuleDefinitionFile; bool FortranProject; bool WindowsCEProject; cmLocalVisualStudio7GeneratorInternals* Internal; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 1e995fb..f7d822a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -36,7 +36,9 @@ #include "cmTest.h" #include "cmTestGenerator.h" // IWYU pragma: keep #include "cmVersion.h" +#include "cmWorkingDirectory.h" #include "cm_auto_ptr.hxx" +#include "cm_sys_stat.h" #include "cmake.h" #ifdef CMAKE_BUILD_WITH_CMAKE @@ -281,7 +283,8 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, if (!invokeSucceeded || hadNestedError) { if (!hadNestedError) { // The command invocation requested that we report an error. - this->IssueMessage(cmake::FATAL_ERROR, pcmd->GetError()); + std::string const error = name + " " + pcmd->GetError(); + this->IssueMessage(cmake::FATAL_ERROR, error); } result = false; if (this->GetCMakeInstance()->GetWorkingMode() != cmake::NORMAL_MODE) { @@ -653,21 +656,12 @@ void cmMakefile::FinalPass() // we don't want cmake to re-run if a configured file is created and deleted // during processing as that would make it a transient file that can't // influence the build process - - // remove_if will move all items that don't have a valid file name to the - // back of the vector - std::vector<std::string>::iterator new_output_files_end = std::remove_if( - this->OutputFiles.begin(), this->OutputFiles.end(), file_not_persistent()); - // we just have to erase all items at the back - this->OutputFiles.erase(new_output_files_end, this->OutputFiles.end()); + cmEraseIf(this->OutputFiles, file_not_persistent()); // if a configured file is used as input for another configured file, // and then deleted it will show up in the input list files so we // need to scan those too - std::vector<std::string>::iterator new_list_files_end = std::remove_if( - this->ListFiles.begin(), this->ListFiles.end(), file_not_persistent()); - - this->ListFiles.erase(new_list_files_end, this->ListFiles.end()); + cmEraseIf(this->ListFiles, file_not_persistent()); } // Generate the output file @@ -692,7 +686,8 @@ void cmMakefile::AddCustomCommandToTarget( const std::vector<std::string>& depends, const cmCustomCommandLines& commandLines, cmTarget::CustomCommandType type, const char* comment, const char* workingDir, bool escapeOldStyle, - bool uses_terminal, const std::string& depfile, bool command_expand_lists) + bool uses_terminal, const std::string& depfile, bool command_expand_lists, + ObjectLibraryCommands objLibraryCommands) { // Find the target to which to add the custom command. cmTargets::iterator ti = this->Targets.find(target); @@ -732,7 +727,8 @@ void cmMakefile::AddCustomCommandToTarget( return; } - if (ti->second.GetType() == cmStateEnums::OBJECT_LIBRARY) { + if (objLibraryCommands == RejectObjectLibraryCommands && + ti->second.GetType() == cmStateEnums::OBJECT_LIBRARY) { std::ostringstream e; e << "Target \"" << target << "\" is an OBJECT library " @@ -2155,6 +2151,12 @@ bool cmMakefile::IsSet(const std::string& name) const bool cmMakefile::PlatformIs32Bit() const { + if (const char* plat_abi = + this->GetDefinition("CMAKE_INTERNAL_PLATFORM_ABI")) { + if (strcmp(plat_abi, "ELF X32") == 0) { + return false; + } + } if (const char* sizeof_dptr = this->GetDefinition("CMAKE_SIZEOF_VOID_P")) { return atoi(sizeof_dptr) == 4; } @@ -2169,6 +2171,17 @@ bool cmMakefile::PlatformIs64Bit() const return false; } +bool cmMakefile::PlatformIsx32() const +{ + if (const char* plat_abi = + this->GetDefinition("CMAKE_INTERNAL_PLATFORM_ABI")) { + if (strcmp(plat_abi, "ELF X32") == 0) { + return true; + } + } + return false; +} + bool cmMakefile::PlatformIsAppleIos() const { std::string sdkRoot; @@ -3153,8 +3166,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, // change to the tests directory and run cmake // use the cmake object instead of calling cmake - std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(bindir); + cmWorkingDirectory workdir(bindir); // make sure the same generator is used // use this program as the cmake to be run, it should not @@ -3168,8 +3180,6 @@ int cmMakefile::TryCompile(const std::string& srcdir, this->GetGlobalGenerator()->GetName() + "' could not be created."); cmSystemTools::SetFatalErrorOccured(); - // return to the original directory - cmSystemTools::ChangeDirectory(cwd); this->IsSourceFileTryCompile = false; return 1; } @@ -3233,8 +3243,6 @@ int cmMakefile::TryCompile(const std::string& srcdir, this->IssueMessage(cmake::FATAL_ERROR, "Failed to configure test project build system."); cmSystemTools::SetFatalErrorOccured(); - // return to the original directory - cmSystemTools::ChangeDirectory(cwd); this->IsSourceFileTryCompile = false; return 1; } @@ -3243,8 +3251,6 @@ int cmMakefile::TryCompile(const std::string& srcdir, this->IssueMessage(cmake::FATAL_ERROR, "Failed to generate test project build system."); cmSystemTools::SetFatalErrorOccured(); - // return to the original directory - cmSystemTools::ChangeDirectory(cwd); this->IsSourceFileTryCompile = false; return 1; } @@ -3253,7 +3259,6 @@ int cmMakefile::TryCompile(const std::string& srcdir, int ret = this->GetGlobalGenerator()->TryCompile( srcdir, bindir, projectName, targetName, fast, output, this); - cmSystemTools::ChangeDirectory(cwd); this->IsSourceFileTryCompile = false; return ret; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 9d9e90a..4e48c88 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -119,6 +119,13 @@ public: */ void FinalPass(); + /** How to handle custom commands for object libraries */ + enum ObjectLibraryCommands + { + RejectObjectLibraryCommands, + AcceptObjectLibraryCommands + }; + /** Add a custom command to the build. */ void AddCustomCommandToTarget( const std::string& target, const std::vector<std::string>& byproducts, @@ -126,7 +133,8 @@ public: const cmCustomCommandLines& commandLines, cmTarget::CustomCommandType type, const char* comment, const char* workingDir, bool escapeOldStyle = true, bool uses_terminal = false, const std::string& depfile = "", - bool command_expand_lists = false); + bool command_expand_lists = false, + ObjectLibraryCommands objLibraryCommands = RejectObjectLibraryCommands); cmSourceFile* AddCustomCommandToOutput( const std::vector<std::string>& outputs, const std::vector<std::string>& byproducts, @@ -428,6 +436,8 @@ public: /** Return whether the target platform is 64-bit. */ bool PlatformIs64Bit() const; + /** Return whether the target platform is x32. */ + bool PlatformIsx32() const; /** Return whether the target platform is Apple iOS. */ bool PlatformIsAppleIos() const; diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index b76ddeb..493f474 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmMakefileExecutableTargetGenerator.h" +#include <algorithm> #include <sstream> #include <string> #include <vector> @@ -555,10 +556,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) } // maybe create .def file from list of objects - if (this->GeneratorTarget->IsExecutableWithExports() && - this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) { - this->GenDefFile(real_link_commands, linkFlags); - } + this->GenDefFile(real_link_commands); std::string manifests = this->GetManifests(); diff --git a/Source/cmMakefileExecutableTargetGenerator.h b/Source/cmMakefileExecutableTargetGenerator.h index 642182b..598ac3d 100644 --- a/Source/cmMakefileExecutableTargetGenerator.h +++ b/Source/cmMakefileExecutableTargetGenerator.h @@ -5,6 +5,8 @@ #include <cmConfigure.h> +#include <string> + #include "cmMakefileTargetGenerator.h" class cmGeneratorTarget; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index ff8b604..cc8a6b3 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -2,8 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmMakefileLibraryTargetGenerator.h" -#include <cmConfigure.h> // IWYU pragma: keep - +#include <algorithm> #include <sstream> #include <vector> @@ -130,14 +129,9 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() { std::string linkLanguage = this->GeneratorTarget->GetLinkerLanguage(this->ConfigName); - std::string linkRuleVar = "CMAKE_"; - linkRuleVar += linkLanguage; - linkRuleVar += "_CREATE_STATIC_LIBRARY"; - if (this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION") && - this->Makefile->GetDefinition(linkRuleVar + "_IPO")) { - linkRuleVar += "_IPO"; - } + std::string linkRuleVar = this->GeneratorTarget->GetCreateRuleVariable( + linkLanguage, this->ConfigName); std::string extraFlags; this->LocalGenerator->GetStaticLibraryFlags( @@ -677,18 +671,30 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( std::string arCreateVar = "CMAKE_"; arCreateVar += linkLanguage; arCreateVar += "_ARCHIVE_CREATE"; + + arCreateVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable( + arCreateVar, this->ConfigName); + if (const char* rule = this->Makefile->GetDefinition(arCreateVar)) { cmSystemTools::ExpandListArgument(rule, archiveCreateCommands); } std::string arAppendVar = "CMAKE_"; arAppendVar += linkLanguage; arAppendVar += "_ARCHIVE_APPEND"; + + arAppendVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable( + arAppendVar, this->ConfigName); + if (const char* rule = this->Makefile->GetDefinition(arAppendVar)) { cmSystemTools::ExpandListArgument(rule, archiveAppendCommands); } std::string arFinishVar = "CMAKE_"; arFinishVar += linkLanguage; arFinishVar += "_ARCHIVE_FINISH"; + + arFinishVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable( + arFinishVar, this->ConfigName); + if (const char* rule = this->Makefile->GetDefinition(arFinishVar)) { cmSystemTools::ExpandListArgument(rule, archiveFinishCommands); } @@ -751,10 +757,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( } // maybe create .def file from list of objects - if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY && - this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) { - this->GenDefFile(real_link_commands, linkFlags); - } + this->GenDefFile(real_link_commands); std::string manifests = this->GetManifests(); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 54b3f36..ed38024 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1414,8 +1414,14 @@ void cmMakefileTargetGenerator::AppendLinkDepends( this->AppendTargetDepends(depends); // Add a dependency on the link definitions file, if any. - if (this->ModuleDefinitionFile) { - depends.push_back(this->ModuleDefinitionFile->GetFullPath()); + if (cmGeneratorTarget::ModuleDefinitionInfo const* mdi = + this->GeneratorTarget->GetModuleDefinitionInfo( + this->GetConfigName())) { + for (std::vector<cmSourceFile const*>::const_iterator i = + mdi->Sources.begin(); + i != mdi->Sources.end(); ++i) { + depends.push_back((*i)->GetFullPath()); + } } // Add a dependency on user-specified manifest files, if any. @@ -1718,31 +1724,32 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags, } void cmMakefileTargetGenerator::GenDefFile( - std::vector<std::string>& real_link_commands, std::string& linkFlags) + std::vector<std::string>& real_link_commands) { - if (this->GeneratorTarget->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) { - std::string name_of_def_file = - this->GeneratorTarget->GetSupportDirectory(); - name_of_def_file += std::string("/") + this->GeneratorTarget->GetName(); - name_of_def_file += ".def"; - std::string cmd = cmSystemTools::GetCMakeCommand(); - cmd = this->LocalGenerator->ConvertToOutputFormat( - cmd, cmOutputConverter::SHELL); - cmd += " -E __create_def "; - cmd += this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->MaybeConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), name_of_def_file), - cmOutputConverter::SHELL); - cmd += " "; - std::string objlist_file = name_of_def_file; - objlist_file += ".objs"; - cmd += this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->MaybeConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), objlist_file), - cmOutputConverter::SHELL); - real_link_commands.insert(real_link_commands.begin(), cmd); - // create a list of obj files for the -E __create_def to read - cmGeneratedFileStream fout(objlist_file.c_str()); + cmGeneratorTarget::ModuleDefinitionInfo const* mdi = + this->GeneratorTarget->GetModuleDefinitionInfo(this->GetConfigName()); + if (!mdi || !mdi->DefFileGenerated) { + return; + } + std::string cmd = cmSystemTools::GetCMakeCommand(); + cmd = + this->LocalGenerator->ConvertToOutputFormat(cmd, cmOutputConverter::SHELL); + cmd += " -E __create_def "; + cmd += this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->MaybeConvertToRelativePath( + this->LocalGenerator->GetCurrentBinaryDirectory(), mdi->DefFile), + cmOutputConverter::SHELL); + cmd += " "; + std::string objlist_file = mdi->DefFile + ".objs"; + cmd += this->LocalGenerator->ConvertToOutputFormat( + this->LocalGenerator->MaybeConvertToRelativePath( + this->LocalGenerator->GetCurrentBinaryDirectory(), objlist_file), + cmOutputConverter::SHELL); + real_link_commands.insert(real_link_commands.begin(), cmd); + // create a list of obj files for the -E __create_def to read + cmGeneratedFileStream fout(objlist_file.c_str()); + + if (mdi->WindowsExportAllSymbols) { for (std::vector<std::string>::const_iterator i = this->Objects.begin(); i != this->Objects.end(); ++i) { if (cmHasLiteralSuffix(*i, ".obj")) { @@ -1754,13 +1761,11 @@ void cmMakefileTargetGenerator::GenDefFile( i != this->ExternalObjects.end(); ++i) { fout << *i << "\n"; } - // now add the def file link flag - linkFlags += " "; - linkFlags += this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG"); - linkFlags += this->LocalGenerator->ConvertToOutputFormat( - this->LocalGenerator->MaybeConvertToRelativePath( - this->LocalGenerator->GetCurrentBinaryDirectory(), name_of_def_file), - cmOutputConverter::SHELL); - linkFlags += " "; + } + + for (std::vector<cmSourceFile const*>::const_iterator i = + mdi->Sources.begin(); + i != mdi->Sources.end(); ++i) { + fout << (*i)->GetFullPath() << "\n"; } } diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 347f9f2..07b8005 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -166,8 +166,7 @@ protected: bool useWatcomQuote); /** Add commands for generate def files */ - void GenDefFile(std::vector<std::string>& real_link_commands, - std::string& linkFlags); + void GenDefFile(std::vector<std::string>& real_link_commands); void AddIncludeFlags(std::string& flags, const std::string& lang) CM_OVERRIDE; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index b1374c2..aaeb659 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -260,12 +260,9 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRule(bool useResponseFile) rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(), *i, vars); } - { - // If there is no ranlib the command will be ":". Skip it. - std::vector<std::string>::iterator newEnd = std::remove_if( - linkCmds.begin(), linkCmds.end(), cmNinjaRemoveNoOpCommands()); - linkCmds.erase(newEnd, linkCmds.end()); - } + + // If there is no ranlib the command will be ":". Skip it. + cmEraseIf(linkCmds, cmNinjaRemoveNoOpCommands()); std::string linkCmd = this->GetLocalGenerator()->BuildCommandLine(linkCmds); @@ -388,12 +385,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(), *i, vars); } - { - // If there is no ranlib the command will be ":". Skip it. - std::vector<std::string>::iterator newEnd = std::remove_if( - linkCmds.begin(), linkCmds.end(), cmNinjaRemoveNoOpCommands()); - linkCmds.erase(newEnd, linkCmds.end()); - } + + // If there is no ranlib the command will be ":". Skip it. + cmEraseIf(linkCmds, cmNinjaRemoveNoOpCommands()); linkCmds.insert(linkCmds.begin(), "$PRE_LINK"); linkCmds.push_back("$POST_BUILD"); @@ -522,6 +516,10 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd() std::string linkCmdVar = "CMAKE_"; linkCmdVar += this->TargetLinkLanguage; linkCmdVar += "_ARCHIVE_CREATE"; + + linkCmdVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable( + linkCmdVar, this->GetConfigName()); + const char* linkCmd = mf->GetRequiredDefinition(linkCmdVar); cmSystemTools::ExpandListArgument(linkCmd, linkCmds); } @@ -529,6 +527,10 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd() std::string linkCmdVar = "CMAKE_"; linkCmdVar += this->TargetLinkLanguage; linkCmdVar += "_ARCHIVE_FINISH"; + + linkCmdVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable( + linkCmdVar, this->GetConfigName()); + const char* linkCmd = mf->GetRequiredDefinition(linkCmdVar); cmSystemTools::ExpandListArgument(linkCmd, linkCmds); } @@ -869,19 +871,6 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() linkLineComputer.get(), this->GetConfigName(), vars["LINK_LIBRARIES"], vars["FLAGS"], vars["LINK_FLAGS"], frameworkPath, linkPath, &genTarget); - if (this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS") && - (gt.GetType() == cmStateEnums::SHARED_LIBRARY || - gt.IsExecutableWithExports())) { - if (gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) { - std::string name_of_def_file = gt.GetSupportDirectory(); - name_of_def_file += "/" + gt.GetName(); - name_of_def_file += ".def "; - vars["LINK_FLAGS"] += " /DEF:"; - vars["LINK_FLAGS"] += this->GetLocalGenerator()->ConvertToOutputFormat( - name_of_def_file, cmOutputConverter::SHELL); - } - } - // Add OS X version flags, if any. if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY || this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) { @@ -998,35 +987,39 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() } // maybe create .def file from list of objects - if ((gt.GetType() == cmStateEnums::SHARED_LIBRARY || - gt.IsExecutableWithExports()) && - this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) { - if (gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) { - std::string cmakeCommand = - this->GetLocalGenerator()->ConvertToOutputFormat( - cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL); - std::string name_of_def_file = gt.GetSupportDirectory(); - name_of_def_file += "/" + gt.GetName(); - name_of_def_file += ".def"; - std::string cmd = cmakeCommand; - cmd += " -E __create_def "; - cmd += this->GetLocalGenerator()->ConvertToOutputFormat( - name_of_def_file, cmOutputConverter::SHELL); - cmd += " "; + cmGeneratorTarget::ModuleDefinitionInfo const* mdi = + gt.GetModuleDefinitionInfo(this->GetConfigName()); + if (mdi && mdi->DefFileGenerated) { + std::string cmakeCommand = + this->GetLocalGenerator()->ConvertToOutputFormat( + cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL); + std::string cmd = cmakeCommand; + cmd += " -E __create_def "; + cmd += this->GetLocalGenerator()->ConvertToOutputFormat( + mdi->DefFile, cmOutputConverter::SHELL); + cmd += " "; + std::string obj_list_file = mdi->DefFile + ".objs"; + cmd += this->GetLocalGenerator()->ConvertToOutputFormat( + obj_list_file, cmOutputConverter::SHELL); + preLinkCmdLines.push_back(cmd); + + // create a list of obj files for the -E __create_def to read + cmGeneratedFileStream fout(obj_list_file.c_str()); + + if (mdi->WindowsExportAllSymbols) { cmNinjaDeps objs = this->GetObjects(); - std::string obj_list_file = name_of_def_file; - obj_list_file += ".objs"; - cmd += this->GetLocalGenerator()->ConvertToOutputFormat( - obj_list_file, cmOutputConverter::SHELL); - preLinkCmdLines.push_back(cmd); - // create a list of obj files for the -E __create_def to read - cmGeneratedFileStream fout(obj_list_file.c_str()); for (cmNinjaDeps::iterator i = objs.begin(); i != objs.end(); ++i) { if (cmHasLiteralSuffix(*i, ".obj")) { fout << *i << "\n"; } } } + + for (std::vector<cmSourceFile const*>::const_iterator i = + mdi->Sources.begin(); + i != mdi->Sources.end(); ++i) { + fout << (*i)->GetFullPath() << "\n"; + } } // If we have any PRE_LINK commands, we need to go back to CMAKE_BINARY_DIR // for diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index d57b8f7..2b16e19 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -212,9 +212,14 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const std::transform(deps.begin(), deps.end(), result.begin(), MapToNinjaPath()); // Add a dependency on the link definitions file, if any. - if (this->ModuleDefinitionFile) { - result.push_back( - this->ConvertToNinjaPath(this->ModuleDefinitionFile->GetFullPath())); + if (cmGeneratorTarget::ModuleDefinitionInfo const* mdi = + this->GeneratorTarget->GetModuleDefinitionInfo( + this->GetConfigName())) { + for (std::vector<cmSourceFile const*>::const_iterator i = + mdi->Sources.begin(); + i != mdi->Sources.end(); ++i) { + result.push_back(this->ConvertToNinjaPath((*i)->GetFullPath())); + } } // Add a dependency on user-specified manifest files, if any. diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index 8139be4..c9f6ceb 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -42,7 +42,8 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName, // Compute bundle directory names. std::string out = outpath; out += "/"; - out += this->GT->GetAppBundleDirectory(this->ConfigName, false); + out += this->GT->GetAppBundleDirectory(this->ConfigName, + cmGeneratorTarget::FullLevel); cmSystemTools::MakeDirectory(out.c_str()); this->Makefile->AddCMakeOutputFile(out); @@ -52,7 +53,8 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName, // to be set. std::string plist = outpath; plist += "/"; - plist += this->GT->GetAppBundleDirectory(this->ConfigName, true); + plist += this->GT->GetAppBundleDirectory(this->ConfigName, + cmGeneratorTarget::ContentLevel); plist += "/Info.plist"; this->LocalGenerator->GenerateAppleInfoPList(this->GT, targetName, plist.c_str()); @@ -70,12 +72,14 @@ void cmOSXBundleGenerator::CreateFramework(const std::string& targetName, assert(this->MacContentFolders); // Compute the location of the top-level foo.framework directory. - std::string contentdir = - outpath + "/" + this->GT->GetFrameworkDirectory(this->ConfigName, true); + std::string contentdir = outpath + "/" + + this->GT->GetFrameworkDirectory(this->ConfigName, + cmGeneratorTarget::ContentLevel); contentdir += "/"; - std::string newoutpath = - outpath + "/" + this->GT->GetFrameworkDirectory(this->ConfigName, false); + std::string newoutpath = outpath + "/" + + this->GT->GetFrameworkDirectory(this->ConfigName, + cmGeneratorTarget::FullLevel); std::string frameworkVersion = this->GT->GetFrameworkVersion(); @@ -170,14 +174,16 @@ void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName, // Compute bundle directory names. std::string out = root; out += "/"; - out += this->GT->GetCFBundleDirectory(this->ConfigName, false); + out += this->GT->GetCFBundleDirectory(this->ConfigName, + cmGeneratorTarget::FullLevel); cmSystemTools::MakeDirectory(out.c_str()); this->Makefile->AddCMakeOutputFile(out); // Configure the Info.plist file. Note that it needs the executable name // to be set. - std::string plist = - root + "/" + this->GT->GetCFBundleDirectory(this->ConfigName, true); + std::string plist = root + "/" + + this->GT->GetCFBundleDirectory(this->ConfigName, + cmGeneratorTarget::ContentLevel); plist += "/Info.plist"; std::string name = cmSystemTools::GetFilenameName(targetName); this->LocalGenerator->GenerateAppleInfoPList(this->GT, name, plist.c_str()); diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index 7a17f2c..3db0fec 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -10,7 +10,6 @@ #include "cmAlgorithms.h" #include "cmGeneratorExpression.h" #include "cmMakefile.h" -#include "cmPolicies.h" #include "cmSourceFile.h" #include "cmSystemTools.h" #include "cmTarget.h" @@ -495,11 +494,6 @@ protected: bool cmOutputRequiredFilesCommand::InitialPass( std::vector<std::string> const& args, cmExecutionStatus&) { - if (this->Disallowed(cmPolicies::CMP0032, "The output_required_files " - "command should not be called; " - "see CMP0032.")) { - return true; - } if (args.size() != 2) { this->SetError("called with incorrect number of arguments"); return false; diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 62e67c7..72dcc4f 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -200,7 +200,13 @@ class cmMakefile; 7, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0067, \ "Honor language standard in try_compile() source-file signature.", \ - 3, 8, 0, cmPolicies::WARN) + 3, 8, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0068, \ + "RPATH settings on macOS do not affect install_name.", 3, 9, 0, \ + cmPolicies::WARN) \ + SELECT(POLICY, CMP0069, \ + "INTERPROCEDURAL_OPTIMIZATION is enforced when enabled.", 3, 9, 0, \ + cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ @@ -221,7 +227,9 @@ class cmMakefile; F(CMP0052) \ F(CMP0060) \ F(CMP0063) \ - F(CMP0065) + F(CMP0065) \ + F(CMP0068) \ + F(CMP0069) /** \class cmPolicies * \brief Handles changes in CMake behavior and policies diff --git a/Source/cmQtAutoGeneratorCommon.cxx b/Source/cmQtAutoGeneratorCommon.cxx new file mode 100644 index 0000000..2498fe8 --- /dev/null +++ b/Source/cmQtAutoGeneratorCommon.cxx @@ -0,0 +1,216 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmQtAutoGeneratorCommon.h" +#include "cmAlgorithms.h" +#include "cmSystemTools.h" + +#include <cmsys/FStream.hxx> +#include <cmsys/RegularExpression.hxx> + +#include <sstream> +#include <stddef.h> + +// - Static functions + +static std::string utilStripCR(std::string const& line) +{ + // Strip CR characters rcc may have printed (possibly more than one!). + std::string::size_type cr = line.find('\r'); + if (cr != line.npos) { + return line.substr(0, cr); + } + return line; +} + +/// @brief Reads the resource files list from from a .qrc file - Qt4 version +/// @return True if the .qrc file was successfully parsed +static bool RccListInputsQt4(const std::string& fileName, + std::vector<std::string>& files, + std::string* errorMessage) +{ + bool allGood = true; + // Read qrc file content into string + std::string qrcContents; + { + cmsys::ifstream ifs(fileName.c_str()); + if (ifs) { + std::ostringstream osst; + osst << ifs.rdbuf(); + qrcContents = osst.str(); + } else { + if (errorMessage != CM_NULLPTR) { + std::ostringstream ost; + ost << "AutoRcc: Error: Rcc file not readable:\n" + << cmQtAutoGeneratorCommon::Quoted(fileName) << "\n"; + *errorMessage = ost.str(); + } + allGood = false; + } + } + if (allGood) { + // qrc file directory + std::string qrcDir(cmsys::SystemTools::GetFilenamePath(fileName)); + if (!qrcDir.empty()) { + qrcDir += '/'; + } + + cmsys::RegularExpression fileMatchRegex("(<file[^<]+)"); + cmsys::RegularExpression fileReplaceRegex("(^<file[^>]*>)"); + + size_t offset = 0; + while (fileMatchRegex.find(qrcContents.c_str() + offset)) { + std::string qrcEntry = fileMatchRegex.match(1); + offset += qrcEntry.size(); + { + fileReplaceRegex.find(qrcEntry); + std::string tag = fileReplaceRegex.match(1); + qrcEntry = qrcEntry.substr(tag.size()); + } + if (!cmSystemTools::FileIsFullPath(qrcEntry.c_str())) { + qrcEntry = qrcDir + qrcEntry; + } + files.push_back(qrcEntry); + } + } + return allGood; +} + +/// @brief Reads the resource files list from from a .qrc file - Qt5 version +/// @return True if the .qrc file was successfully parsed +static bool RccListInputsQt5(const std::string& rccCommand, + const std::string& fileName, + std::vector<std::string>& files, + std::string* errorMessage) +{ + if (rccCommand.empty()) { + cmSystemTools::Error("AutoRcc: Error: rcc executable not available\n"); + return false; + } + + // Read rcc features + bool hasDashDashList = false; + { + std::vector<std::string> command; + command.push_back(rccCommand); + command.push_back("--help"); + std::string rccStdOut; + std::string rccStdErr; + int retVal = 0; + bool result = + cmSystemTools::RunSingleCommand(command, &rccStdOut, &rccStdErr, &retVal, + CM_NULLPTR, cmSystemTools::OUTPUT_NONE); + if (result && retVal == 0 && + rccStdOut.find("--list") != std::string::npos) { + hasDashDashList = true; + } + } + + // Run rcc list command + bool result = false; + int retVal = 0; + std::string rccStdOut; + std::string rccStdErr; + { + std::vector<std::string> command; + command.push_back(rccCommand); + command.push_back(hasDashDashList ? "--list" : "-list"); + command.push_back(fileName); + result = + cmSystemTools::RunSingleCommand(command, &rccStdOut, &rccStdErr, &retVal, + CM_NULLPTR, cmSystemTools::OUTPUT_NONE); + } + if (!result || retVal) { + if (errorMessage != CM_NULLPTR) { + std::ostringstream ost; + ost << "AutoRcc: Error: Rcc list process for " << fileName + << " failed:\n" + << rccStdOut << "\n" + << rccStdErr << "\n"; + *errorMessage = ost.str(); + } + return false; + } + + // Parse rcc std output + { + std::istringstream ostr(rccStdOut); + std::string oline; + while (std::getline(ostr, oline)) { + oline = utilStripCR(oline); + if (!oline.empty()) { + files.push_back(oline); + } + } + } + // Parse rcc error output + { + std::istringstream estr(rccStdErr); + std::string eline; + while (std::getline(estr, eline)) { + eline = utilStripCR(eline); + if (cmHasLiteralPrefix(eline, "RCC: Error in")) { + static std::string searchString = "Cannot find file '"; + + std::string::size_type pos = eline.find(searchString); + if (pos == std::string::npos) { + if (errorMessage != CM_NULLPTR) { + std::ostringstream ost; + ost << "AutoRcc: Error: Rcc lists unparsable output:\n" + << cmQtAutoGeneratorCommon::Quoted(eline) << "\n"; + *errorMessage = ost.str(); + } + return false; + } + pos += searchString.length(); + std::string::size_type sz = eline.size() - pos - 1; + files.push_back(eline.substr(pos, sz)); + } + } + } + + return true; +} + +// - Class definitions + +const char* cmQtAutoGeneratorCommon::listSep = "@LSEP@"; + +std::string cmQtAutoGeneratorCommon::Quoted(const std::string& text) +{ + static const char* rep[18] = { "\\", "\\\\", "\"", "\\\"", "\a", "\\a", + "\b", "\\b", "\f", "\\f", "\n", "\\n", + "\r", "\\r", "\t", "\\t", "\v", "\\v" }; + + std::string res = text; + for (const char* const* it = cmArrayBegin(rep); it != cmArrayEnd(rep); + it += 2) { + cmSystemTools::ReplaceString(res, *it, *(it + 1)); + } + res = '"' + res; + res += '"'; + return res; +} + +bool cmQtAutoGeneratorCommon::RccListInputs(const std::string& qtMajorVersion, + const std::string& rccCommand, + const std::string& fileName, + std::vector<std::string>& files, + std::string* errorMessage) +{ + bool allGood = false; + if (cmsys::SystemTools::FileExists(fileName.c_str())) { + if (qtMajorVersion == "4") { + allGood = RccListInputsQt4(fileName, files, errorMessage); + } else { + allGood = RccListInputsQt5(rccCommand, fileName, files, errorMessage); + } + } else { + if (errorMessage != CM_NULLPTR) { + std::ostringstream ost; + ost << "AutoRcc: Error: Rcc file does not exist:\n" + << cmQtAutoGeneratorCommon::Quoted(fileName) << "\n"; + *errorMessage = ost.str(); + } + } + return allGood; +} diff --git a/Source/cmQtAutoGeneratorCommon.h b/Source/cmQtAutoGeneratorCommon.h new file mode 100644 index 0000000..b004005 --- /dev/null +++ b/Source/cmQtAutoGeneratorCommon.h @@ -0,0 +1,38 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmQtAutoGeneratorCommon_h +#define cmQtAutoGeneratorCommon_h + +#include <cmConfigure.h> +#include <string> +#include <vector> + +class cmQtAutoGeneratorCommon +{ + // - Types and statics +public: + static const char* listSep; + + enum GeneratorType + { + MOC, + UIC, + RCC + }; + +public: + /// @brief Returns a the string escaped and enclosed in quotes + /// + static std::string Quoted(const std::string& text); + + /// @brief Reads the resource files list from from a .qrc file + /// @arg fileName Must be the absolute path of the .qrc file + /// @return True if the rcc file was successfully parsed + static bool RccListInputs(const std::string& qtMajorVersion, + const std::string& rccCommand, + const std::string& fileName, + std::vector<std::string>& files, + std::string* errorMessage = CM_NULLPTR); +}; + +#endif diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index 825eba0..d69794c 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -1,20 +1,21 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmQtAutoGeneratorInitializer.h" +#include "cmQtAutoGeneratorCommon.h" #include "cmAlgorithms.h" #include "cmCustomCommandLines.h" #include "cmFilePathChecksum.h" #include "cmGeneratorTarget.h" -#include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmOutputConverter.h" #include "cmSourceFile.h" -#include "cmSourceFileLocation.h" +#include "cmSourceGroup.h" #include "cmState.h" #include "cmSystemTools.h" #include "cmTarget.h" +#include "cm_sys_stat.h" #include "cmake.h" #if defined(_WIN32) && !defined(__CYGWIN__) @@ -22,16 +23,11 @@ #endif #include <algorithm> -#include <assert.h> #include <cmConfigure.h> #include <cmsys/FStream.hxx> -#include <cmsys/RegularExpression.hxx> #include <map> #include <set> -#include <sstream> -#include <string.h> #include <string> -#include <sys/stat.h> #include <utility> #include <vector> @@ -45,14 +41,16 @@ static void utilCopyTargetProperty(cmTarget* destinationTarget, } } -static std::string utilStripCR(std::string const& line) +inline static bool PropertyEnabled(cmSourceFile* sourceFile, const char* key) { - // Strip CR characters rcc may have printed (possibly more than one!). - std::string::size_type cr = line.find('\r'); - if (cr != line.npos) { - return line.substr(0, cr); - } - return line; + return cmSystemTools::IsOn(sourceFile->GetPropertyForUser(key)); +} + +static std::string GetSafeProperty(cmGeneratorTarget const* target, + const char* key) +{ + const char* tmp = target->GetProperty(key); + return std::string((tmp != CM_NULLPTR) ? tmp : ""); } static std::string GetAutogenTargetName(cmGeneratorTarget const* target) @@ -98,21 +96,106 @@ static std::string GetQtMajorVersion(cmGeneratorTarget const* target) return qtMajorVersion; } -static void SetupSourceFiles(cmGeneratorTarget const* target, +static void GetCompileDefinitionsAndDirectories( + cmGeneratorTarget const* target, const std::string& config, + std::string& incs, std::string& defs) +{ + cmLocalGenerator* localGen = target->GetLocalGenerator(); + { + std::vector<std::string> includeDirs; + // Get the include dirs for this target, without stripping the implicit + // include dirs off, see + // https://gitlab.kitware.com/cmake/cmake/issues/13667 + localGen->GetIncludeDirectories(includeDirs, target, "CXX", config, false); + incs = cmJoin(includeDirs, ";"); + } + { + std::set<std::string> defines; + localGen->AddCompileDefinitions(defines, target, config, "CXX"); + defs += cmJoin(defines, ";"); + } +} + +static void AddDefinitionEscaped(cmMakefile* makefile, const char* key, + const std::string& value) +{ + makefile->AddDefinition(key, + cmOutputConverter::EscapeForCMake(value).c_str()); +} + +static void AddDefinitionEscaped(cmMakefile* makefile, const char* key, + const std::vector<std::string>& values) +{ + makefile->AddDefinition( + key, cmOutputConverter::EscapeForCMake(cmJoin(values, ";")).c_str()); +} + +static bool AddToSourceGroup(cmMakefile* makefile, const std::string& fileName, + cmQtAutoGeneratorCommon::GeneratorType genType) +{ + cmSourceGroup* sourceGroup = CM_NULLPTR; + // Acquire source group + { + const char* groupName = CM_NULLPTR; + // Use generator specific group name + switch (genType) { + case cmQtAutoGeneratorCommon::MOC: + groupName = + makefile->GetState()->GetGlobalProperty("AUTOMOC_SOURCE_GROUP"); + break; + case cmQtAutoGeneratorCommon::RCC: + groupName = + makefile->GetState()->GetGlobalProperty("AUTORCC_SOURCE_GROUP"); + break; + default: + break; + } + // Use default group name on demand + if ((groupName == CM_NULLPTR) || (*groupName == 0)) { + groupName = + makefile->GetState()->GetGlobalProperty("AUTOGEN_SOURCE_GROUP"); + } + // Generate a source group on demand + if ((groupName != CM_NULLPTR) && (*groupName != 0)) { + { + const char* delimiter = + makefile->GetDefinition("SOURCE_GROUP_DELIMITER"); + if (delimiter == CM_NULLPTR) { + delimiter = "\\"; + } + std::vector<std::string> folders = + cmSystemTools::tokenize(groupName, delimiter); + sourceGroup = makefile->GetSourceGroup(folders); + if (sourceGroup == CM_NULLPTR) { + makefile->AddSourceGroup(folders); + sourceGroup = makefile->GetSourceGroup(folders); + } + } + if (sourceGroup == CM_NULLPTR) { + cmSystemTools::Error( + "Autogen: Could not create or find source group: ", + cmQtAutoGeneratorCommon::Quoted(groupName).c_str()); + return false; + } + } + } + if (sourceGroup != CM_NULLPTR) { + sourceGroup->AddGroupFile(fileName); + } + return true; +} + +static void AcquireScanFiles(cmGeneratorTarget const* target, std::vector<std::string>& mocUicSources, std::vector<std::string>& mocUicHeaders, - std::vector<std::string>& skipMocList, - std::vector<std::string>& skipUicList) + std::vector<std::string>& mocSkipList, + std::vector<std::string>& uicSkipList) { - cmMakefile* makefile = target->Target->GetMakefile(); + const bool mocTarget = target->GetPropertyAsBool("AUTOMOC"); + const bool uicTarget = target->GetPropertyAsBool("AUTOUIC"); std::vector<cmSourceFile*> srcFiles; target->GetConfigCommonSourceFiles(srcFiles); - - const bool targetMoc = target->GetPropertyAsBool("AUTOMOC"); - const bool targetUic = target->GetPropertyAsBool("AUTOUIC"); - - cmFilePathChecksum fpathCheckSum(makefile); for (std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin(); fileIt != srcFiles.end(); ++fileIt) { cmSourceFile* sf = *fileIt; @@ -123,30 +206,24 @@ static void SetupSourceFiles(cmGeneratorTarget const* target, !(fileType == cmSystemTools::HEADER_FILE_FORMAT)) { continue; } - if (cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) { - continue; - } const std::string absFile = cmsys::SystemTools::GetRealPath(sf->GetFullPath()); // Skip flags - const bool skipAll = - cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOGEN")); - const bool skipMoc = - skipAll || cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOMOC")); - const bool skipUic = - skipAll || cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOUIC")); + const bool skipAll = PropertyEnabled(sf, "SKIP_AUTOGEN"); + const bool mocSkip = skipAll || PropertyEnabled(sf, "SKIP_AUTOMOC"); + const bool uicSkip = skipAll || PropertyEnabled(sf, "SKIP_AUTOUIC"); // Add file name to skip lists. // Do this even when the file is not added to the sources/headers lists // because the file name may be extracted from an other file when // processing - if (skipMoc) { - skipMocList.push_back(absFile); + if (mocSkip) { + mocSkipList.push_back(absFile); } - if (skipUic) { - skipUicList.push_back(absFile); + if (uicSkip) { + uicSkipList.push_back(absFile); } - if ((targetMoc && !skipMoc) || (targetUic && !skipUic)) { + if ((mocTarget && !mocSkip) || (uicTarget && !uicSkip)) { // Add file name to sources or headers list switch (fileType) { case cmSystemTools::CXX_FILE_FORMAT: @@ -162,100 +239,89 @@ static void SetupSourceFiles(cmGeneratorTarget const* target, } } -static void GetCompileDefinitionsAndDirectories( - cmGeneratorTarget const* target, const std::string& config, - std::string& incs, std::string& defs) -{ - std::vector<std::string> includeDirs; - cmLocalGenerator* localGen = target->GetLocalGenerator(); - // Get the include dirs for this target, without stripping the implicit - // include dirs off, see https://gitlab.kitware.com/cmake/cmake/issues/13667 - localGen->GetIncludeDirectories(includeDirs, target, "CXX", config, false); - - incs = cmJoin(includeDirs, ";"); - - std::set<std::string> defines; - localGen->AddCompileDefinitions(defines, target, config, "CXX"); - - defs += cmJoin(defines, ";"); -} - static void MocSetupAutoTarget( cmGeneratorTarget const* target, const std::string& autogenTargetName, - std::vector<std::string> const& skipMoc, + const std::string& qtMajorVersion, + std::vector<std::string> const& mocSkipList, std::map<std::string, std::string>& configIncludes, std::map<std::string, std::string>& configDefines) { cmLocalGenerator* lg = target->GetLocalGenerator(); cmMakefile* makefile = target->Target->GetMakefile(); - const char* tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS"); - std::string _moc_options = (tmp != CM_NULLPTR ? tmp : ""); - makefile->AddDefinition( - "_moc_options", cmOutputConverter::EscapeForCMake(_moc_options).c_str()); - makefile->AddDefinition( - "_skip_moc", - cmOutputConverter::EscapeForCMake(cmJoin(skipMoc, ";")).c_str()); - bool relaxedMode = makefile->IsOn("CMAKE_AUTOMOC_RELAXED_MODE"); - makefile->AddDefinition("_moc_relaxed_mode", relaxedMode ? "TRUE" : "FALSE"); - - std::string _moc_incs; - std::string _moc_compile_defs; - std::vector<std::string> configs; - const std::string& config = makefile->GetConfigurations(configs); - GetCompileDefinitionsAndDirectories(target, config, _moc_incs, - _moc_compile_defs); + AddDefinitionEscaped(makefile, "_moc_options", + GetSafeProperty(target, "AUTOMOC_MOC_OPTIONS")); + AddDefinitionEscaped(makefile, "_moc_skip", mocSkipList); + AddDefinitionEscaped(makefile, "_moc_relaxed_mode", + makefile->IsOn("CMAKE_AUTOMOC_RELAXED_MODE") ? "TRUE" + : "FALSE"); + AddDefinitionEscaped(makefile, "_moc_depend_filters", + GetSafeProperty(target, "AUTOMOC_DEPEND_FILTERS")); - makefile->AddDefinition( - "_moc_incs", cmOutputConverter::EscapeForCMake(_moc_incs).c_str()); - makefile->AddDefinition( - "_moc_compile_defs", - cmOutputConverter::EscapeForCMake(_moc_compile_defs).c_str()); - - for (std::vector<std::string>::const_iterator li = configs.begin(); - li != configs.end(); ++li) { - std::string config_moc_incs; - std::string config_moc_compile_defs; - GetCompileDefinitionsAndDirectories(target, *li, config_moc_incs, - config_moc_compile_defs); - if (config_moc_incs != _moc_incs) { - configIncludes[*li] = cmOutputConverter::EscapeForCMake(config_moc_incs); - if (_moc_incs.empty()) { - _moc_incs = config_moc_incs; + // Moc includes and compile definitions + { + std::string _moc_incs; + std::string _moc_compile_defs; + std::vector<std::string> configs; + { + const std::string& config = makefile->GetConfigurations(configs); + GetCompileDefinitionsAndDirectories(target, config, _moc_incs, + _moc_compile_defs); + AddDefinitionEscaped(makefile, "_moc_incs", _moc_incs); + AddDefinitionEscaped(makefile, "_moc_compile_defs", _moc_compile_defs); + } + for (std::vector<std::string>::const_iterator li = configs.begin(); + li != configs.end(); ++li) { + std::string config_moc_incs; + std::string config_moc_compile_defs; + GetCompileDefinitionsAndDirectories(target, *li, config_moc_incs, + config_moc_compile_defs); + if (config_moc_incs != _moc_incs) { + configIncludes[*li] = + cmOutputConverter::EscapeForCMake(config_moc_incs); + if (_moc_incs.empty()) { + _moc_incs = config_moc_incs; + } } - } - if (config_moc_compile_defs != _moc_compile_defs) { - configDefines[*li] = - cmOutputConverter::EscapeForCMake(config_moc_compile_defs); - if (_moc_compile_defs.empty()) { - _moc_compile_defs = config_moc_compile_defs; + if (config_moc_compile_defs != _moc_compile_defs) { + configDefines[*li] = + cmOutputConverter::EscapeForCMake(config_moc_compile_defs); + if (_moc_compile_defs.empty()) { + _moc_compile_defs = config_moc_compile_defs; + } } } } - const char* qtVersion = makefile->GetDefinition("_target_qt_version"); - if (strcmp(qtVersion, "5") == 0) { - cmGeneratorTarget* qt5Moc = lg->FindGeneratorTargetToUse("Qt5::moc"); - if (!qt5Moc) { - cmSystemTools::Error("Qt5::moc target not found ", - autogenTargetName.c_str()); - return; + // Moc executable + { + std::string err; + const char* mocExec = CM_NULLPTR; + if (qtMajorVersion == "5") { + cmGeneratorTarget* qt5Moc = lg->FindGeneratorTargetToUse("Qt5::moc"); + if (qt5Moc != CM_NULLPTR) { + mocExec = qt5Moc->ImportedGetLocation(""); + } else { + err = "Qt5::moc target not found " + autogenTargetName; + } + } else if (qtMajorVersion == "4") { + cmGeneratorTarget* qt4Moc = lg->FindGeneratorTargetToUse("Qt4::moc"); + if (qt4Moc != CM_NULLPTR) { + mocExec = qt4Moc->ImportedGetLocation(""); + } else { + err = "Qt4::moc target not found " + autogenTargetName; + } + } else { + err = "The CMAKE_AUTOMOC feature supports only Qt 4 and Qt 5 "; + err += autogenTargetName; } - makefile->AddDefinition("_qt_moc_executable", - qt5Moc->ImportedGetLocation("")); - } else if (strcmp(qtVersion, "4") == 0) { - cmGeneratorTarget* qt4Moc = lg->FindGeneratorTargetToUse("Qt4::moc"); - if (!qt4Moc) { - cmSystemTools::Error("Qt4::moc target not found ", - autogenTargetName.c_str()); - return; + // Add definition or error + if (err.empty()) { + AddDefinitionEscaped(makefile, "_qt_moc_executable", + mocExec ? mocExec : ""); + } else { + cmSystemTools::Error(err.c_str()); } - makefile->AddDefinition("_qt_moc_executable", - qt4Moc->ImportedGetLocation("")); - } else { - cmSystemTools::Error("The CMAKE_AUTOMOC feature supports only Qt 4 and " - "Qt 5 ", - autogenTargetName.c_str()); } } @@ -268,126 +334,140 @@ static void UicGetOpts(cmGeneratorTarget const* target, } static void UicSetupAutoTarget( - cmGeneratorTarget const* target, std::vector<std::string> const& skipUic, + cmGeneratorTarget const* target, const std::string& qtMajorVersion, + std::vector<std::string> const& uicSkipList, std::map<std::string, std::string>& configUicOptions) { cmLocalGenerator* lg = target->GetLocalGenerator(); cmMakefile* makefile = target->Target->GetMakefile(); - std::set<std::string> skipped; - skipped.insert(skipUic.begin(), skipUic.end()); + AddDefinitionEscaped(makefile, "_uic_skip", uicSkipList); - makefile->AddDefinition( - "_skip_uic", - cmOutputConverter::EscapeForCMake(cmJoin(skipUic, ";")).c_str()); - - std::vector<cmSourceFile*> uiFilesWithOptions = - makefile->GetQtUiFilesWithOptions(); - - const char* qtVersion = makefile->GetDefinition("_target_qt_version"); - - std::string _uic_opts; - std::vector<std::string> configs; - const std::string& config = makefile->GetConfigurations(configs); - UicGetOpts(target, config, _uic_opts); - - if (!_uic_opts.empty()) { - _uic_opts = cmOutputConverter::EscapeForCMake(_uic_opts); - makefile->AddDefinition("_uic_target_options", _uic_opts.c_str()); - } - for (std::vector<std::string>::const_iterator li = configs.begin(); - li != configs.end(); ++li) { - std::string config_uic_opts; - UicGetOpts(target, *li, config_uic_opts); - if (config_uic_opts != _uic_opts) { - configUicOptions[*li] = - cmOutputConverter::EscapeForCMake(config_uic_opts); - if (_uic_opts.empty()) { - _uic_opts = config_uic_opts; - } + // Uic search paths + { + std::vector<std::string> uicSearchPaths; + cmSystemTools::ExpandListArgument( + GetSafeProperty(target, "AUTOUIC_SEARCH_PATHS"), uicSearchPaths); + const std::string srcDir = makefile->GetCurrentSourceDirectory(); + for (std::vector<std::string>::iterator it = uicSearchPaths.begin(); + it != uicSearchPaths.end(); ++it) { + *it = cmSystemTools::CollapseFullPath(*it, srcDir); } + AddDefinitionEscaped(makefile, "_uic_search_paths", uicSearchPaths); } - std::string uiFileFiles; - std::string uiFileOptions; - const char* sep = ""; - - for (std::vector<cmSourceFile*>::const_iterator fileIt = - uiFilesWithOptions.begin(); - fileIt != uiFilesWithOptions.end(); ++fileIt) { - cmSourceFile* sf = *fileIt; - std::string absFile = cmsys::SystemTools::GetRealPath(sf->GetFullPath()); - - if (!skipped.insert(absFile).second) { - continue; + // Uic target options + { + std::string _uic_opts; + std::vector<std::string> configs; + UicGetOpts(target, makefile->GetConfigurations(configs), _uic_opts); + + AddDefinitionEscaped(makefile, "_uic_target_options", _uic_opts); + + for (std::vector<std::string>::const_iterator li = configs.begin(); + li != configs.end(); ++li) { + std::string config_uic_opts; + UicGetOpts(target, *li, config_uic_opts); + if (config_uic_opts != _uic_opts) { + configUicOptions[*li] = + cmOutputConverter::EscapeForCMake(config_uic_opts); + if (_uic_opts.empty()) { + _uic_opts = config_uic_opts; + } + } + } + } + // Uic files options + { + std::vector<std::string> uiFileFiles; + std::vector<std::string> uiFileOptions; + { + std::set<std::string> skipped; + skipped.insert(uicSkipList.begin(), uicSkipList.end()); + + const std::vector<cmSourceFile*> uiFilesWithOptions = + makefile->GetQtUiFilesWithOptions(); + for (std::vector<cmSourceFile*>::const_iterator fileIt = + uiFilesWithOptions.begin(); + fileIt != uiFilesWithOptions.end(); ++fileIt) { + cmSourceFile* sf = *fileIt; + const std::string absFile = + cmsys::SystemTools::GetRealPath(sf->GetFullPath()); + if (skipped.insert(absFile).second) { + // The file wasn't skipped + uiFileFiles.push_back(absFile); + { + std::string opts = sf->GetProperty("AUTOUIC_OPTIONS"); + cmSystemTools::ReplaceString(opts, ";", + cmQtAutoGeneratorCommon::listSep); + uiFileOptions.push_back(opts); + } + } + } } - uiFileFiles += sep; - uiFileFiles += absFile; - uiFileOptions += sep; - std::string opts = sf->GetProperty("AUTOUIC_OPTIONS"); - cmSystemTools::ReplaceString(opts, ";", "@list_sep@"); - uiFileOptions += opts; - sep = ";"; + AddDefinitionEscaped(makefile, "_qt_uic_options_files", uiFileFiles); + AddDefinitionEscaped(makefile, "_qt_uic_options_options", uiFileOptions); } - makefile->AddDefinition( - "_qt_uic_options_files", - cmOutputConverter::EscapeForCMake(uiFileFiles).c_str()); - makefile->AddDefinition( - "_qt_uic_options_options", - cmOutputConverter::EscapeForCMake(uiFileOptions).c_str()); - - std::string targetName = target->GetName(); - if (strcmp(qtVersion, "5") == 0) { - cmGeneratorTarget* qt5Uic = lg->FindGeneratorTargetToUse("Qt5::uic"); - if (!qt5Uic) { - // Project does not use Qt5Widgets, but has AUTOUIC ON anyway + // Uic executable + { + std::string err; + const char* uicExec = CM_NULLPTR; + if (qtMajorVersion == "5") { + cmGeneratorTarget* qt5Uic = lg->FindGeneratorTargetToUse("Qt5::uic"); + if (qt5Uic != CM_NULLPTR) { + uicExec = qt5Uic->ImportedGetLocation(""); + } else { + // Project does not use Qt5Widgets, but has AUTOUIC ON anyway + } + } else if (qtMajorVersion == "4") { + cmGeneratorTarget* qt4Uic = lg->FindGeneratorTargetToUse("Qt4::uic"); + if (qt4Uic != CM_NULLPTR) { + uicExec = qt4Uic->ImportedGetLocation(""); + } else { + err = "Qt4::uic target not found " + target->GetName(); + } } else { - makefile->AddDefinition("_qt_uic_executable", - qt5Uic->ImportedGetLocation("")); + err = "The CMAKE_AUTOUIC feature supports only Qt 4 and Qt 5 "; + err += target->GetName(); } - } else if (strcmp(qtVersion, "4") == 0) { - cmGeneratorTarget* qt4Uic = lg->FindGeneratorTargetToUse("Qt4::uic"); - if (!qt4Uic) { - cmSystemTools::Error("Qt4::uic target not found ", targetName.c_str()); - return; + // Add definition or error + if (err.empty()) { + AddDefinitionEscaped(makefile, "_qt_uic_executable", + uicExec ? uicExec : ""); + } else { + cmSystemTools::Error(err.c_str()); } - makefile->AddDefinition("_qt_uic_executable", - qt4Uic->ImportedGetLocation("")); - } else { - cmSystemTools::Error("The CMAKE_AUTOUIC feature supports only Qt 4 and " - "Qt 5 ", - targetName.c_str()); } } static std::string RccGetExecutable(cmGeneratorTarget const* target, const std::string& qtMajorVersion) { + std::string rccExec; cmLocalGenerator* lg = target->GetLocalGenerator(); - - std::string const& targetName = target->GetName(); if (qtMajorVersion == "5") { cmGeneratorTarget* qt5Rcc = lg->FindGeneratorTargetToUse("Qt5::rcc"); - if (!qt5Rcc) { - cmSystemTools::Error("Qt5::rcc target not found ", targetName.c_str()); - return std::string(); + if (qt5Rcc != CM_NULLPTR) { + rccExec = qt5Rcc->ImportedGetLocation(""); + } else { + cmSystemTools::Error("Qt5::rcc target not found ", + target->GetName().c_str()); } - return qt5Rcc->ImportedGetLocation(""); - } - if (qtMajorVersion == "4") { + } else if (qtMajorVersion == "4") { cmGeneratorTarget* qt4Rcc = lg->FindGeneratorTargetToUse("Qt4::rcc"); - if (!qt4Rcc) { - cmSystemTools::Error("Qt4::rcc target not found ", targetName.c_str()); - return std::string(); + if (qt4Rcc != CM_NULLPTR) { + rccExec = qt4Rcc->ImportedGetLocation(""); + } else { + cmSystemTools::Error("Qt4::rcc target not found ", + target->GetName().c_str()); } - return qt4Rcc->ImportedGetLocation(""); + } else { + cmSystemTools::Error( + "The CMAKE_AUTORCC feature supports only Qt 4 and Qt 5 ", + target->GetName().c_str()); } - - cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and " - "Qt 5 ", - targetName.c_str()); - return std::string(); + return rccExec; } static void RccMergeOptions(std::vector<std::string>& opts, @@ -397,255 +477,104 @@ static void RccMergeOptions(std::vector<std::string>& opts, static const char* valueOptions[] = { "name", "root", "compress", "threshold" }; std::vector<std::string> extraOpts; - for (std::vector<std::string>::const_iterator it = fileOpts.begin(); - it != fileOpts.end(); ++it) { + for (std::vector<std::string>::const_iterator fit = fileOpts.begin(); + fit != fileOpts.end(); ++fit) { std::vector<std::string>::iterator existingIt = - std::find(opts.begin(), opts.end(), *it); + std::find(opts.begin(), opts.end(), *fit); if (existingIt != opts.end()) { - const char* o = it->c_str(); - if (*o == '-') { - ++o; - } - if (isQt5 && *o == '-') { - ++o; + const char* optName = fit->c_str(); + if (*optName == '-') { + ++optName; + if (isQt5 && *optName == '-') { + ++optName; + } } - if (std::find_if(cmArrayBegin(valueOptions), cmArrayEnd(valueOptions), - cmStrCmp(*it)) != cmArrayEnd(valueOptions)) { - assert(existingIt + 1 != opts.end()); - *(existingIt + 1) = *(it + 1); - ++it; + // Test if this is a value option and change the existing value + if ((optName != fit->c_str()) && + std::find_if(cmArrayBegin(valueOptions), cmArrayEnd(valueOptions), + cmStrCmp(optName)) != cmArrayEnd(valueOptions)) { + const std::vector<std::string>::iterator existValueIt(existingIt + 1); + const std::vector<std::string>::const_iterator fileValueIt(fit + 1); + if ((existValueIt != opts.end()) && (fileValueIt != fileOpts.end())) { + *existValueIt = *fileValueIt; + ++fit; + } } } else { - extraOpts.push_back(*it); + extraOpts.push_back(*fit); } } opts.insert(opts.end(), extraOpts.begin(), extraOpts.end()); } -/// @brief Reads the resource files list from from a .qrc file - Qt5 version -/// @return True if the .qrc file was successfully parsed -static bool RccListInputsQt5(cmSourceFile* sf, cmGeneratorTarget const* target, - std::vector<std::string>& depends) -{ - const std::string rccCommand = RccGetExecutable(target, "5"); - if (rccCommand.empty()) { - cmSystemTools::Error("AUTOGEN: error: rcc executable not available\n"); - return false; - } - - bool hasDashDashList = false; - // Read rcc features - { - std::vector<std::string> command; - command.push_back(rccCommand); - command.push_back("--help"); - std::string rccStdOut; - std::string rccStdErr; - int retVal = 0; - bool result = - cmSystemTools::RunSingleCommand(command, &rccStdOut, &rccStdErr, &retVal, - CM_NULLPTR, cmSystemTools::OUTPUT_NONE); - if (result && retVal == 0 && - rccStdOut.find("--list") != std::string::npos) { - hasDashDashList = true; - } - } - // Run rcc list command - std::vector<std::string> command; - command.push_back(rccCommand); - command.push_back(hasDashDashList ? "--list" : "-list"); - - std::string absFile = cmsys::SystemTools::GetRealPath(sf->GetFullPath()); - command.push_back(absFile); - - std::string rccStdOut; - std::string rccStdErr; - int retVal = 0; - bool result = - cmSystemTools::RunSingleCommand(command, &rccStdOut, &rccStdErr, &retVal, - CM_NULLPTR, cmSystemTools::OUTPUT_NONE); - if (!result || retVal) { - std::ostringstream err; - err << "AUTOGEN: error: Rcc list process for " << sf->GetFullPath() - << " failed:\n" - << rccStdOut << "\n" - << rccStdErr << std::endl; - cmSystemTools::Error(err.str().c_str()); - return false; - } - - // Parse rcc list output - { - std::istringstream ostr(rccStdOut); - std::string oline; - while (std::getline(ostr, oline)) { - oline = utilStripCR(oline); - if (!oline.empty()) { - depends.push_back(oline); - } - } - } - - { - std::istringstream estr(rccStdErr); - std::string eline; - while (std::getline(estr, eline)) { - eline = utilStripCR(eline); - if (cmHasLiteralPrefix(eline, "RCC: Error in")) { - static std::string searchString = "Cannot find file '"; - - std::string::size_type pos = eline.find(searchString); - if (pos == std::string::npos) { - std::ostringstream err; - err << "AUTOGEN: error: Rcc lists unparsable output " << eline - << std::endl; - cmSystemTools::Error(err.str().c_str()); - return false; - } - pos += searchString.length(); - std::string::size_type sz = eline.size() - pos - 1; - depends.push_back(eline.substr(pos, sz)); - } - } - } - - return true; -} - -/// @brief Reads the resource files list from from a .qrc file - Qt4 version -/// @return True if the .qrc file was successfully parsed -static bool RccListInputsQt4(cmSourceFile* sf, - std::vector<std::string>& depends) -{ - // Read file into string - std::string qrcContents; - { - std::ostringstream stream; - stream << cmsys::ifstream(sf->GetFullPath().c_str()).rdbuf(); - qrcContents = stream.str(); - } - - cmsys::RegularExpression fileMatchRegex("(<file[^<]+)"); - - size_t offset = 0; - while (fileMatchRegex.find(qrcContents.c_str() + offset)) { - std::string qrcEntry = fileMatchRegex.match(1); - - offset += qrcEntry.size(); - - cmsys::RegularExpression fileReplaceRegex("(^<file[^>]*>)"); - fileReplaceRegex.find(qrcEntry); - std::string tag = fileReplaceRegex.match(1); - - qrcEntry = qrcEntry.substr(tag.size()); - - if (!cmSystemTools::FileIsFullPath(qrcEntry.c_str())) { - qrcEntry = sf->GetLocation().GetDirectory() + "/" + qrcEntry; - } - - depends.push_back(qrcEntry); - } - return true; -} - -/// @brief Reads the resource files list from from a .qrc file -/// @return True if the rcc file was successfully parsed -static bool RccListInputs(const std::string& qtMajorVersion, cmSourceFile* sf, - cmGeneratorTarget const* target, - std::vector<std::string>& depends) -{ - if (qtMajorVersion == "5") { - return RccListInputsQt5(sf, target, depends); - } - return RccListInputsQt4(sf, depends); -} - static void RccSetupAutoTarget(cmGeneratorTarget const* target, const std::string& qtMajorVersion) { - std::string _rcc_files; - const char* sepRccFiles = ""; cmMakefile* makefile = target->Target->GetMakefile(); - - std::vector<cmSourceFile*> srcFiles; - target->GetConfigCommonSourceFiles(srcFiles); - - std::string qrcInputs; - const char* qrcInputsSep = ""; - - std::string rccFileFiles; - std::string rccFileOptions; - const char* optionSep = ""; - const bool qtMajorVersion5 = (qtMajorVersion == "5"); - - std::vector<std::string> rccOptions; + const std::string rccCommand = RccGetExecutable(target, qtMajorVersion); + std::vector<std::string> _rcc_files; + std::vector<std::string> _rcc_inputs; + std::vector<std::string> rccFileFiles; + std::vector<std::string> rccFileOptions; + std::vector<std::string> rccOptionsTarget; if (const char* opts = target->GetProperty("AUTORCC_OPTIONS")) { - cmSystemTools::ExpandListArgument(opts, rccOptions); + cmSystemTools::ExpandListArgument(opts, rccOptionsTarget); } + std::vector<cmSourceFile*> srcFiles; + target->GetConfigCommonSourceFiles(srcFiles); for (std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin(); fileIt != srcFiles.end(); ++fileIt) { cmSourceFile* sf = *fileIt; - std::string ext = sf->GetExtension(); - if (ext == "qrc") { - std::string absFile = cmsys::SystemTools::GetRealPath(sf->GetFullPath()); - const bool skip = - cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOGEN")) || - cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC")); - - if (!skip) { - _rcc_files += sepRccFiles; - _rcc_files += absFile; - sepRccFiles = ";"; - + if ((sf->GetExtension() == "qrc") && + !PropertyEnabled(sf, "SKIP_AUTOGEN") && + !PropertyEnabled(sf, "SKIP_AUTORCC")) { + const std::string absFile = + cmsys::SystemTools::GetRealPath(sf->GetFullPath()); + // qrc file + _rcc_files.push_back(absFile); + // qrc file entries + { + std::string entriesList = "{"; + // Read input file list only for non generated .qrc files. + if (!PropertyEnabled(sf, "GENERATED")) { + std::string error; + std::vector<std::string> files; + if (cmQtAutoGeneratorCommon::RccListInputs( + qtMajorVersion, rccCommand, absFile, files, &error)) { + entriesList += cmJoin(files, cmQtAutoGeneratorCommon::listSep); + } else { + cmSystemTools::Error(error.c_str()); + } + } + entriesList += "}"; + _rcc_inputs.push_back(entriesList); + } + // rcc options for this qrc file + { + // Merged target and file options + std::vector<std::string> rccOptions(rccOptionsTarget); if (const char* prop = sf->GetProperty("AUTORCC_OPTIONS")) { std::vector<std::string> optsVec; cmSystemTools::ExpandListArgument(prop, optsVec); RccMergeOptions(rccOptions, optsVec, qtMajorVersion5); } - + // Only store non empty options lists if (!rccOptions.empty()) { - rccFileFiles += optionSep; - rccFileFiles += absFile; - rccFileOptions += optionSep; - } - const char* listSep = ""; - for (std::vector<std::string>::const_iterator it = rccOptions.begin(); - it != rccOptions.end(); ++it) { - rccFileOptions += listSep; - rccFileOptions += *it; - listSep = "@list_sep@"; - } - optionSep = ";"; - - std::string entriesList; - if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) { - std::vector<std::string> depends; - if (RccListInputs(qtMajorVersion, sf, target, depends)) { - entriesList = cmJoin(depends, "@list_sep@"); - } else { - return; - } + rccFileFiles.push_back(absFile); + rccFileOptions.push_back( + cmJoin(rccOptions, cmQtAutoGeneratorCommon::listSep)); } - qrcInputs += qrcInputsSep; - qrcInputs += entriesList; - qrcInputsSep = ";"; } } } - makefile->AddDefinition( - "_rcc_inputs", cmOutputConverter::EscapeForCMake(qrcInputs).c_str()); - makefile->AddDefinition( - "_rcc_files", cmOutputConverter::EscapeForCMake(_rcc_files).c_str()); - makefile->AddDefinition( - "_rcc_options_files", - cmOutputConverter::EscapeForCMake(rccFileFiles).c_str()); - makefile->AddDefinition( - "_rcc_options_options", - cmOutputConverter::EscapeForCMake(rccFileOptions).c_str()); - makefile->AddDefinition("_qt_rcc_executable", - RccGetExecutable(target, qtMajorVersion).c_str()); + + AddDefinitionEscaped(makefile, "_qt_rcc_executable", rccCommand); + AddDefinitionEscaped(makefile, "_rcc_files", _rcc_files); + AddDefinitionEscaped(makefile, "_rcc_inputs", _rcc_inputs); + AddDefinitionEscaped(makefile, "_rcc_options_files", rccFileFiles); + AddDefinitionEscaped(makefile, "_rcc_options_options", rccFileOptions); } void cmQtAutoGeneratorInitializer::InitializeAutogenSources( @@ -653,11 +582,14 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenSources( { if (target->GetPropertyAsBool("AUTOMOC")) { cmMakefile* makefile = target->Target->GetMakefile(); - const std::string mocCppFile = - GetAutogenTargetBuildDir(target) + "moc_compilation.cpp"; - cmSourceFile* gf = makefile->GetOrCreateSource(mocCppFile, true); - gf->SetProperty("SKIP_AUTOGEN", "On"); + std::string mocCppFile = GetAutogenTargetBuildDir(target); + mocCppFile += "moc_compilation.cpp"; + { + cmSourceFile* gFile = makefile->GetOrCreateSource(mocCppFile, true); + gFile->SetProperty("SKIP_AUTOGEN", "On"); + } target->AddSource(mocCppFile); + AddToSourceGroup(makefile, mocCppFile, cmQtAutoGeneratorCommon::MOC); } } @@ -667,12 +599,17 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( cmMakefile* makefile = target->Target->GetMakefile(); // Create a custom target for running generators at buildtime + const bool mocEnabled = target->GetPropertyAsBool("AUTOMOC"); + const bool uicEnabled = target->GetPropertyAsBool("AUTOUIC"); + const bool rccEnabled = target->GetPropertyAsBool("AUTORCC"); const std::string autogenTargetName = GetAutogenTargetName(target); const std::string autogenBuildDir = GetAutogenTargetBuildDir(target); const std::string workingDirectory = cmSystemTools::CollapseFullPath("", makefile->GetCurrentBinaryDirectory()); const std::string qtMajorVersion = GetQtMajorVersion(target); - std::vector<std::string> autogenOutputFiles; + const std::string rccCommand = RccGetExecutable(target, qtMajorVersion); + std::vector<std::string> autogenDepends; + std::vector<std::string> autogenProvides; // Remove old settings on cleanup { @@ -682,32 +619,6 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( false); } - // Create autogen target build directory and add it to the clean files - cmSystemTools::MakeDirectory(autogenBuildDir); - makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", - autogenBuildDir.c_str(), false); - - if (target->GetPropertyAsBool("AUTOMOC") || - target->GetPropertyAsBool("AUTOUIC")) { - // Create autogen target includes directory and - // add it to the origin target INCLUDE_DIRECTORIES - const std::string incsDir = autogenBuildDir + "include"; - cmSystemTools::MakeDirectory(incsDir); - target->AddIncludeDirectory(incsDir, true); - } - - if (target->GetPropertyAsBool("AUTOMOC")) { - // Register moc compilation file as generated - autogenOutputFiles.push_back(autogenBuildDir + "moc_compilation.cpp"); - } - - // Initialize autogen target dependencies - std::vector<std::string> depends; - if (const char* autogenDepends = - target->GetProperty("AUTOGEN_TARGET_DEPENDS")) { - cmSystemTools::ExpandListArgument(autogenDepends, depends); - } - // Compose command lines cmCustomCommandLines commandLines; { @@ -724,13 +635,13 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( std::string autogenComment; { std::vector<std::string> toolNames; - if (target->GetPropertyAsBool("AUTOMOC")) { + if (mocEnabled) { toolNames.push_back("MOC"); } - if (target->GetPropertyAsBool("AUTOUIC")) { + if (uicEnabled) { toolNames.push_back("UIC"); } - if (target->GetPropertyAsBool("AUTORCC")) { + if (rccEnabled) { toolNames.push_back("RCC"); } @@ -746,6 +657,24 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( autogenComment = "Automatic " + tools + " for target " + target->GetName(); } + // Create autogen target build directory and add it to the clean files + cmSystemTools::MakeDirectory(autogenBuildDir); + makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", + autogenBuildDir.c_str(), false); + + // Create autogen target includes directory and + // add it to the origin target INCLUDE_DIRECTORIES + if (mocEnabled || uicEnabled) { + const std::string incsDir = autogenBuildDir + "include"; + cmSystemTools::MakeDirectory(incsDir); + target->AddIncludeDirectory(incsDir, true); + } + + // Register moc compilation file as generated + if (mocEnabled) { + autogenProvides.push_back(autogenBuildDir + "moc_compilation.cpp"); + } + #if defined(_WIN32) && !defined(__CYGWIN__) bool usePRE_BUILD = false; cmGlobalGenerator* gg = lg->GetGlobalGenerator(); @@ -757,65 +686,103 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( // This also works around a VS 11 bug that may skip updating the target: // https://connect.microsoft.com/VisualStudio/feedback/details/769495 usePRE_BUILD = vsgg->GetVersion() >= cmGlobalVisualStudioGenerator::VS7; - if (usePRE_BUILD) { - // If the autogen target depends on an other target - // don't use PRE_BUILD - for (std::vector<std::string>::iterator it = depends.begin(); - it != depends.end(); ++it) { - if (!makefile->FindTargetToUse(it->c_str())) { - usePRE_BUILD = false; - break; - } - } - } } #endif - if (target->GetPropertyAsBool("AUTORCC")) { + // Initialize autogen target dependencies + if (const char* deps = target->GetProperty("AUTOGEN_TARGET_DEPENDS")) { + cmSystemTools::ExpandListArgument(deps, autogenDepends); + } + // Add link library targets to the autogen dependencies + { + const cmTarget::LinkLibraryVectorType& libVec = + target->Target->GetOriginalLinkLibraries(); + for (cmTarget::LinkLibraryVectorType::const_iterator it = libVec.begin(); + it != libVec.end(); ++it) { + const std::string& libName = it->first; + if (makefile->FindTargetToUse(libName) != CM_NULLPTR) { + autogenDepends.push_back(libName); + } + } + } + { cmFilePathChecksum fpathCheckSum(makefile); + // Iterate over all source files std::vector<cmSourceFile*> srcFiles; target->GetConfigCommonSourceFiles(srcFiles); for (std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin(); fileIt != srcFiles.end(); ++fileIt) { cmSourceFile* sf = *fileIt; - if (sf->GetExtension() == "qrc" && - !cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOGEN")) && - !cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"))) { - { + if (!PropertyEnabled(sf, "SKIP_AUTOGEN")) { + const std::string ext = sf->GetExtension(); + // Add generated file that will be scanned by moc or uic to + // the dependencies + if (mocEnabled || uicEnabled) { + const cmSystemTools::FileFormat fileType = + cmSystemTools::GetFileFormat(ext.c_str()); + if ((fileType == cmSystemTools::CXX_FILE_FORMAT) || + (fileType == cmSystemTools::HEADER_FILE_FORMAT)) { + if (PropertyEnabled(sf, "GENERATED")) { + if ((mocEnabled && !PropertyEnabled(sf, "SKIP_AUTOMOC")) || + (uicEnabled && !PropertyEnabled(sf, "SKIP_AUTOUIC"))) { + autogenDepends.push_back( + cmsys::SystemTools::GetRealPath(sf->GetFullPath())); +#if defined(_WIN32) && !defined(__CYGWIN__) + // Cannot use PRE_BUILD with generated files + usePRE_BUILD = false; +#endif + } + } + } + } + // Process rcc enabled files + if (rccEnabled && (ext == "qrc") && + !PropertyEnabled(sf, "SKIP_AUTORCC")) { const std::string absFile = cmsys::SystemTools::GetRealPath(sf->GetFullPath()); - // Run cmake again when .qrc file changes - makefile->AddCMakeDependFile(absFile); - - std::string rccOutputFile = autogenBuildDir; - rccOutputFile += fpathCheckSum.getPart(absFile); - rccOutputFile += "/qrc_"; - rccOutputFile += - cmsys::SystemTools::GetFilenameWithoutLastExtension(absFile); - rccOutputFile += ".cpp"; - - // Add rcc output file to origin target sources - cmSourceFile* gf = makefile->GetOrCreateSource(rccOutputFile, true); - gf->SetProperty("SKIP_AUTOGEN", "On"); - target->AddSource(rccOutputFile); - // Register rcc output file as generated - autogenOutputFiles.push_back(rccOutputFile); - } - if (lg->GetGlobalGenerator()->GetName() == "Ninja" -#if defined(_WIN32) && !defined(__CYGWIN__) - || usePRE_BUILD -#endif - ) { - if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) { - RccListInputs(qtMajorVersion, sf, target, depends); + // Compose rcc output file name + { + std::string rccOut = autogenBuildDir; + rccOut += fpathCheckSum.getPart(absFile); + rccOut += "/qrc_"; + rccOut += + cmsys::SystemTools::GetFilenameWithoutLastExtension(absFile); + rccOut += ".cpp"; + + // Register rcc output file as generated + autogenProvides.push_back(rccOut); + + // Add rcc output file to origin target sources + { + cmSourceFile* gFile = makefile->GetOrCreateSource(rccOut, true); + gFile->SetProperty("SKIP_AUTOGEN", "On"); + } + target->AddSource(rccOut); + AddToSourceGroup(makefile, rccOut, cmQtAutoGeneratorCommon::RCC); + } + + if (PropertyEnabled(sf, "GENERATED")) { + // Add generated qrc file to the dependencies + autogenDepends.push_back(absFile); + } else { + // Run cmake again when .qrc file changes + makefile->AddCMakeDependFile(absFile); + + // Add the qrc input files to the dependencies + std::string error; + if (!cmQtAutoGeneratorCommon::RccListInputs( + qtMajorVersion, rccCommand, absFile, autogenDepends, + &error)) { + cmSystemTools::Error(error.c_str()); + } + } #if defined(_WIN32) && !defined(__CYGWIN__) - // Cannot use PRE_BUILD because the resource files themselves - // may not be sources within the target so VS may not know the - // target needs to re-build at all. - usePRE_BUILD = false; + // Cannot use PRE_BUILD because the resource files themselves + // may not be sources within the target so VS may not know the + // target needs to re-build at all. + usePRE_BUILD = false; #endif - } } } } @@ -823,12 +790,21 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( #if defined(_WIN32) && !defined(__CYGWIN__) if (usePRE_BUILD) { + // If the autogen target depends on an other target don't use PRE_BUILD + for (std::vector<std::string>::iterator it = autogenDepends.begin(); + it != autogenDepends.end(); ++it) { + if (makefile->FindTargetToUse(*it) != CM_NULLPTR) { + usePRE_BUILD = false; + break; + } + } + } + if (usePRE_BUILD) { // Add the pre-build command directly to bypass the OBJECT_LIBRARY // rejection in cmMakefile::AddCustomCommandToTarget because we know // PRE_BUILD will work for an OBJECT_LIBRARY in this specific case. std::vector<std::string> no_output; - std::vector<std::string> no_byproducts; - cmCustomCommand cc(makefile, no_output, no_byproducts, depends, + cmCustomCommand cc(makefile, no_output, autogenProvides, autogenDepends, commandLines, autogenComment.c_str(), workingDirectory.c_str()); cc.SetEscapeOldStyle(false); @@ -839,7 +815,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( { cmTarget* autogenTarget = makefile->AddUtilityCommand( autogenTargetName, true, workingDirectory.c_str(), - /*byproducts=*/autogenOutputFiles, depends, commandLines, false, + /*byproducts=*/autogenProvides, autogenDepends, commandLines, false, autogenComment.c_str()); cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg); @@ -872,47 +848,41 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget( cmMakefile::ScopePushPop varScope(makefile); static_cast<void>(varScope); - // create a custom target for running generators at buildtime: - const std::string autogenTargetName = GetAutogenTargetName(target); - const std::string qtMajorVersion = GetQtMajorVersion(target); - - makefile->AddDefinition( - "_moc_target_name", - cmOutputConverter::EscapeForCMake(autogenTargetName).c_str()); - makefile->AddDefinition( - "_origin_target_name", - cmOutputConverter::EscapeForCMake(target->GetName()).c_str()); - makefile->AddDefinition("_target_qt_version", qtMajorVersion.c_str()); - - std::vector<std::string> mocUicSources; - std::vector<std::string> mocUicHeaders; - std::vector<std::string> skipMoc; - std::vector<std::string> skipUic; std::map<std::string, std::string> configMocIncludes; std::map<std::string, std::string> configMocDefines; std::map<std::string, std::string> configUicOptions; + { + const bool mocEnabled = target->GetPropertyAsBool("AUTOMOC"); + const bool uicEnabled = target->GetPropertyAsBool("AUTOUIC"); + const bool rccEnabled = target->GetPropertyAsBool("AUTORCC"); + const std::string autogenTargetName = GetAutogenTargetName(target); + const std::string qtMajorVersion = GetQtMajorVersion(target); + + std::vector<std::string> _sources; + std::vector<std::string> _headers; + + if (mocEnabled || uicEnabled || rccEnabled) { + std::vector<std::string> mocSkipList; + std::vector<std::string> uicSkipList; + AcquireScanFiles(target, _sources, _headers, mocSkipList, uicSkipList); + if (mocEnabled) { + MocSetupAutoTarget(target, autogenTargetName, qtMajorVersion, + mocSkipList, configMocIncludes, configMocDefines); + } + if (uicEnabled) { + UicSetupAutoTarget(target, qtMajorVersion, uicSkipList, + configUicOptions); + } + if (rccEnabled) { + RccSetupAutoTarget(target, qtMajorVersion); + } + } - if (target->GetPropertyAsBool("AUTOMOC") || - target->GetPropertyAsBool("AUTOUIC") || - target->GetPropertyAsBool("AUTORCC")) { - SetupSourceFiles(target, mocUicSources, mocUicHeaders, skipMoc, skipUic); - } - makefile->AddDefinition( - "_moc_uic_sources", - cmOutputConverter::EscapeForCMake(cmJoin(mocUicSources, ";")).c_str()); - makefile->AddDefinition( - "_moc_uic_headers", - cmOutputConverter::EscapeForCMake(cmJoin(mocUicHeaders, ";")).c_str()); - - if (target->GetPropertyAsBool("AUTOMOC")) { - MocSetupAutoTarget(target, autogenTargetName, skipMoc, configMocIncludes, - configMocDefines); - } - if (target->GetPropertyAsBool("AUTOUIC")) { - UicSetupAutoTarget(target, skipUic, configUicOptions); - } - if (target->GetPropertyAsBool("AUTORCC")) { - RccSetupAutoTarget(target, qtMajorVersion); + AddDefinitionEscaped(makefile, "_autogen_target_name", autogenTargetName); + AddDefinitionEscaped(makefile, "_origin_target_name", target->GetName()); + AddDefinitionEscaped(makefile, "_qt_version_major", qtMajorVersion); + AddDefinitionEscaped(makefile, "_sources", _sources); + AddDefinitionEscaped(makefile, "_headers", _headers); } // Generate config file @@ -924,7 +894,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget( makefile->ConfigureFile(inputFile.c_str(), outputFile.c_str(), false, true, false); - // Append custom definitions to config file + // Append custom config definitions to info file if (!configMocDefines.empty() || !configMocIncludes.empty() || !configUicOptions.empty()) { @@ -946,33 +916,34 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget( error += outputFile; error += " for writing."; cmSystemTools::Error(error.c_str()); - return; - } - if (!configMocDefines.empty()) { - for (std::map<std::string, std::string>::iterator - it = configMocDefines.begin(), - end = configMocDefines.end(); - it != end; ++it) { - infoFile << "set(AM_MOC_COMPILE_DEFINITIONS_" << it->first << " " - << it->second << ")\n"; + } else { + infoFile << "# Configuration specific options\n"; + if (!configMocDefines.empty()) { + for (std::map<std::string, std::string>::iterator + it = configMocDefines.begin(), + end = configMocDefines.end(); + it != end; ++it) { + infoFile << "set(AM_MOC_DEFINITIONS_" << it->first << " " + << it->second << ")\n"; + } } - } - if (!configMocIncludes.empty()) { - for (std::map<std::string, std::string>::iterator - it = configMocIncludes.begin(), - end = configMocIncludes.end(); - it != end; ++it) { - infoFile << "set(AM_MOC_INCLUDES_" << it->first << " " << it->second - << ")\n"; + if (!configMocIncludes.empty()) { + for (std::map<std::string, std::string>::iterator + it = configMocIncludes.begin(), + end = configMocIncludes.end(); + it != end; ++it) { + infoFile << "set(AM_MOC_INCLUDES_" << it->first << " " << it->second + << ")\n"; + } } - } - if (!configUicOptions.empty()) { - for (std::map<std::string, std::string>::iterator - it = configUicOptions.begin(), - end = configUicOptions.end(); - it != end; ++it) { - infoFile << "set(AM_UIC_TARGET_OPTIONS_" << it->first << " " - << it->second << ")\n"; + if (!configUicOptions.empty()) { + for (std::map<std::string, std::string>::iterator + it = configUicOptions.begin(), + end = configUicOptions.end(); + it != end; ++it) { + infoFile << "set(AM_UIC_TARGET_OPTIONS_" << it->first << " " + << it->second << ")\n"; + } } } } diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 1d6972b..246dd8d 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1,19 +1,21 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmQtAutoGenerators.h" +#include "cmQtAutoGeneratorCommon.h" #include <algorithm> #include <assert.h> #include <cmConfigure.h> #include <cmsys/FStream.hxx> #include <cmsys/Terminal.h> -#include <iostream> +#include <list> #include <sstream> #include <stdlib.h> #include <string.h> #include <utility> #include "cmAlgorithms.h" +#include "cmFilePathChecksum.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmOutputConverter.h" @@ -29,29 +31,52 @@ // -- Static variables -static const char* MocOldSettingsKey = "AM_MOC_OLD_SETTINGS"; -static const char* UicOldSettingsKey = "AM_UIC_OLD_SETTINGS"; -static const char* RccOldSettingsKey = "AM_RCC_OLD_SETTINGS"; +static const char* SettingsKeyMoc = "AM_MOC_OLD_SETTINGS"; +static const char* SettingsKeyUic = "AM_UIC_OLD_SETTINGS"; +static const char* SettingsKeyRcc = "AM_RCC_OLD_SETTINGS"; // -- Static functions -static std::string GetConfigDefinition(cmMakefile* makefile, - const std::string& key, - const std::string& config) +inline static std::string Quoted(const std::string& text) { - std::string keyConf = key; - if (!config.empty()) { - keyConf += "_"; - keyConf += config; + return cmQtAutoGeneratorCommon::Quoted(text); +} + +static void InfoGet(cmMakefile* makefile, const char* key, std::string& value) +{ + value = makefile->GetSafeDefinition(key); +} + +static void InfoGet(cmMakefile* makefile, const char* key, bool& value) +{ + value = makefile->IsOn(key); +} + +static void InfoGet(cmMakefile* makefile, const char* key, + std::vector<std::string>& list) +{ + cmSystemTools::ExpandListArgument(makefile->GetSafeDefinition(key), list); +} + +static void InfoGet(cmMakefile* makefile, const char* key, + const std::string& config, std::vector<std::string>& list) +{ + const char* valueConf = CM_NULLPTR; + { + std::string keyConf = key; + if (!config.empty()) { + keyConf += "_"; + keyConf += config; + } + valueConf = makefile->GetDefinition(keyConf); } - const char* valueConf = makefile->GetDefinition(keyConf); - if (valueConf != CM_NULLPTR) { - return valueConf; + if (valueConf == CM_NULLPTR) { + valueConf = makefile->GetSafeDefinition(key); } - return makefile->GetSafeDefinition(key); + cmSystemTools::ExpandListArgument(valueConf, list); } -static std::string OldSettingsFile(const std::string& targetDirectory) +static std::string SettingsFile(const std::string& targetDirectory) { std::string filename(cmSystemTools::CollapseFullPath(targetDirectory)); cmSystemTools::ConvertToUnixSlashes(filename); @@ -59,40 +84,28 @@ static std::string OldSettingsFile(const std::string& targetDirectory) return filename; } -static std::string FindMatchingHeader( - const std::string& absPath, const std::string& mocSubDir, - const std::string& basename, - const std::vector<std::string>& headerExtensions) +inline static bool SettingsMatch(cmMakefile* makefile, const char* key, + const std::string& value) { - std::string header; - for (std::vector<std::string>::const_iterator ext = headerExtensions.begin(); - ext != headerExtensions.end(); ++ext) { - std::string sourceFilePath = absPath + basename + "." + (*ext); - if (cmsys::SystemTools::FileExists(sourceFilePath.c_str())) { - header = sourceFilePath; - break; - } - // Try subdirectory instead - if (!mocSubDir.empty()) { - sourceFilePath = mocSubDir + basename + "." + (*ext); - if (cmsys::SystemTools::FileExists(sourceFilePath.c_str())) { - header = sourceFilePath; - break; - } - } - } + return (value == makefile->GetSafeDefinition(key)); +} - return header; +static void SettingWrite(std::ostream& ostr, const char* key, + const std::string& value) +{ + if (!value.empty()) { + ostr << "set(" << key << " " << cmOutputConverter::EscapeForCMake(value) + << ")\n"; + } } -static std::string ExtractSubDir(const std::string& absPath, - const std::string& currentMoc) +std::string subDirPrefix(const std::string& fileName) { - std::string subDir; - if (currentMoc.find_first_of('/') != std::string::npos) { - subDir = absPath + cmsys::SystemTools::GetFilenamePath(currentMoc) + '/'; + std::string res(cmsys::SystemTools::GetFilenamePath(fileName)); + if (!res.empty()) { + res += '/'; } - return subDir; + return res; } static bool FileNameIsUnique(const std::string& filePath, @@ -112,13 +125,19 @@ static bool FileNameIsUnique(const std::string& filePath, return true; } -static std::string ReadAll(const std::string& filename) +static bool ReadAll(std::string& content, const std::string& filename) { - cmsys::ifstream file(filename.c_str()); - std::ostringstream stream; - stream << file.rdbuf(); - file.close(); - return stream.str(); + bool success = false; + { + cmsys::ifstream ifs(filename.c_str()); + if (ifs) { + std::ostringstream osst; + osst << ifs.rdbuf(); + content = osst.str(); + success = true; + } + } + return success; } /** @@ -140,13 +159,19 @@ static bool ListContains(const std::vector<std::string>& list, return (std::find(list.begin(), list.end(), entry) != list.end()); } -static std::string JoinOptions(const std::map<std::string, std::string>& opts) +static std::string JoinOptionsList(const std::vector<std::string>& opts) +{ + return cmOutputConverter::EscapeForCMake(cmJoin(opts, ";")); +} + +static std::string JoinOptionsMap( + const std::map<std::string, std::string>& opts) { std::string result; for (std::map<std::string, std::string>::const_iterator it = opts.begin(); it != opts.end(); ++it) { if (it != opts.begin()) { - result += "%%%"; + result += cmQtAutoGeneratorCommon::listSep; } result += it->first; result += "==="; @@ -214,9 +239,9 @@ cmQtAutoGenerators::cmQtAutoGenerators() , RunMocFailed(false) , RunUicFailed(false) , RunRccFailed(false) - , GenerateMocAll(false) - , GenerateUicAll(false) - , GenerateRccAll(false) + , GenerateAllMoc(false) + , GenerateAllUic(false) + , GenerateAllRcc(false) { std::string colorEnv; @@ -229,9 +254,12 @@ cmQtAutoGenerators::cmQtAutoGenerators() } } + this->MacroFilters[0].first = "Q_OBJECT"; + this->MacroFilters[0].second.compile("[\n][ \t]*Q_OBJECT[^a-zA-Z0-9_]"); + this->MacroFilters[1].first = "Q_GADGET"; + this->MacroFilters[1].second.compile("[\n][ \t]*Q_GADGET[^a-zA-Z0-9_]"); + // Precompile regular expressions - this->RegExpQObject.compile("[\n][ \t]*Q_OBJECT[^a-zA-Z0-9_]"); - this->RegExpQGadget.compile("[\n][ \t]*Q_GADGET[^a-zA-Z0-9_]"); this->RegExpMocInclude.compile( "[\n][ \t]*#[ \t]*include[ \t]+" "[\"<](([^ \">]+/)?moc_[^ \">/]+\\.cpp|[^ \">]+\\.moc)[\">]"); @@ -255,23 +283,46 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory, CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, snapshot)); gg.SetCurrentMakefile(mf.get()); - if (!this->ReadAutogenInfoFile(mf.get(), targetDirectory, config)) { - return false; - } - // Read old settings - this->OldSettingsReadFile(mf.get(), targetDirectory); - // Init and run - this->Init(); - if (this->QtMajorVersion == "4" || this->QtMajorVersion == "5") { - if (!this->RunAutogen(mf.get())) { - return false; + bool success = false; + if (this->ReadAutogenInfoFile(mf.get(), targetDirectory, config)) { + // Read old settings + this->SettingsFileRead(mf.get(), targetDirectory); + // Init and run + this->Init(mf.get()); + if (this->RunAutogen()) { + // Write current settings + if (this->SettingsFileWrite(targetDirectory)) { + success = true; + } } } - // Write latest settings - if (!this->OldSettingsWriteFile(targetDirectory)) { - return false; + return success; +} + +bool cmQtAutoGenerators::MocDependFilterPush(const std::string& key, + const std::string& regExp) +{ + bool success = false; + if (!key.empty()) { + if (!regExp.empty()) { + MocDependFilter filter; + filter.key = key; + if (filter.regExp.compile(regExp)) { + this->MocDependFilters.push_back(filter); + success = true; + } else { + this->LogError("AutoMoc: Error in AUTOMOC_DEPEND_FILTERS: Compiling " + "regular expression failed.\nKey: " + + Quoted(key) + "\nExp.: " + Quoted(regExp)); + } + } else { + this->LogError("AutoMoc: Error in AUTOMOC_DEPEND_FILTERS: Regular " + "expression is empty"); + } + } else { + this->LogError("AutoMoc: Error in AUTOMOC_DEPEND_FILTERS: Key is empty"); } - return true; + return success; } bool cmQtAutoGenerators::ReadAutogenInfoFile( @@ -283,395 +334,373 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile( filename += "/AutogenInfo.cmake"; if (!makefile->ReadListFile(filename.c_str())) { - std::ostringstream err; - err << "AutoGen: error processing file: " << filename << std::endl; - this->LogError(err.str()); + this->LogError("AutoGen: Error processing file: " + filename); return false; } // - Target names - this->OriginTargetName = - makefile->GetSafeDefinition("AM_ORIGIN_TARGET_NAME"); - this->AutogenTargetName = makefile->GetSafeDefinition("AM_TARGET_NAME"); - - // - Directories - this->ProjectSourceDir = makefile->GetSafeDefinition("AM_CMAKE_SOURCE_DIR"); - this->ProjectBinaryDir = makefile->GetSafeDefinition("AM_CMAKE_BINARY_DIR"); - this->CurrentSourceDir = - makefile->GetSafeDefinition("AM_CMAKE_CURRENT_SOURCE_DIR"); - this->CurrentBinaryDir = - makefile->GetSafeDefinition("AM_CMAKE_CURRENT_BINARY_DIR"); + InfoGet(makefile, "AM_TARGET_NAME", this->AutogenTargetName); + InfoGet(makefile, "AM_ORIGIN_TARGET_NAME", this->OriginTargetName); + + // - Files and directories + InfoGet(makefile, "AM_CMAKE_SOURCE_DIR", this->ProjectSourceDir); + InfoGet(makefile, "AM_CMAKE_BINARY_DIR", this->ProjectBinaryDir); + InfoGet(makefile, "AM_CMAKE_CURRENT_SOURCE_DIR", this->CurrentSourceDir); + InfoGet(makefile, "AM_CMAKE_CURRENT_BINARY_DIR", this->CurrentBinaryDir); + InfoGet(makefile, "AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE", + this->IncludeProjectDirsBefore); + InfoGet(makefile, "AM_SOURCES", this->Sources); + InfoGet(makefile, "AM_HEADERS", this->Headers); // - Qt environment - this->QtMajorVersion = makefile->GetSafeDefinition("AM_QT_VERSION_MAJOR"); - if (this->QtMajorVersion == "") { - this->QtMajorVersion = - makefile->GetSafeDefinition("AM_Qt5Core_VERSION_MAJOR"); + InfoGet(makefile, "AM_QT_VERSION_MAJOR", this->QtMajorVersion); + if (this->QtMajorVersion.empty()) { + InfoGet(makefile, "AM_Qt5Core_VERSION_MAJOR", this->QtMajorVersion); + } + InfoGet(makefile, "AM_QT_MOC_EXECUTABLE", this->MocExecutable); + InfoGet(makefile, "AM_QT_UIC_EXECUTABLE", this->UicExecutable); + InfoGet(makefile, "AM_QT_RCC_EXECUTABLE", this->RccExecutable); + // Check Qt version + if ((this->QtMajorVersion != "4") && (this->QtMajorVersion != "5")) { + this->LogError("AutoGen: Error: Unsupported Qt version: " + + Quoted(this->QtMajorVersion)); + return false; } - this->MocExecutable = makefile->GetSafeDefinition("AM_QT_MOC_EXECUTABLE"); - this->UicExecutable = makefile->GetSafeDefinition("AM_QT_UIC_EXECUTABLE"); - this->RccExecutable = makefile->GetSafeDefinition("AM_QT_RCC_EXECUTABLE"); - - // - File Lists - cmSystemTools::ExpandListArgument(makefile->GetSafeDefinition("AM_SOURCES"), - this->Sources); - cmSystemTools::ExpandListArgument(makefile->GetSafeDefinition("AM_HEADERS"), - this->Headers); // - Moc - cmSystemTools::ExpandListArgument(makefile->GetSafeDefinition("AM_SKIP_MOC"), - this->SkipMoc); - this->MocCompileDefinitionsStr = - GetConfigDefinition(makefile, "AM_MOC_COMPILE_DEFINITIONS", config); - this->MocIncludesStr = - GetConfigDefinition(makefile, "AM_MOC_INCLUDES", config); - this->MocOptionsStr = makefile->GetSafeDefinition("AM_MOC_OPTIONS"); + if (this->MocEnabled()) { + InfoGet(makefile, "AM_MOC_SKIP", this->MocSkipList); + InfoGet(makefile, "AM_MOC_DEFINITIONS", config, this->MocDefinitions); + InfoGet(makefile, "AM_MOC_INCLUDES", config, this->MocIncludePaths); + InfoGet(makefile, "AM_MOC_OPTIONS", this->MocOptions); + InfoGet(makefile, "AM_MOC_RELAXED_MODE", this->MocRelaxedMode); + { + std::vector<std::string> mocDependFilters; + InfoGet(makefile, "AM_MOC_DEPEND_FILTERS", mocDependFilters); + // Insert Q_PLUGIN_METADATA dependency filter + if (this->QtMajorVersion != "4") { + this->MocDependFilterPush("Q_PLUGIN_METADATA", + "[\n][ \t]*Q_PLUGIN_METADATA[ \t]*\\(" + "[^\\)]*FILE[ \t]*\"([^\"]+)\""); + } + // Insert user defined dependency filters + if ((mocDependFilters.size() % 2) == 0) { + for (std::vector<std::string>::const_iterator dit = + mocDependFilters.begin(); + dit != mocDependFilters.end(); dit += 2) { + if (!this->MocDependFilterPush(*dit, *(dit + 1))) { + return false; + } + } + } else { + this->LogError( + "AutoMoc: Error: AUTOMOC_DEPEND_FILTERS list size is not " + "a multiple of 2 in:\n" + + Quoted(filename)); + return false; + } + } + } // - Uic - cmSystemTools::ExpandListArgument(makefile->GetSafeDefinition("AM_SKIP_UIC"), - this->SkipUic); - cmSystemTools::ExpandListArgument( - GetConfigDefinition(makefile, "AM_UIC_TARGET_OPTIONS", config), - this->UicTargetOptions); - { - std::vector<std::string> uicFilesVec; - std::vector<std::string> uicOptionsVec; - cmSystemTools::ExpandListArgument( - makefile->GetSafeDefinition("AM_UIC_OPTIONS_FILES"), uicFilesVec); - cmSystemTools::ExpandListArgument( - makefile->GetSafeDefinition("AM_UIC_OPTIONS_OPTIONS"), uicOptionsVec); - if (uicFilesVec.size() != uicOptionsVec.size()) { - std::ostringstream err; - err << "AutoGen: Error: Uic files/options lists size missmatch in: " - << filename << std::endl; - this->LogError(err.str()); - return false; - } - for (std::vector<std::string>::iterator fileIt = uicFilesVec.begin(), - optionIt = uicOptionsVec.begin(); - fileIt != uicFilesVec.end(); ++fileIt, ++optionIt) { - cmSystemTools::ReplaceString(*optionIt, "@list_sep@", ";"); - this->UicOptions[*fileIt] = *optionIt; + if (this->UicEnabled()) { + InfoGet(makefile, "AM_UIC_SKIP", this->UicSkipList); + InfoGet(makefile, "AM_UIC_SEARCH_PATHS", this->UicSearchPaths); + InfoGet(makefile, "AM_UIC_TARGET_OPTIONS", config, this->UicTargetOptions); + { + std::vector<std::string> uicFilesVec; + std::vector<std::string> uicOptionsVec; + InfoGet(makefile, "AM_UIC_OPTIONS_FILES", uicFilesVec); + InfoGet(makefile, "AM_UIC_OPTIONS_OPTIONS", uicOptionsVec); + // Compare list sizes + if (uicFilesVec.size() == uicOptionsVec.size()) { + for (std::vector<std::string>::iterator + fileIt = uicFilesVec.begin(), + optionIt = uicOptionsVec.begin(); + fileIt != uicFilesVec.end(); ++fileIt, ++optionIt) { + cmSystemTools::ReplaceString(*optionIt, + cmQtAutoGeneratorCommon::listSep, ";"); + this->UicOptions[*fileIt] = *optionIt; + } + } else { + this->LogError( + "AutoGen: Error: Uic files/options lists size missmatch in:\n" + + Quoted(filename)); + return false; + } } } // - Rcc - cmSystemTools::ExpandListArgument( - makefile->GetSafeDefinition("AM_RCC_SOURCES"), this->RccSources); - { - std::vector<std::string> rccFilesVec; - std::vector<std::string> rccOptionsVec; - cmSystemTools::ExpandListArgument( - makefile->GetSafeDefinition("AM_RCC_OPTIONS_FILES"), rccFilesVec); - cmSystemTools::ExpandListArgument( - makefile->GetSafeDefinition("AM_RCC_OPTIONS_OPTIONS"), rccOptionsVec); - if (rccFilesVec.size() != rccOptionsVec.size()) { - std::ostringstream err; - err << "AutoGen: Error: RCC files/options lists size missmatch in: " - << filename << std::endl; - this->LogError(err.str()); - return false; - } - for (std::vector<std::string>::iterator fileIt = rccFilesVec.begin(), - optionIt = rccOptionsVec.begin(); - fileIt != rccFilesVec.end(); ++fileIt, ++optionIt) { - cmSystemTools::ReplaceString(*optionIt, "@list_sep@", ";"); - this->RccOptions[*fileIt] = *optionIt; - } - } - { - std::vector<std::string> rccInputLists; - cmSystemTools::ExpandListArgument( - makefile->GetSafeDefinition("AM_RCC_INPUTS"), rccInputLists); - - // qrc files in the end of the list may have been empty - if (rccInputLists.size() < this->RccSources.size()) { - rccInputLists.resize(this->RccSources.size()); - } - if (this->RccSources.size() != rccInputLists.size()) { - std::ostringstream err; - err << "AutoGen: Error: RCC sources/inputs lists size missmatch in: " - << filename << std::endl; - this->LogError(err.str()); - return false; + if (this->RccEnabled()) { + InfoGet(makefile, "AM_RCC_SOURCES", this->RccSources); + // File options + { + std::vector<std::string> rccFilesVec; + std::vector<std::string> rccOptionsVec; + InfoGet(makefile, "AM_RCC_OPTIONS_FILES", rccFilesVec); + InfoGet(makefile, "AM_RCC_OPTIONS_OPTIONS", rccOptionsVec); + if (rccFilesVec.size() == rccOptionsVec.size()) { + for (std::vector<std::string>::iterator + fileIt = rccFilesVec.begin(), + optionIt = rccOptionsVec.begin(); + fileIt != rccFilesVec.end(); ++fileIt, ++optionIt) { + // Replace item separator + cmSystemTools::ReplaceString(*optionIt, + cmQtAutoGeneratorCommon::listSep, ";"); + this->RccOptions[*fileIt] = *optionIt; + } + } else { + this->LogError( + "AutoGen: Error: RCC files/options lists size missmatch in:\n" + + Quoted(filename)); + return false; + } } - for (std::vector<std::string>::iterator fileIt = this->RccSources.begin(), - inputIt = rccInputLists.begin(); - fileIt != this->RccSources.end(); ++fileIt, ++inputIt) { - cmSystemTools::ReplaceString(*inputIt, "@list_sep@", ";"); - std::vector<std::string> rccInputFiles; - cmSystemTools::ExpandListArgument(*inputIt, rccInputFiles); - this->RccInputs[*fileIt] = rccInputFiles; + // File lists + { + std::vector<std::string> rccInputLists; + InfoGet(makefile, "AM_RCC_INPUTS", rccInputLists); + if (this->RccSources.size() == rccInputLists.size()) { + for (std::vector<std::string>::iterator + fileIt = this->RccSources.begin(), + inputIt = rccInputLists.begin(); + fileIt != this->RccSources.end(); ++fileIt, ++inputIt) { + // Remove braces + *inputIt = inputIt->substr(1, inputIt->size() - 2); + // Replace item separator + cmSystemTools::ReplaceString(*inputIt, + cmQtAutoGeneratorCommon::listSep, ";"); + std::vector<std::string> rccInputFiles; + cmSystemTools::ExpandListArgument(*inputIt, rccInputFiles); + this->RccInputs[*fileIt] = rccInputFiles; + } + } else { + this->LogError( + "AutoGen: Error: RCC sources/inputs lists size missmatch in:\n" + + Quoted(filename)); + return false; + } } } - // - Flags - this->IncludeProjectDirsBefore = - makefile->IsOn("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE"); - this->MocRelaxedMode = makefile->IsOn("AM_MOC_RELAXED_MODE"); - return true; } -std::string cmQtAutoGenerators::MocSettingsStringCompose() -{ - std::string res; - res += this->MocCompileDefinitionsStr; - res += " ~~~ "; - res += this->MocIncludesStr; - res += " ~~~ "; - res += this->MocOptionsStr; - res += " ~~~ "; - res += this->IncludeProjectDirsBefore ? "TRUE" : "FALSE"; - res += " ~~~ "; - return res; -} - -std::string cmQtAutoGenerators::UicSettingsStringCompose() -{ - std::string res; - res += cmJoin(this->UicTargetOptions, "@osep@"); - res += " ~~~ "; - res += JoinOptions(this->UicOptions); - res += " ~~~ "; - return res; -} - -std::string cmQtAutoGenerators::RccSettingsStringCompose() +void cmQtAutoGenerators::SettingsFileRead(cmMakefile* makefile, + const std::string& targetDirectory) { - std::string res; - res += JoinOptions(this->RccOptions); - res += " ~~~ "; - return res; -} - -void cmQtAutoGenerators::OldSettingsReadFile( - cmMakefile* makefile, const std::string& targetDirectory) -{ - if (!this->MocExecutable.empty() || !this->UicExecutable.empty() || - !this->RccExecutable.empty()) { - // Compose current settings strings - this->MocSettingsString = this->MocSettingsStringCompose(); - this->UicSettingsString = this->UicSettingsStringCompose(); - this->RccSettingsString = this->RccSettingsStringCompose(); + // Compose current settings strings + if (this->MocEnabled()) { + std::string& str = this->SettingsStringMoc; + str += JoinOptionsList(this->MocDefinitions); + str += " ~~~ "; + str += JoinOptionsList(this->MocIncludePaths); + str += " ~~~ "; + str += JoinOptionsList(this->MocOptions); + str += " ~~~ "; + str += this->IncludeProjectDirsBefore ? "TRUE" : "FALSE"; + str += " ~~~ "; + } + if (this->UicEnabled()) { + std::string& str = this->SettingsStringUic; + str += JoinOptionsList(this->UicTargetOptions); + str += " ~~~ "; + str += JoinOptionsMap(this->UicOptions); + str += " ~~~ "; + } + if (this->RccEnabled()) { + std::string& str = this->SettingsStringRcc; + str += JoinOptionsMap(this->RccOptions); + str += " ~~~ "; + } - // Read old settings - const std::string filename = OldSettingsFile(targetDirectory); - if (makefile->ReadListFile(filename.c_str())) { - if (!this->MocExecutable.empty()) { - const std::string sol = makefile->GetSafeDefinition(MocOldSettingsKey); - if (sol != this->MocSettingsString) { - this->GenerateMocAll = true; - } - } - if (!this->UicExecutable.empty()) { - const std::string sol = makefile->GetSafeDefinition(UicOldSettingsKey); - if (sol != this->UicSettingsString) { - this->GenerateUicAll = true; - } - } - if (!this->RccExecutable.empty()) { - const std::string sol = makefile->GetSafeDefinition(RccOldSettingsKey); - if (sol != this->RccSettingsString) { - this->GenerateRccAll = true; - } - } - // In case any setting changed remove the old settings file. - // This triggers a full rebuild on the next run if the current - // build is aborted before writing the current settings in the end. - if (this->GenerateMocAll || this->GenerateUicAll || - this->GenerateRccAll) { - cmSystemTools::RemoveFile(filename); - } - } else { - // If the file could not be read re-generate everythiung. - this->GenerateMocAll = true; - this->GenerateUicAll = true; - this->GenerateRccAll = true; + // Read old settings + const std::string filename = SettingsFile(targetDirectory); + if (makefile->ReadListFile(filename.c_str())) { + if (!SettingsMatch(makefile, SettingsKeyMoc, this->SettingsStringMoc)) { + this->GenerateAllMoc = true; + } + if (!SettingsMatch(makefile, SettingsKeyUic, this->SettingsStringUic)) { + this->GenerateAllUic = true; + } + if (!SettingsMatch(makefile, SettingsKeyRcc, this->SettingsStringRcc)) { + this->GenerateAllRcc = true; } + // In case any setting changed remove the old settings file. + // This triggers a full rebuild on the next run if the current + // build is aborted before writing the current settings in the end. + if (this->GenerateAllAny()) { + cmSystemTools::RemoveFile(filename); + } + } else { + // If the file could not be read re-generate everythiung. + this->GenerateAllMoc = true; + this->GenerateAllUic = true; + this->GenerateAllRcc = true; } } -bool cmQtAutoGenerators::OldSettingsWriteFile( - const std::string& targetDirectory) +bool cmQtAutoGenerators::SettingsFileWrite(const std::string& targetDirectory) { bool success = true; // Only write if any setting changed - if (this->GenerateMocAll || this->GenerateUicAll || this->GenerateRccAll) { - const std::string filename = OldSettingsFile(targetDirectory); + if (this->GenerateAllAny()) { + const std::string filename = SettingsFile(targetDirectory); + if (this->Verbose) { + this->LogInfo("AutoGen: Writing settings file " + filename); + } cmsys::ofstream outfile; outfile.open(filename.c_str(), std::ios::trunc); if (outfile) { - if (!this->MocExecutable.empty()) { - outfile << "set(" << MocOldSettingsKey << " " - << cmOutputConverter::EscapeForCMake(this->MocSettingsString) - << ")\n"; - } - if (!this->UicExecutable.empty()) { - outfile << "set(" << UicOldSettingsKey << " " - << cmOutputConverter::EscapeForCMake(this->UicSettingsString) - << ")\n"; - } - if (!this->RccExecutable.empty()) { - outfile << "set(" << RccOldSettingsKey << " " - << cmOutputConverter::EscapeForCMake(this->RccSettingsString) - << ")\n"; - } + SettingWrite(outfile, SettingsKeyMoc, this->SettingsStringMoc); + SettingWrite(outfile, SettingsKeyUic, this->SettingsStringUic); + SettingWrite(outfile, SettingsKeyRcc, this->SettingsStringRcc); success = outfile.good(); outfile.close(); } else { success = false; // Remove old settings file to trigger full rebuild on next run cmSystemTools::RemoveFile(filename); - { - std::ostringstream err; - err << "AutoGen: Error: Writing old settings file failed: " << filename - << std::endl; - this->LogError(err.str()); - } + this->LogError("AutoGen: Error: Writing old settings file failed: " + + filename); } } return success; } -void cmQtAutoGenerators::Init() +void cmQtAutoGenerators::Init(cmMakefile* makefile) { this->AutogenBuildSubDir = this->AutogenTargetName; this->AutogenBuildSubDir += "/"; - this->OutMocCppFilenameRel = this->AutogenBuildSubDir; - this->OutMocCppFilenameRel += "moc_compilation.cpp"; + this->MocCppFilenameRel = this->AutogenBuildSubDir; + this->MocCppFilenameRel += "moc_compilation.cpp"; - this->OutMocCppFilenameAbs = - this->CurrentBinaryDir + this->OutMocCppFilenameRel; + this->MocCppFilenameAbs = this->CurrentBinaryDir + this->MocCppFilenameRel; // Init file path checksum generator fpathCheckSum.setupParentDirs(this->CurrentSourceDir, this->CurrentBinaryDir, this->ProjectSourceDir, this->ProjectBinaryDir); - std::vector<std::string> cdefList; - cmSystemTools::ExpandListArgument(this->MocCompileDefinitionsStr, cdefList); - for (std::vector<std::string>::const_iterator it = cdefList.begin(); - it != cdefList.end(); ++it) { - this->MocDefinitions.push_back("-D" + (*it)); - } - - cmSystemTools::ExpandListArgument(this->MocOptionsStr, this->MocOptions); - - std::vector<std::string> incPaths; - cmSystemTools::ExpandListArgument(this->MocIncludesStr, incPaths); - - std::set<std::string> frameworkPaths; - for (std::vector<std::string>::const_iterator it = incPaths.begin(); - it != incPaths.end(); ++it) { - const std::string& path = *it; - this->MocIncludes.push_back("-I" + path); - if (cmHasLiteralSuffix(path, ".framework/Headers")) { - // Go up twice to get to the framework root - std::vector<std::string> pathComponents; - cmsys::SystemTools::SplitPath(path, pathComponents); - std::string frameworkPath = cmsys::SystemTools::JoinPath( - pathComponents.begin(), pathComponents.end() - 2); - frameworkPaths.insert(frameworkPath); - } - } - - for (std::set<std::string>::const_iterator it = frameworkPaths.begin(); - it != frameworkPaths.end(); ++it) { - this->MocIncludes.push_back("-F"); - this->MocIncludes.push_back(*it); - } + // Acquire header extensions + this->HeaderExtensions = makefile->GetCMakeInstance()->GetHeaderExtensions(); + // Sort include directories on demand if (this->IncludeProjectDirsBefore) { - const std::string binDir = "-I" + this->ProjectBinaryDir; - const std::string srcDir = "-I" + this->ProjectSourceDir; - - std::list<std::string> sortedMocIncludes; - std::list<std::string>::iterator it = this->MocIncludes.begin(); - while (it != this->MocIncludes.end()) { - if (cmsys::SystemTools::StringStartsWith(*it, binDir.c_str())) { - sortedMocIncludes.push_back(*it); - it = this->MocIncludes.erase(it); - } else { - ++it; + // Move strings to temporary list + std::list<std::string> includes; + includes.insert(includes.end(), this->MocIncludePaths.begin(), + this->MocIncludePaths.end()); + this->MocIncludePaths.clear(); + this->MocIncludePaths.reserve(includes.size()); + // Append project directories only + { + const char* movePaths[2] = { this->ProjectBinaryDir.c_str(), + this->ProjectSourceDir.c_str() }; + for (const char* const* mpit = cmArrayBegin(movePaths); + mpit != cmArrayEnd(movePaths); ++mpit) { + std::list<std::string>::iterator it = includes.begin(); + while (it != includes.end()) { + const std::string& path = *it; + if (cmsys::SystemTools::StringStartsWith(path, *mpit)) { + this->MocIncludePaths.push_back(path); + it = includes.erase(it); + } else { + ++it; + } + } } } - it = this->MocIncludes.begin(); - while (it != this->MocIncludes.end()) { - if (cmsys::SystemTools::StringStartsWith(*it, srcDir.c_str())) { - sortedMocIncludes.push_back(*it); - it = this->MocIncludes.erase(it); - } else { - ++it; + // Append remaining directories + this->MocIncludePaths.insert(this->MocIncludePaths.end(), includes.begin(), + includes.end()); + } + // Compose moc includes list + { + std::set<std::string> frameworkPaths; + for (std::vector<std::string>::const_iterator it = + this->MocIncludePaths.begin(); + it != this->MocIncludePaths.end(); ++it) { + const std::string& path = *it; + this->MocIncludes.push_back("-I" + path); + // Extract framework path + if (cmHasLiteralSuffix(path, ".framework/Headers")) { + // Go up twice to get to the framework root + std::vector<std::string> pathComponents; + cmsys::SystemTools::SplitPath(path, pathComponents); + std::string frameworkPath = cmsys::SystemTools::JoinPath( + pathComponents.begin(), pathComponents.end() - 2); + frameworkPaths.insert(frameworkPath); } } - sortedMocIncludes.insert(sortedMocIncludes.end(), - this->MocIncludes.begin(), - this->MocIncludes.end()); - this->MocIncludes = sortedMocIncludes; + // Append framework includes + for (std::set<std::string>::const_iterator it = frameworkPaths.begin(); + it != frameworkPaths.end(); ++it) { + this->MocIncludes.push_back("-F"); + this->MocIncludes.push_back(*it); + } } } -bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile) +bool cmQtAutoGenerators::RunAutogen() { // the program goes through all .cpp files to see which moc files are // included. It is not really interesting how the moc file is named, but // what file the moc is created from. Once a moc is included the same moc // may not be included in the moc_compilation.cpp file anymore. OTOH if // there's a header containing Q_OBJECT where no corresponding moc file - // is included anywhere a moc_<filename>.cpp file is created and included in - // the moc_compilation.cpp file. + // is included anywhere a moc_<filename>.cpp file is created and included + // in the moc_compilation.cpp file. // key = moc source filepath, value = moc output filepath - std::map<std::string, std::string> includedMocs; - std::map<std::string, std::string> notIncludedMocs; - std::map<std::string, std::vector<std::string> > includedUis; + std::map<std::string, std::string> mocsIncluded; + std::map<std::string, std::string> mocsNotIncluded; + std::map<std::string, std::set<std::string> > mocDepends; + std::map<std::string, std::vector<std::string> > uisIncluded; // collects all headers which may need to be mocced - std::set<std::string> headerFilesMoc; - std::set<std::string> headerFilesUic; + std::set<std::string> mocHeaderFiles; + std::set<std::string> uicHeaderFiles; // Parse sources - { - const std::vector<std::string>& headerExtensions = - makefile->GetCMakeInstance()->GetHeaderExtensions(); - - for (std::vector<std::string>::const_iterator it = this->Sources.begin(); - it != this->Sources.end(); ++it) { - const std::string& absFilename = *it; - // Parse source file for MOC/UIC - if (!this->ParseSourceFile(absFilename, headerExtensions, includedMocs, - includedUis, this->MocRelaxedMode)) { - return false; - } - // Find additional headers - this->SearchHeadersForSourceFile(absFilename, headerExtensions, - headerFilesMoc, headerFilesUic); + for (std::vector<std::string>::const_iterator it = this->Sources.begin(); + it != this->Sources.end(); ++it) { + const std::string& absFilename = cmsys::SystemTools::GetRealPath(*it); + // Parse source file for MOC/UIC + if (!this->ParseSourceFile(absFilename, mocsIncluded, mocDepends, + uisIncluded, this->MocRelaxedMode)) { + return false; } + // Find additional headers + this->SearchHeadersForSourceFile(absFilename, mocHeaderFiles, + uicHeaderFiles); } // Parse headers for (std::vector<std::string>::const_iterator it = this->Headers.begin(); it != this->Headers.end(); ++it) { - const std::string& headerName = *it; - if (!this->MocSkipTest(headerName)) { - headerFilesMoc.insert(headerName); + const std::string& headerName = cmsys::SystemTools::GetRealPath(*it); + if (!this->MocSkip(headerName)) { + mocHeaderFiles.insert(headerName); } - if (!this->UicSkipTest(headerName)) { - headerFilesUic.insert(headerName); + if (!this->UicSkip(headerName)) { + uicHeaderFiles.insert(headerName); } } - this->ParseHeaders(headerFilesMoc, headerFilesUic, includedMocs, - notIncludedMocs, includedUis); + if (!this->ParseHeaders(mocHeaderFiles, uicHeaderFiles, mocsIncluded, + mocsNotIncluded, mocDepends, uisIncluded)) { + return false; + }; // Generate files - if (!this->MocGenerateAll(includedMocs, notIncludedMocs)) { + if (!this->MocGenerateAll(mocsIncluded, mocsNotIncluded, mocDepends)) { return false; } - if (!this->UicGenerateAll(includedUis)) { + if (!this->UicGenerateAll(uisIncluded)) { return false; } - if (!this->QrcGenerateAll()) { + if (!this->RccGenerateAll()) { return false; } @@ -682,35 +711,73 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile) * @brief Tests if the C++ content requires moc processing * @return True if moc is required */ -bool cmQtAutoGenerators::MocRequired(const std::string& text, - std::string& macroName) +bool cmQtAutoGenerators::MocRequired(const std::string& contentText, + std::string* macroName) { - // Run a simple check before an expensive regular expression check - if (strstr(text.c_str(), "Q_OBJECT") != CM_NULLPTR) { - if (this->RegExpQObject.find(text)) { - macroName = "Q_OBJECT"; - return true; + for (unsigned int ii = 0; ii != cmArraySize(this->MacroFilters); ++ii) { + MacroFilter& filter = this->MacroFilters[ii]; + // Run a simple find string operation before the expensive + // regular expression check + if (contentText.find(filter.first) != std::string::npos) { + if (filter.second.find(contentText)) { + // Return macro name on demand + if (macroName != CM_NULLPTR) { + *macroName = filter.first; + } + return true; + } } } - if (strstr(text.c_str(), "Q_GADGET") != CM_NULLPTR) { - if (this->RegExpQGadget.find(text)) { - macroName = "Q_GADGET"; - return true; + return false; +} + +void cmQtAutoGenerators::MocFindDepends( + const std::string& absFilename, const std::string& contentText, + std::map<std::string, std::set<std::string> >& mocDepends) +{ + for (std::vector<MocDependFilter>::iterator fit = + this->MocDependFilters.begin(); + fit != this->MocDependFilters.end(); ++fit) { + MocDependFilter& filter = *fit; + // Run a simple find string operation before the expensive + // regular expression check + if (contentText.find(filter.key) != std::string::npos) { + // Run regular expression check loop + const std::string sourcePath = subDirPrefix(absFilename); + const char* contentChars = contentText.c_str(); + while (filter.regExp.find(contentChars)) { + // Evaluate match + const std::string match = filter.regExp.match(1); + if (!match.empty()) { + // Find the dependency file + std::string incFile; + if (this->MocFindIncludedFile(incFile, sourcePath, match)) { + mocDepends[absFilename].insert(incFile); + if (this->Verbose) { + this->LogInfo("AutoMoc: Found dependency:\n " + + Quoted(absFilename) + "\n " + Quoted(incFile)); + } + } else { + this->LogWarning("AutoMoc: Warning: " + Quoted(absFilename) + + "\n" + "Could not find dependency file " + + Quoted(match)); + } + } + contentChars += filter.regExp.end(); + } } } - return false; } /** * @brief Tests if the file should be ignored for moc scanning * @return True if the file should be ignored */ -bool cmQtAutoGenerators::MocSkipTest(const std::string& absFilename) +bool cmQtAutoGenerators::MocSkip(const std::string& absFilename) const { - // Test if moc scanning is enabled - if (!this->MocExecutable.empty()) { + if (this->MocEnabled()) { // Test if the file name is on the skip list - if (!ListContains(this->SkipMoc, absFilename)) { + if (!ListContains(this->MocSkipList, absFilename)) { return false; } } @@ -720,12 +787,11 @@ bool cmQtAutoGenerators::MocSkipTest(const std::string& absFilename) /** * @brief Tests if the file name is in the skip list */ -bool cmQtAutoGenerators::UicSkipTest(const std::string& absFilename) +bool cmQtAutoGenerators::UicSkip(const std::string& absFilename) const { - // Test if uic scanning is enabled - if (!this->UicExecutable.empty()) { + if (this->UicEnabled()) { // Test if the file name is on the skip list - if (!ListContains(this->SkipUic, absFilename)) { + if (!ListContains(this->UicSkipList, absFilename)) { return false; } } @@ -737,52 +803,49 @@ bool cmQtAutoGenerators::UicSkipTest(const std::string& absFilename) */ bool cmQtAutoGenerators::ParseSourceFile( const std::string& absFilename, - const std::vector<std::string>& headerExtensions, - std::map<std::string, std::string>& includedMocs, - std::map<std::string, std::vector<std::string> >& includedUis, bool relaxed) + std::map<std::string, std::string>& mocsIncluded, + std::map<std::string, std::set<std::string> >& mocDepends, + std::map<std::string, std::vector<std::string> >& uisIncluded, bool relaxed) { - bool success = true; - const std::string contentsString = ReadAll(absFilename); - if (contentsString.empty()) { - std::ostringstream err; - err << "AutoGen: Warning: " << absFilename << "\n" - << "The file is empty\n"; - this->LogWarning(err.str()); - } else { - // Parse source contents for MOC - if (success && !this->MocSkipTest(absFilename)) { - success = this->ParseContentForMoc( - absFilename, contentsString, headerExtensions, includedMocs, relaxed); - } - // Parse source contents for UIC - if (success && !this->UicSkipTest(absFilename)) { - this->ParseContentForUic(absFilename, contentsString, includedUis); + std::string contentText; + bool success = ReadAll(contentText, absFilename); + if (success) { + if (!contentText.empty()) { + // Parse source contents for MOC + if (success && !this->MocSkip(absFilename)) { + success = this->MocParseSourceContent( + absFilename, contentText, mocsIncluded, mocDepends, relaxed); + } + // Parse source contents for UIC + if (success && !this->UicSkip(absFilename)) { + this->UicParseContent(absFilename, contentText, uisIncluded); + } + } else { + std::ostringstream ost; + ost << "AutoGen: Warning: The file is empty:\n" + << Quoted(absFilename) << "\n"; + this->LogWarning(ost.str()); } + } else { + std::ostringstream ost; + ost << "AutoGen: Error: Could not read file:\n" << Quoted(absFilename); + this->LogError(ost.str()); } return success; } -void cmQtAutoGenerators::ParseContentForUic( - const std::string& absFilename, const std::string& contentsString, - std::map<std::string, std::vector<std::string> >& includedUis) +void cmQtAutoGenerators::UicParseContent( + const std::string& absFilename, const std::string& contentText, + std::map<std::string, std::vector<std::string> >& uisIncluded) { - // Process if (this->Verbose) { - std::ostringstream err; - err << "AutoUic: Checking " << absFilename << "\n"; - this->LogInfo(err.str()); + this->LogInfo("AutoUic: Checking " + absFilename); } - const std::string realName = cmsys::SystemTools::GetRealPath(absFilename); - const char* contentChars = contentsString.c_str(); + const char* contentChars = contentText.c_str(); if (strstr(contentChars, "ui_") != CM_NULLPTR) { while (this->RegExpUicInclude.find(contentChars)) { - const std::string currentUi = this->RegExpUicInclude.match(1); - const std::string basename = - cmsys::SystemTools::GetFilenameWithoutLastExtension(currentUi); - // basename should be the part of the ui filename used for - // finding the correct header, so we need to remove the ui_ part - includedUis[realName].push_back(basename.substr(3)); + uisIncluded[absFilename].push_back(this->RegExpUicInclude.match(1)); contentChars += this->RegExpUicInclude.end(); } } @@ -791,79 +854,67 @@ void cmQtAutoGenerators::ParseContentForUic( /** * @return True on success */ -bool cmQtAutoGenerators::ParseContentForMoc( - const std::string& absFilename, const std::string& contentsString, - const std::vector<std::string>& headerExtensions, - std::map<std::string, std::string>& includedMocs, bool relaxed) +bool cmQtAutoGenerators::MocParseSourceContent( + const std::string& absFilename, const std::string& contentText, + std::map<std::string, std::string>& mocsIncluded, + std::map<std::string, std::set<std::string> >& mocDepends, bool relaxed) { - // Process if (this->Verbose) { - std::ostringstream err; - err << "AutoMoc: Checking " << absFilename << "\n"; - this->LogInfo(err.str()); + this->LogInfo("AutoMoc: Checking " + absFilename); } - const std::string scannedFileAbsPath = - cmsys::SystemTools::GetFilenamePath( - cmsys::SystemTools::GetRealPath(absFilename)) + - '/'; + const std::string scannedFileAbsPath = subDirPrefix(absFilename); const std::string scannedFileBasename = cmsys::SystemTools::GetFilenameWithoutLastExtension(absFilename); std::string macroName; - const bool requiresMoc = this->MocRequired(contentsString, macroName); + const bool requiresMoc = this->MocRequired(contentText, ¯oName); bool ownDotMocIncluded = false; - bool ownMocUnderscoreIncluded = false; - std::string ownMocUnderscoreFile; - std::string ownMocHeaderFile; + std::string ownMocUnderscoreInclude; + std::string ownMocUnderscoreHeader; // first a simple string check for "moc" is *much* faster than the regexp, // and if the string search already fails, we don't have to try the // expensive regexp - const char* contentChars = contentsString.c_str(); + const char* contentChars = contentText.c_str(); if (strstr(contentChars, "moc") != CM_NULLPTR) { // Iterate over all included moc files while (this->RegExpMocInclude.find(contentChars)) { - const std::string currentMoc = this->RegExpMocInclude.match(1); - // Basename of the current moc include - std::string basename = - cmsys::SystemTools::GetFilenameWithoutLastExtension(currentMoc); + const std::string incString = this->RegExpMocInclude.match(1); + // Basename of the moc include + const std::string incSubDir(subDirPrefix(incString)); + const std::string incBasename = + cmsys::SystemTools::GetFilenameWithoutLastExtension(incString); // If the moc include is of the moc_foo.cpp style we expect // the Q_OBJECT class declaration in a header file. // If the moc include is of the foo.moc style we need to look for // a Q_OBJECT macro in the current source file, if it contains the // macro we generate the moc file from the source file. - if (cmHasLiteralPrefix(basename, "moc_")) { + if (cmHasLiteralPrefix(incBasename, "moc_")) { // Include: moc_FOO.cxx - // basename should be the part of the moc filename used for - // finding the correct header, so we need to remove the moc_ part - basename = basename.substr(4); - const std::string mocSubDir = - ExtractSubDir(scannedFileAbsPath, currentMoc); - const std::string headerToMoc = FindMatchingHeader( - scannedFileAbsPath, mocSubDir, basename, headerExtensions); - + // Remove the moc_ part + const std::string incRealBasename = incBasename.substr(4); + const std::string headerToMoc = + this->MocFindHeader(scannedFileAbsPath, incSubDir + incRealBasename); if (!headerToMoc.empty()) { - includedMocs[headerToMoc] = currentMoc; - if (relaxed && (basename == scannedFileBasename)) { - ownMocUnderscoreIncluded = true; - ownMocUnderscoreFile = currentMoc; - ownMocHeaderFile = headerToMoc; + // Register moc job + mocsIncluded[headerToMoc] = incString; + this->MocFindDepends(headerToMoc, contentText, mocDepends); + // Store meta information for relaxed mode + if (relaxed && (incRealBasename == scannedFileBasename)) { + ownMocUnderscoreInclude = incString; + ownMocUnderscoreHeader = headerToMoc; } } else { - std::ostringstream err; - err << "AutoMoc: Error: " << absFilename << "\n" - << "The file includes the moc file \"" << currentMoc - << "\", but could not find header \"" << basename << '{' - << JoinExts(headerExtensions) << "}\" "; - if (mocSubDir.empty()) { - err << "in " << scannedFileAbsPath << "\n"; - } else { - err << "neither in " << scannedFileAbsPath << " nor in " - << mocSubDir << "\n"; - } - this->LogError(err.str()); + std::ostringstream ost; + ost << "AutoMoc: Error: " << absFilename << "\n" + << "The file includes the moc file " << Quoted(incString) + << ", but could not find header " + << Quoted(incRealBasename + "{" + + JoinExts(this->HeaderExtensions) + "}"); + ; + this->LogError(ost.str()); return false; } } else { @@ -871,71 +922,81 @@ bool cmQtAutoGenerators::ParseContentForMoc( std::string fileToMoc; if (relaxed) { // Mode: Relaxed - if (!requiresMoc || basename != scannedFileBasename) { - const std::string mocSubDir = - ExtractSubDir(scannedFileAbsPath, currentMoc); - const std::string headerToMoc = FindMatchingHeader( - scannedFileAbsPath, mocSubDir, basename, headerExtensions); + if (requiresMoc && (incBasename == scannedFileBasename)) { + // Include self + fileToMoc = absFilename; + ownDotMocIncluded = true; + } else { + // In relaxed mode try to find a header instead but issue a warning + const std::string headerToMoc = + this->MocFindHeader(scannedFileAbsPath, incSubDir + incBasename); if (!headerToMoc.empty()) { // This is for KDE4 compatibility: fileToMoc = headerToMoc; - if (!requiresMoc && basename == scannedFileBasename) { - std::ostringstream err; - err << "AutoMoc: Warning: " << absFilename << "\n" - << "The file includes the moc file \"" << currentMoc - << "\", but does not contain a " << macroName - << " macro. Running moc on " - << "\"" << headerToMoc << "\" ! Include \"moc_" << basename - << ".cpp\" for a compatibility with " - "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n"; - this->LogWarning(err.str()); + if (!requiresMoc && (incBasename == scannedFileBasename)) { + std::ostringstream ost; + ost << "AutoMoc: Warning: " << Quoted(absFilename) << "\n" + << "The file includes the moc file " << Quoted(incString) + << ", but does not contain a Q_OBJECT or Q_GADGET macro.\n" + << "Running moc on " << Quoted(headerToMoc) << "!\n" + << "Include " << Quoted("moc_" + incBasename + ".cpp") + << " for a compatibility with strict mode (see " + "CMAKE_AUTOMOC_RELAXED_MODE).\n"; + this->LogWarning(ost.str()); } else { - std::ostringstream err; - err << "AutoMoc: Warning: " << absFilename << "\n" - << "The file includes the moc file \"" << currentMoc - << "\" instead of \"moc_" << basename - << ".cpp\". Running moc on " - << "\"" << headerToMoc << "\" ! Include \"moc_" << basename - << ".cpp\" for compatibility with " - "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n"; - this->LogWarning(err.str()); + std::ostringstream ost; + ost << "AutoMoc: Warning: " << Quoted(absFilename) << "\n" + << "The file includes the moc file " << Quoted(incString) + << " instead of " << Quoted("moc_" + incBasename + ".cpp") + << ".\n" + << "Running moc on " << Quoted(headerToMoc) << "!\n" + << "Include " << Quoted("moc_" + incBasename + ".cpp") + << " for compatibility with strict mode (see " + "CMAKE_AUTOMOC_RELAXED_MODE).\n"; + this->LogWarning(ost.str()); } } else { - std::ostringstream err; - err << "AutoMoc: Error: " << absFilename << "\n" - << "The file includes the moc file \"" << currentMoc - << "\", which seems to be the moc file from a different " + std::ostringstream ost; + ost << "AutoMoc: Error: " << Quoted(absFilename) << "\n" + << "The file includes the moc file " << Quoted(incString) + << ". which seems to be the moc file from a different " "source file. CMake also could not find a matching " - "header.\n"; - this->LogError(err.str()); + "header."; + this->LogError(ost.str()); return false; } - } else { - // Include self - fileToMoc = absFilename; - ownDotMocIncluded = true; } } else { // Mode: Strict - if (basename == scannedFileBasename) { + if (incBasename == scannedFileBasename) { // Include self fileToMoc = absFilename; ownDotMocIncluded = true; + // Accept but issue a warning if moc isn't required + if (!requiresMoc) { + std::ostringstream ost; + ost << "AutoMoc: Error: " << Quoted(absFilename) << "\n" + << "The file includes the moc file " << Quoted(incString) + << ", but does not contain a Q_OBJECT or Q_GADGET " + "macro."; + this->LogWarning(ost.str()); + } } else { // Don't allow FOO.moc include other than self in strict mode - std::ostringstream err; - err << "AutoMoc: Error: " << absFilename << "\n" - << "The file includes the moc file \"" << currentMoc - << "\", which seems to be the moc file from a different " - "source file. This is not supported. Include \"" - << scannedFileBasename - << ".moc\" to run moc on this source file.\n"; - this->LogError(err.str()); + std::ostringstream ost; + ost << "AutoMoc: Error: " << Quoted(absFilename) << "\n" + << "The file includes the moc file " << Quoted(incString) + << ", which seems to be the moc file from a different " + "source file. This is not supported. Include " + << Quoted(scannedFileBasename + ".moc") + << " to run moc on this source file."; + this->LogError(ost.str()); return false; } } if (!fileToMoc.empty()) { - includedMocs[fileToMoc] = currentMoc; + mocsIncluded[fileToMoc] = incString; + this->MocFindDepends(fileToMoc, contentText, mocDepends); } } // Forward content pointer @@ -943,36 +1004,40 @@ bool cmQtAutoGenerators::ParseContentForMoc( } } - // In this case, check whether the scanned file itself contains a Q_OBJECT. - // If this is the case, the moc_foo.cpp should probably be generated from - // foo.cpp instead of foo.h, because otherwise it won't build. - // But warn, since this is not how it is supposed to be used. if (requiresMoc && !ownDotMocIncluded) { - if (relaxed && ownMocUnderscoreIncluded) { + // In this case, check whether the scanned file itself contains a Q_OBJECT. + // If this is the case, the moc_foo.cpp should probably be generated from + // foo.cpp instead of foo.h, because otherwise it won't build. + // But warn, since this is not how it is supposed to be used. + if (relaxed && !ownMocUnderscoreInclude.empty()) { // This is for KDE4 compatibility: - std::ostringstream err; - err << "AutoMoc: Warning: " << absFilename << "\n" + std::ostringstream ost; + ost << "AutoMoc: Warning: " << Quoted(absFilename) << "\n" << "The file contains a " << macroName << " macro, but does not include " - << "\"" << scannedFileBasename << ".moc\", but instead includes " - << "\"" << ownMocUnderscoreFile << "\". Running moc on " - << "\"" << absFilename << "\" ! Better include \"" - << scannedFileBasename - << ".moc\" for compatibility with " - "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n"; - this->LogWarning(err.str()); + << Quoted(scannedFileBasename + ".moc") << ", but instead includes " + << Quoted(ownMocUnderscoreInclude) << ".\n" + << "Running moc on " << Quoted(absFilename) << "!\n" + << "Better include " << Quoted(scannedFileBasename + ".moc") + << " for compatibility with strict mode (see " + "CMAKE_AUTOMOC_RELAXED_MODE)."; + this->LogWarning(ost.str()); // Use scanned source file instead of scanned header file as moc source - includedMocs[absFilename] = ownMocUnderscoreFile; - includedMocs.erase(ownMocHeaderFile); + mocsIncluded[absFilename] = ownMocUnderscoreInclude; + this->MocFindDepends(absFilename, contentText, mocDepends); + // Remove + mocsIncluded.erase(ownMocUnderscoreHeader); } else { // Otherwise always error out since it will not compile: - std::ostringstream err; - err << "AutoMoc: Error: " << absFilename << "\n" + std::ostringstream ost; + ost << "AutoMoc: Error: " << Quoted(absFilename) << "\n" << "The file contains a " << macroName << " macro, but does not include " - << "\"" << scannedFileBasename << ".moc\" !\n"; - this->LogError(err.str()); + << Quoted(scannedFileBasename + ".moc") << "!\n" + << "Consider adding the include or enabling SKIP_AUTOMOC for this " + "file."; + this->LogError(ost.str()); return false; } } @@ -980,144 +1045,145 @@ bool cmQtAutoGenerators::ParseContentForMoc( return true; } +void cmQtAutoGenerators::MocParseHeaderContent( + const std::string& absFilename, const std::string& contentText, + std::map<std::string, std::string>& mocsNotIncluded, + std::map<std::string, std::set<std::string> >& mocDepends) +{ + // Log + if (this->Verbose) { + this->LogInfo("AutoMoc: Checking " + absFilename); + } + if (this->MocRequired(contentText)) { + // Register moc job + mocsNotIncluded[absFilename] = + this->ChecksumedPath(absFilename, "moc_", ".cpp"); + this->MocFindDepends(absFilename, contentText, mocDepends); + } +} + void cmQtAutoGenerators::SearchHeadersForSourceFile( - const std::string& absFilename, - const std::vector<std::string>& headerExtensions, - std::set<std::string>& absHeadersMoc, std::set<std::string>& absHeadersUic) + const std::string& absFilename, std::set<std::string>& mocHeaderFiles, + std::set<std::string>& uicHeaderFiles) const { - // search for header files and private header files we may need to moc: - std::string basepath = cmsys::SystemTools::GetFilenamePath( - cmsys::SystemTools::GetRealPath(absFilename)); - basepath += '/'; - basepath += cmsys::SystemTools::GetFilenameWithoutLastExtension(absFilename); - - // Search for regular header - for (std::vector<std::string>::const_iterator ext = headerExtensions.begin(); - ext != headerExtensions.end(); ++ext) { - const std::string headerName = basepath + "." + (*ext); - if (cmsys::SystemTools::FileExists(headerName.c_str())) { - // Moc headers - if (!this->MocSkipTest(absFilename) && !this->MocSkipTest(headerName)) { - absHeadersMoc.insert(headerName); - } - // Uic headers - if (!this->UicSkipTest(absFilename) && !this->UicSkipTest(headerName)) { - absHeadersUic.insert(headerName); - } - break; - } + std::string basepaths[2]; + { + std::string bpath = subDirPrefix(absFilename); + bpath += cmsys::SystemTools::GetFilenameWithoutLastExtension(absFilename); + // search for default header files and private header files + basepaths[0] = bpath; + basepaths[1] = bpath + "_p"; } - // Search for private header - for (std::vector<std::string>::const_iterator ext = headerExtensions.begin(); - ext != headerExtensions.end(); ++ext) { - const std::string headerName = basepath + "_p." + (*ext); - if (cmsys::SystemTools::FileExists(headerName.c_str())) { + + for (const std::string* bpit = cmArrayBegin(basepaths); + bpit != cmArrayEnd(basepaths); ++bpit) { + std::string headerName; + if (this->FindHeader(headerName, *bpit)) { // Moc headers - if (!this->MocSkipTest(absFilename) && !this->MocSkipTest(headerName)) { - absHeadersMoc.insert(headerName); + if (!this->MocSkip(absFilename) && !this->MocSkip(headerName)) { + mocHeaderFiles.insert(headerName); } // Uic headers - if (!this->UicSkipTest(absFilename) && !this->UicSkipTest(headerName)) { - absHeadersUic.insert(headerName); + if (!this->UicSkip(absFilename) && !this->UicSkip(headerName)) { + uicHeaderFiles.insert(headerName); } break; } } } -void cmQtAutoGenerators::ParseHeaders( - const std::set<std::string>& absHeadersMoc, - const std::set<std::string>& absHeadersUic, - const std::map<std::string, std::string>& includedMocs, - std::map<std::string, std::string>& notIncludedMocs, - std::map<std::string, std::vector<std::string> >& includedUis) +bool cmQtAutoGenerators::ParseHeaders( + const std::set<std::string>& mocHeaderFiles, + const std::set<std::string>& uicHeaderFiles, + const std::map<std::string, std::string>& mocsIncluded, + std::map<std::string, std::string>& mocsNotIncluded, + std::map<std::string, std::set<std::string> >& mocDepends, + std::map<std::string, std::vector<std::string> >& uisIncluded) { + bool success = true; // Merged header files list to read files only once std::set<std::string> headerFiles; - headerFiles.insert(absHeadersMoc.begin(), absHeadersMoc.end()); - headerFiles.insert(absHeadersUic.begin(), absHeadersUic.end()); + headerFiles.insert(mocHeaderFiles.begin(), mocHeaderFiles.end()); + headerFiles.insert(uicHeaderFiles.begin(), uicHeaderFiles.end()); for (std::set<std::string>::const_iterator hIt = headerFiles.begin(); hIt != headerFiles.end(); ++hIt) { const std::string& headerName = *hIt; - const std::string contents = ReadAll(headerName); - - // Parse header content for MOC - if ((absHeadersMoc.find(headerName) != absHeadersMoc.end()) && - (includedMocs.find(headerName) == includedMocs.end())) { - // Process - if (this->Verbose) { - std::ostringstream err; - err << "AutoMoc: Checking " << headerName << "\n"; - this->LogInfo(err.str()); + std::string contentText; + if (ReadAll(contentText, headerName)) { + // Parse header content for MOC + if ((mocHeaderFiles.find(headerName) != mocHeaderFiles.end()) && + (mocsIncluded.find(headerName) == mocsIncluded.end())) { + this->MocParseHeaderContent(headerName, contentText, mocsNotIncluded, + mocDepends); } - std::string macroName; - if (this->MocRequired(contents, macroName)) { - notIncludedMocs[headerName] = fpathCheckSum.getPart(headerName) + - "/moc_" + - cmsys::SystemTools::GetFilenameWithoutLastExtension(headerName) + - ".cpp"; + // Parse header content for UIC + if (uicHeaderFiles.find(headerName) != uicHeaderFiles.end()) { + this->UicParseContent(headerName, contentText, uisIncluded); } - } - - // Parse header content for UIC - if (absHeadersUic.find(headerName) != absHeadersUic.end()) { - this->ParseContentForUic(headerName, contents, includedUis); + } else { + std::ostringstream ost; + ost << "AutoGen: Error: Could not read header file:\n" + << Quoted(headerName); + this->LogError(ost.str()); + success = false; + break; } } + return success; } bool cmQtAutoGenerators::MocGenerateAll( - const std::map<std::string, std::string>& includedMocs, - const std::map<std::string, std::string>& notIncludedMocs) + const std::map<std::string, std::string>& mocsIncluded, + const std::map<std::string, std::string>& mocsNotIncluded, + const std::map<std::string, std::set<std::string> >& mocDepends) { - if (this->MocExecutable.empty()) { + if (!this->MocEnabled()) { return true; } + bool mocCompFileGenerated = false; + bool mocCompChanged = false; + // look for name collisions { std::multimap<std::string, std::string> collisions; // Test merged map of included and notIncluded - std::map<std::string, std::string> mergedMocs(includedMocs); - mergedMocs.insert(notIncludedMocs.begin(), notIncludedMocs.end()); + std::map<std::string, std::string> mergedMocs(mocsIncluded); + mergedMocs.insert(mocsNotIncluded.begin(), mocsNotIncluded.end()); if (this->NameCollisionTest(mergedMocs, collisions)) { - std::ostringstream err; - err << "AutoMoc: Error: " + std::ostringstream ost; + ost << "AutoMoc: Error: " "The same moc file will be generated " - "from different sources." - << std::endl - << "To avoid this error either" << std::endl - << "- rename the source files or" << std::endl - << "- do not include the (moc_NAME.cpp|NAME.moc) file" << std::endl; - this->LogErrorNameCollision(err.str(), collisions); + "from different sources.\n" + "To avoid this error either\n" + "- rename the source files or\n" + "- do not include the (moc_NAME.cpp|NAME.moc) file"; + this->LogErrorNameCollision(ost.str(), collisions); return false; } } - - // generate moc files that are included by source files. + // Generate moc files that are included by source files. { - const std::string subDirPrefix = "include/"; + const std::string subDir = "include/"; for (std::map<std::string, std::string>::const_iterator it = - includedMocs.begin(); - it != includedMocs.end(); ++it) { - if (!this->MocGenerateFile(it->first, it->second, subDirPrefix)) { + mocsIncluded.begin(); + it != mocsIncluded.end(); ++it) { + if (!this->MocGenerateFile(it->first, it->second, subDir, mocDepends)) { if (this->RunMocFailed) { return false; } } } } - - // generate moc files that are _not_ included by source files. - bool automocCppChanged = false; + // Generate moc files that are _not_ included by source files. { - const std::string subDirPrefix; + const std::string subDir; for (std::map<std::string, std::string>::const_iterator it = - notIncludedMocs.begin(); - it != notIncludedMocs.end(); ++it) { - if (this->MocGenerateFile(it->first, it->second, subDirPrefix)) { - automocCppChanged = true; + mocsNotIncluded.begin(); + it != mocsNotIncluded.end(); ++it) { + if (this->MocGenerateFile(it->first, it->second, subDir, mocDepends)) { + mocCompFileGenerated = true; } else { if (this->RunMocFailed) { return false; @@ -1129,183 +1195,238 @@ bool cmQtAutoGenerators::MocGenerateAll( // Compose moc_compilation.cpp content std::string automocSource; { - std::ostringstream outStream; - outStream << "/* This file is autogenerated, do not edit*/\n"; - if (notIncludedMocs.empty()) { + std::ostringstream ost; + ost << "/* This file is autogenerated, do not edit*/\n"; + if (mocsNotIncluded.empty()) { // Dummy content - outStream << "enum some_compilers { need_more_than_nothing };\n"; + ost << "enum some_compilers { need_more_than_nothing };\n"; } else { // Valid content for (std::map<std::string, std::string>::const_iterator it = - notIncludedMocs.begin(); - it != notIncludedMocs.end(); ++it) { - outStream << "#include \"" << it->second << "\"\n"; - } - } - outStream.flush(); - automocSource = outStream.str(); - } - - // Check if we even need to update moc_compilation.cpp - if (!automocCppChanged) { - // compare contents of the moc_compilation.cpp file - const std::string oldContents = ReadAll(this->OutMocCppFilenameAbs); - if (oldContents == automocSource) { - // nothing changed: don't touch the moc_compilation.cpp file - if (this->Verbose) { - std::ostringstream err; - err << "AutoMoc: " << this->OutMocCppFilenameRel << " still up to date" - << std::endl; - this->LogInfo(err.str()); + mocsNotIncluded.begin(); + it != mocsNotIncluded.end(); ++it) { + ost << "#include \"" << it->second << "\"\n"; } - return true; } + automocSource = ost.str(); } - // Actually write moc_compilation.cpp + // Check if the content of moc_compilation.cpp changed { - std::string msg = "Generating MOC compilation "; - msg += this->OutMocCppFilenameRel; - this->LogBold(msg); - } - // Make sure the parent directory exists - bool success = this->MakeParentDirectory(this->OutMocCppFilenameAbs); - if (success) { - cmsys::ofstream outfile; - outfile.open(this->OutMocCppFilenameAbs.c_str(), std::ios::trunc); - if (!outfile) { - success = false; - std::ostringstream err; - err << "AutoMoc: error opening " << this->OutMocCppFilenameAbs << "\n"; - this->LogError(err.str()); + std::string oldContents; + if (ReadAll(oldContents, this->MocCppFilenameAbs)) { + mocCompChanged = (oldContents != automocSource); } else { - outfile << automocSource; - // Check for write errors - if (!outfile.good()) { + mocCompChanged = true; + } + } + + bool success = true; + if (mocCompChanged) { + // Actually write moc_compilation.cpp + this->LogBold("Generating MOC compilation " + this->MocCppFilenameRel); + + // Make sure the parent directory exists + success = this->MakeParentDirectory(this->MocCppFilenameAbs); + if (success) { + cmsys::ofstream outfile; + outfile.open(this->MocCppFilenameAbs.c_str(), std::ios::trunc); + if (!outfile) { success = false; - std::ostringstream err; - err << "AutoMoc: error writing " << this->OutMocCppFilenameAbs << "\n"; - this->LogError(err.str()); + this->LogError("AutoMoc: Error opening " + this->MocCppFilenameAbs); + } else { + outfile << automocSource; + // Check for write errors + if (!outfile.good()) { + success = false; + this->LogError("AutoMoc: Error writing " + this->MocCppFilenameAbs); + } } } + } else if (mocCompFileGenerated) { + // Only touch moc_compilation.cpp + if (this->Verbose) { + this->LogInfo("Touching MOC compilation " + this->MocCppFilenameRel); + } + cmSystemTools::Touch(this->MocCppFilenameAbs, false); } + return success; } /** * @return True if a moc file was created. False may indicate an error. */ -bool cmQtAutoGenerators::MocGenerateFile(const std::string& sourceFile, - const std::string& mocFileName, - const std::string& subDirPrefix) +bool cmQtAutoGenerators::MocGenerateFile( + const std::string& sourceFile, const std::string& mocFileName, + const std::string& subDir, + const std::map<std::string, std::set<std::string> >& mocDepends) { + bool mocGenerated = false; + bool generateMoc = this->GenerateAllMoc; + const std::string mocFileRel = - this->AutogenBuildSubDir + subDirPrefix + mocFileName; + this->AutogenBuildSubDir + subDir + mocFileName; const std::string mocFileAbs = this->CurrentBinaryDir + mocFileRel; - bool generateMoc = this->GenerateMocAll; - // Test if the source file is newer that the build file if (!generateMoc) { + // Test if the source file is newer that the build file generateMoc = FileAbsentOrOlder(mocFileAbs, sourceFile); + if (!generateMoc) { + // Test if a dependency file changed + std::map<std::string, std::set<std::string> >::const_iterator dit = + mocDepends.find(sourceFile); + if (dit != mocDepends.end()) { + for (std::set<std::string>::const_iterator fit = dit->second.begin(); + fit != dit->second.end(); ++fit) { + if (FileAbsentOrOlder(mocFileAbs, *fit)) { + generateMoc = true; + break; + } + } + } + } } if (generateMoc) { // Log this->LogBold("Generating MOC source " + mocFileRel); // Make sure the parent directory exists - if (!this->MakeParentDirectory(mocFileAbs)) { - this->RunMocFailed = true; - return false; - } - - std::vector<std::string> command; - command.push_back(this->MocExecutable); - command.insert(command.end(), this->MocIncludes.begin(), - this->MocIncludes.end()); - command.insert(command.end(), this->MocDefinitions.begin(), - this->MocDefinitions.end()); - command.insert(command.end(), this->MocOptions.begin(), - this->MocOptions.end()); + if (this->MakeParentDirectory(mocFileAbs)) { + // Compose moc command + std::vector<std::string> cmd; + cmd.push_back(this->MocExecutable); + cmd.insert(cmd.end(), this->MocIncludes.begin(), + this->MocIncludes.end()); + // Add definitions + for (std::vector<std::string>::const_iterator it = + this->MocDefinitions.begin(); + it != this->MocDefinitions.end(); ++it) { + cmd.push_back("-D" + (*it)); + } + cmd.insert(cmd.end(), this->MocOptions.begin(), this->MocOptions.end()); #ifdef _WIN32 - command.push_back("-DWIN32"); + cmd.push_back("-DWIN32"); #endif - command.push_back("-o"); - command.push_back(mocFileAbs); - command.push_back(sourceFile); - - if (this->Verbose) { - this->LogCommand(command); + cmd.push_back("-o"); + cmd.push_back(mocFileAbs); + cmd.push_back(sourceFile); + + // Execute moc command + std::string output; + if (this->RunCommand(cmd, output)) { + // Success + mocGenerated = true; + } else { + // Command failed + { + std::ostringstream ost; + ost << "AutoMoc: Error: moc process failed for\n"; + ost << Quoted(mocFileRel) << "\n"; + ost << "AutoMoc: Command:\n" << cmJoin(cmd, " ") << "\n"; + ost << "AutoMoc: Command output:\n" << output << "\n"; + this->LogError(ost.str()); + } + cmSystemTools::RemoveFile(mocFileAbs); + this->RunMocFailed = true; + } + } else { + // Parent directory creation failed + this->RunMocFailed = true; } + } + return mocGenerated; +} - std::string output; - int retVal = 0; - bool result = - cmSystemTools::RunSingleCommand(command, &output, &output, &retVal); - if (!result || retVal) { - { - std::ostringstream err; - err << "AutoMoc: Error: moc process for " << mocFileRel << " failed:\n" - << output << std::endl; - this->LogError(err.str()); +bool cmQtAutoGenerators::UicFindIncludedFile(std::string& absFile, + const std::string& sourceFile, + const std::string& includeString) +{ + bool success = false; + // Search in vicinity of the source + { + std::string testPath = subDirPrefix(sourceFile); + testPath += includeString; + if (cmsys::SystemTools::FileExists(testPath.c_str())) { + absFile = cmsys::SystemTools::GetRealPath(testPath); + success = true; + } + } + // Search in include directories + if (!success) { + for (std::vector<std::string>::const_iterator iit = + this->UicSearchPaths.begin(); + iit != this->UicSearchPaths.end(); ++iit) { + const std::string fullPath = ((*iit) + '/' + includeString); + if (cmsys::SystemTools::FileExists(fullPath.c_str())) { + absFile = cmsys::SystemTools::GetRealPath(fullPath); + success = true; + break; } - cmSystemTools::RemoveFile(mocFileAbs); - this->RunMocFailed = true; - return false; } - return true; } - return false; + return success; } bool cmQtAutoGenerators::UicGenerateAll( - const std::map<std::string, std::vector<std::string> >& includedUis) + const std::map<std::string, std::vector<std::string> >& uisIncluded) { - if (this->UicExecutable.empty()) { + if (!this->UicEnabled()) { return true; } // single map with input / output names - std::map<std::string, std::map<std::string, std::string> > uiGenMap; - std::map<std::string, std::string> testMap; - for (std::map<std::string, std::vector<std::string> >::const_iterator it = - includedUis.begin(); - it != includedUis.end(); ++it) { - // source file path - std::string sourcePath = cmsys::SystemTools::GetFilenamePath(it->first); - sourcePath += '/'; - // insert new map for source file an use new reference - uiGenMap[it->first] = std::map<std::string, std::string>(); - std::map<std::string, std::string>& sourceMap = uiGenMap[it->first]; - for (std::vector<std::string>::const_iterator sit = it->second.begin(); - sit != it->second.end(); ++sit) { - const std::string& uiFileName = *sit; - const std::string uiInputFile = sourcePath + uiFileName + ".ui"; - const std::string uiOutputFile = "ui_" + uiFileName + ".h"; - sourceMap[uiInputFile] = uiOutputFile; - testMap[uiInputFile] = uiOutputFile; - } - } - - // look for name collisions + std::map<std::string, std::map<std::string, std::string> > sourceGenMap; { - std::multimap<std::string, std::string> collisions; - if (this->NameCollisionTest(testMap, collisions)) { - std::ostringstream err; - err << "AutoUic: Error: The same ui_NAME.h file will be generated " - "from different sources." - << std::endl - << "To avoid this error rename the source files." << std::endl; - this->LogErrorNameCollision(err.str(), collisions); - return false; + // Collision lookup map + std::map<std::string, std::string> testMap; + // Compile maps + for (std::map<std::string, std::vector<std::string> >::const_iterator sit = + uisIncluded.begin(); + sit != uisIncluded.end(); ++sit) { + const std::string& source(sit->first); + const std::vector<std::string>& sourceIncs(sit->second); + // insert new source/destination map + std::map<std::string, std::string>& uiGenMap = sourceGenMap[source]; + for (std::vector<std::string>::const_iterator uit = sourceIncs.begin(); + uit != sourceIncs.end(); ++uit) { + // Remove ui_ from the begin filename by substr() + const std::string uiBasePath = subDirPrefix(*uit); + const std::string uiBaseName = + cmsys::SystemTools::GetFilenameWithoutLastExtension(*uit).substr(3); + const std::string searchFileName = uiBasePath + uiBaseName + ".ui"; + std::string uiInputFile; + if (UicFindIncludedFile(uiInputFile, source, searchFileName)) { + std::string uiOutputFile = uiBasePath + "ui_" + uiBaseName + ".h"; + cmSystemTools::ReplaceString(uiOutputFile, "..", "__"); + uiGenMap[uiInputFile] = uiOutputFile; + testMap[uiInputFile] = uiOutputFile; + } else { + this->LogError("AutoUic: Error: " + Quoted(sit->first) + + "\nCould not find " + Quoted(searchFileName)); + return false; + } + } + } + // look for name collisions + { + std::multimap<std::string, std::string> collisions; + if (this->NameCollisionTest(testMap, collisions)) { + std::ostringstream ost; + ost << "AutoUic: Error: The same ui_NAME.h file will be generated " + "from different sources.\n" + "To avoid this error rename the source files.\n"; + this->LogErrorNameCollision(ost.str(), collisions); + return false; + } } } - testMap.clear(); // generate ui files for (std::map<std::string, std::map<std::string, std::string> >::const_iterator it = - uiGenMap.begin(); - it != uiGenMap.end(); ++it) { + sourceGenMap.begin(); + it != sourceGenMap.end(); ++it) { for (std::map<std::string, std::string>::const_iterator sit = it->second.begin(); sit != it->second.end(); ++sit) { @@ -1327,13 +1448,15 @@ bool cmQtAutoGenerators::UicGenerateFile(const std::string& realName, const std::string& uiInputFile, const std::string& uiOutputFile) { + bool uicGenerated = false; + bool generateUic = this->GenerateAllUic; + const std::string uicFileRel = this->AutogenBuildSubDir + "include/" + uiOutputFile; const std::string uicFileAbs = this->CurrentBinaryDir + uicFileRel; - bool generateUic = this->GenerateUicAll; - // Test if the source file is newer that the build file if (!generateUic) { + // Test if the source file is newer that the build file generateUic = FileAbsentOrOlder(uicFileAbs, uiInputFile); } if (generateUic) { @@ -1341,55 +1464,54 @@ bool cmQtAutoGenerators::UicGenerateFile(const std::string& realName, this->LogBold("Generating UIC header " + uicFileRel); // Make sure the parent directory exists - if (!this->MakeParentDirectory(uicFileAbs)) { - this->RunUicFailed = true; - return false; - } - - std::vector<std::string> command; - command.push_back(this->UicExecutable); - - std::vector<std::string> opts = this->UicTargetOptions; - std::map<std::string, std::string>::const_iterator optionIt = - this->UicOptions.find(uiInputFile); - if (optionIt != this->UicOptions.end()) { - std::vector<std::string> fileOpts; - cmSystemTools::ExpandListArgument(optionIt->second, fileOpts); - UicMergeOptions(opts, fileOpts, this->QtMajorVersion == "5"); - } - command.insert(command.end(), opts.begin(), opts.end()); - - command.push_back("-o"); - command.push_back(uicFileAbs); - command.push_back(uiInputFile); - - if (this->Verbose) { - this->LogCommand(command); - } - std::string output; - int retVal = 0; - bool result = - cmSystemTools::RunSingleCommand(command, &output, &output, &retVal); - if (!result || retVal) { + if (this->MakeParentDirectory(uicFileAbs)) { + // Compose uic command + std::vector<std::string> cmd; + cmd.push_back(this->UicExecutable); { - std::ostringstream err; - err << "AutoUic: Error: uic process for " << uicFileRel - << " needed by\n \"" << realName << "\"\nfailed:\n" - << output << std::endl; - this->LogError(err.str()); + std::vector<std::string> allOpts = this->UicTargetOptions; + std::map<std::string, std::string>::const_iterator optionIt = + this->UicOptions.find(uiInputFile); + if (optionIt != this->UicOptions.end()) { + std::vector<std::string> fileOpts; + cmSystemTools::ExpandListArgument(optionIt->second, fileOpts); + UicMergeOptions(allOpts, fileOpts, (this->QtMajorVersion == "5")); + } + cmd.insert(cmd.end(), allOpts.begin(), allOpts.end()); } - cmSystemTools::RemoveFile(uicFileAbs); + cmd.push_back("-o"); + cmd.push_back(uicFileAbs); + cmd.push_back(uiInputFile); + + std::string output; + if (this->RunCommand(cmd, output)) { + // Success + uicGenerated = true; + } else { + // Command failed + { + std::ostringstream ost; + ost << "AutoUic: Error: uic process failed for\n"; + ost << Quoted(uicFileRel) << " needed by\n"; + ost << Quoted(realName) << "\n"; + ost << "AutoUic: Command:\n" << cmJoin(cmd, " ") << "\n"; + ost << "AutoUic: Command output:\n" << output << "\n"; + this->LogError(ost.str()); + } + cmSystemTools::RemoveFile(uicFileAbs); + this->RunUicFailed = true; + } + } else { + // Parent directory creation failed this->RunUicFailed = true; - return false; } - return true; } - return false; + return uicGenerated; } -bool cmQtAutoGenerators::QrcGenerateAll() +bool cmQtAutoGenerators::RccGenerateAll() { - if (this->RccExecutable.empty()) { + if (!this->RccEnabled()) { return true; } @@ -1399,9 +1521,8 @@ bool cmQtAutoGenerators::QrcGenerateAll() si != this->RccSources.end(); ++si) { const std::string ext = cmsys::SystemTools::GetFilenameLastExtension(*si); if (ext == ".qrc") { - qrcGenMap[*si] = this->AutogenBuildSubDir + fpathCheckSum.getPart(*si) + - "/qrc_" + cmsys::SystemTools::GetFilenameWithoutLastExtension(*si) + - ".cpp"; + qrcGenMap[*si] = + this->AutogenBuildSubDir + this->ChecksumedPath(*si, "qrc_", ".cpp"); } } @@ -1409,12 +1530,11 @@ bool cmQtAutoGenerators::QrcGenerateAll() { std::multimap<std::string, std::string> collisions; if (this->NameCollisionTest(qrcGenMap, collisions)) { - std::ostringstream err; - err << "AutoRcc: Error: The same qrc_NAME.cpp file" - " will be generated from different sources." - << std::endl - << "To avoid this error rename the source .qrc files." << std::endl; - this->LogErrorNameCollision(err.str(), collisions); + std::ostringstream ost; + ost << "AutoRcc: Error: The same qrc_NAME.cpp file" + " will be generated from different sources.\n" + "To avoid this error rename the source .qrc files.\n"; + this->LogErrorNameCollision(ost.str(), collisions); return false; } } @@ -1424,7 +1544,7 @@ bool cmQtAutoGenerators::QrcGenerateAll() qrcGenMap.begin(); si != qrcGenMap.end(); ++si) { bool unique = FileNameIsUnique(si->first, qrcGenMap); - if (!this->QrcGenerateFile(si->first, si->second, unique)) { + if (!this->RccGenerateFile(si->first, si->second, unique)) { if (this->RunRccFailed) { return false; } @@ -1436,146 +1556,185 @@ bool cmQtAutoGenerators::QrcGenerateAll() /** * @return True if a rcc file was created. False may indicate an error. */ -bool cmQtAutoGenerators::QrcGenerateFile(const std::string& qrcInputFile, - const std::string& qrcOutputFile, +bool cmQtAutoGenerators::RccGenerateFile(const std::string& rccInputFile, + const std::string& rccOutputFile, bool unique_n) { - std::string symbolName = - cmsys::SystemTools::GetFilenameWithoutLastExtension(qrcInputFile); - if (!unique_n) { - symbolName += "_"; - symbolName += fpathCheckSum.getPart(qrcInputFile); - } - // Replace '-' with '_'. The former is valid for - // file names but not for symbol names. - std::replace(symbolName.begin(), symbolName.end(), '-', '_'); - - const std::string qrcBuildFile = this->CurrentBinaryDir + qrcOutputFile; - - bool generateQrc = this->GenerateRccAll; - // Test if the resources list file is newer than build file - if (!generateQrc) { - generateQrc = FileAbsentOrOlder(qrcBuildFile, qrcInputFile); - } - // Test if any resource file is newer than the build file - if (!generateQrc) { - const std::vector<std::string>& files = this->RccInputs[qrcInputFile]; - for (std::vector<std::string>::const_iterator it = files.begin(); - it != files.end(); ++it) { - if (FileAbsentOrOlder(qrcBuildFile, *it)) { - generateQrc = true; - break; + bool rccGenerated = false; + bool generateRcc = this->GenerateAllRcc; + + const std::string rccBuildFile = this->CurrentBinaryDir + rccOutputFile; + + if (!generateRcc) { + // Test if the resources list file is newer than build file + generateRcc = FileAbsentOrOlder(rccBuildFile, rccInputFile); + if (!generateRcc) { + // Acquire input file list + std::vector<std::string> readFiles; + const std::vector<std::string>* files = &this->RccInputs[rccInputFile]; + if (files->empty()) { + // Read input file list from qrc file + std::string error; + if (cmQtAutoGeneratorCommon::RccListInputs( + this->QtMajorVersion, this->RccExecutable, rccInputFile, + readFiles, &error)) { + files = &readFiles; + } else { + files = CM_NULLPTR; + this->LogError(error); + this->RunRccFailed = true; + } + } + // Test if any input file is newer than the build file + if (files != CM_NULLPTR) { + for (std::vector<std::string>::const_iterator it = files->begin(); + it != files->end(); ++it) { + if (FileAbsentOrOlder(rccBuildFile, *it)) { + generateRcc = true; + break; + } + } } } } - if (generateQrc) { - { - std::string msg = "Generating RCC source "; - msg += qrcOutputFile; - this->LogBold(msg); - } + if (generateRcc) { + // Log + this->LogBold("Generating RCC source " + rccOutputFile); // Make sure the parent directory exists - if (!this->MakeParentDirectory(qrcOutputFile)) { - this->RunRccFailed = true; - return false; - } - - std::vector<std::string> command; - command.push_back(this->RccExecutable); - { - std::map<std::string, std::string>::const_iterator optionIt = - this->RccOptions.find(qrcInputFile); - if (optionIt != this->RccOptions.end()) { - cmSystemTools::ExpandListArgument(optionIt->second, command); + if (this->MakeParentDirectory(rccBuildFile)) { + // Compose symbol name + std::string symbolName = + cmsys::SystemTools::GetFilenameWithoutLastExtension(rccInputFile); + if (!unique_n) { + symbolName += "_"; + symbolName += fpathCheckSum.getPart(rccInputFile); } - } - command.push_back("-name"); - command.push_back(symbolName); - command.push_back("-o"); - command.push_back(qrcBuildFile); - command.push_back(qrcInputFile); + // Replace '-' with '_'. The former is valid for + // file names but not for symbol names. + std::replace(symbolName.begin(), symbolName.end(), '-', '_'); - if (this->Verbose) { - this->LogCommand(command); - } - std::string output; - int retVal = 0; - bool result = - cmSystemTools::RunSingleCommand(command, &output, &output, &retVal); - if (!result || retVal) { + // Compose rcc command + std::vector<std::string> cmd; + cmd.push_back(this->RccExecutable); { - std::ostringstream err; - err << "AutoRcc: Error: rcc process for " << qrcOutputFile - << " failed:\n" - << output << std::endl; - this->LogError(err.str()); + std::map<std::string, std::string>::const_iterator optionIt = + this->RccOptions.find(rccInputFile); + if (optionIt != this->RccOptions.end()) { + cmSystemTools::ExpandListArgument(optionIt->second, cmd); + } + } + cmd.push_back("-name"); + cmd.push_back(symbolName); + cmd.push_back("-o"); + cmd.push_back(rccBuildFile); + cmd.push_back(rccInputFile); + + std::string output; + if (this->RunCommand(cmd, output)) { + // Success + rccGenerated = true; + } else { + // Command failed + { + std::ostringstream ost; + ost << "AutoRcc: Error: rcc process failed for\n"; + ost << Quoted(rccOutputFile) << "\n"; + ost << "AutoRcc: Command:\n" << cmJoin(cmd, " ") << "\n"; + ost << "AutoRcc: Command output:\n" << output << "\n"; + this->LogError(ost.str()); + } + cmSystemTools::RemoveFile(rccBuildFile); + this->RunRccFailed = true; } - cmSystemTools::RemoveFile(qrcBuildFile); + } else { + // Parent directory creation failed this->RunRccFailed = true; - return false; } - return true; } - return false; + return rccGenerated; } void cmQtAutoGenerators::LogErrorNameCollision( const std::string& message, - const std::multimap<std::string, std::string>& collisions) + const std::multimap<std::string, std::string>& collisions) const { typedef std::multimap<std::string, std::string>::const_iterator Iter; - std::ostringstream err; + std::ostringstream ost; // Add message - err << message; + if (!message.empty()) { + ost << message; + if (message[message.size() - 1] != '\n') { + ost << '\n'; + } + } // Append collision list for (Iter it = collisions.begin(); it != collisions.end(); ++it) { - err << it->first << " : " << it->second << std::endl; + ost << it->first << " : " << it->second << '\n'; } - this->LogError(err.str()); + this->LogError(ost.str()); } -void cmQtAutoGenerators::LogBold(const std::string& message) +void cmQtAutoGenerators::LogBold(const std::string& message) const { cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue | cmsysTerminal_Color_ForegroundBold, message.c_str(), true, this->ColorOutput); } -void cmQtAutoGenerators::LogInfo(const std::string& message) +void cmQtAutoGenerators::LogInfo(const std::string& message) const { - std::cout << message.c_str(); + std::string msg(message); + if (!msg.empty()) { + if (msg[msg.size() - 1] != '\n') { + msg.push_back('\n'); + } + cmSystemTools::Stdout(msg.c_str(), msg.size()); + } } -void cmQtAutoGenerators::LogWarning(const std::string& message) +void cmQtAutoGenerators::LogWarning(const std::string& message) const { - std::ostringstream ostr; - ostr << message << "\n"; - std::cout << message.c_str(); + std::string msg(message); + if (!msg.empty()) { + if (msg[msg.size() - 1] != '\n') { + msg.push_back('\n'); + } + // Append empty line + msg.push_back('\n'); + cmSystemTools::Stdout(msg.c_str(), msg.size()); + } } -void cmQtAutoGenerators::LogError(const std::string& message) +void cmQtAutoGenerators::LogError(const std::string& message) const { - std::ostringstream ostr; - ostr << message << "\n\n"; - std::cerr << ostr.str(); + std::string msg(message); + if (!msg.empty()) { + if (msg[msg.size() - 1] != '\n') { + msg.push_back('\n'); + } + // Append empty line + msg.push_back('\n'); + cmSystemTools::Stderr(msg.c_str(), msg.size()); + } } -void cmQtAutoGenerators::LogCommand(const std::vector<std::string>& command) +void cmQtAutoGenerators::LogCommand( + const std::vector<std::string>& command) const { - std::ostringstream sbuf; - for (std::vector<std::string>::const_iterator cmdIt = command.begin(); - cmdIt != command.end(); ++cmdIt) { - if (cmdIt != command.begin()) { - sbuf << " "; + std::vector<std::string> cmdEscaped; + typedef std::vector<std::string>::const_iterator Iter; + for (Iter cit = command.begin(); cit != command.end(); ++cit) { + const std::string cesc = Quoted(*cit); + if ((cesc.size() > (cit->size() + 2)) || + (cesc.find(' ') != std::string::npos)) { + cmdEscaped.push_back(cesc); + } else { + cmdEscaped.push_back(*cit); } - sbuf << *cmdIt; - } - if (!sbuf.str().empty()) { - sbuf << std::endl; - this->LogInfo(sbuf.str()); } + this->LogInfo(cmJoin(cmdEscaped, " ")); } /** @@ -1584,7 +1743,7 @@ void cmQtAutoGenerators::LogCommand(const std::vector<std::string>& command) */ bool cmQtAutoGenerators::NameCollisionTest( const std::map<std::string, std::string>& genFiles, - std::multimap<std::string, std::string>& collisions) + std::multimap<std::string, std::string>& collisions) const { typedef std::map<std::string, std::string>::const_iterator Iter; typedef std::map<std::string, std::string>::value_type VType; @@ -1609,19 +1768,126 @@ bool cmQtAutoGenerators::NameCollisionTest( } /** + * @brief Generates a file path based on the checksum of the source file path + * @return The path + */ +std::string cmQtAutoGenerators::ChecksumedPath(const std::string& sourceFile, + const char* basePrefix, + const char* baseSuffix) const +{ + std::string res = fpathCheckSum.getPart(sourceFile); + res += "/"; + res += basePrefix; + res += cmsys::SystemTools::GetFilenameWithoutLastExtension(sourceFile); + res += baseSuffix; + return res; +} + +/** * @brief Generates the parent directory of the given file on demand * @return True on success */ -bool cmQtAutoGenerators::MakeParentDirectory(const std::string& filename) +bool cmQtAutoGenerators::MakeParentDirectory(const std::string& filename) const { bool success = true; const std::string dirName = cmSystemTools::GetFilenamePath(filename); if (!dirName.empty()) { success = cmsys::SystemTools::MakeDirectory(dirName); if (!success) { - std::ostringstream err; - err << "AutoGen: Directory creation failed: " << dirName << std::endl; - this->LogError(err.str()); + this->LogError("AutoGen: Error: Directory creation failed: " + dirName); + } + } + return success; +} + +/** + * @brief Runs a command and returns true on success + * @return True on success + */ +bool cmQtAutoGenerators::RunCommand(const std::vector<std::string>& command, + std::string& output) const +{ + // Log command + if (this->Verbose) { + this->LogCommand(command); + } + // Execute command + int retVal = 0; + bool res = + cmSystemTools::RunSingleCommand(command, &output, &output, &retVal); + return (res && (retVal == 0)); +} + +/** + * @brief Tries to find the header file to the given file base path by + * appending different header extensions + * @return True on success + */ +bool cmQtAutoGenerators::FindHeader(std::string& header, + const std::string& testBasePath) const +{ + for (std::vector<std::string>::const_iterator ext = + this->HeaderExtensions.begin(); + ext != this->HeaderExtensions.end(); ++ext) { + std::string testFilePath(testBasePath); + testFilePath += '.'; + testFilePath += (*ext); + if (cmsys::SystemTools::FileExists(testFilePath.c_str())) { + header = testFilePath; + return true; + } + } + return false; +} + +std::string cmQtAutoGenerators::MocFindHeader( + const std::string& sourcePath, const std::string& includeBase) const +{ + std::string header; + // Search in vicinity of the source + if (!this->FindHeader(header, sourcePath + includeBase)) { + // Search in include directories + for (std::vector<std::string>::const_iterator iit = + this->MocIncludePaths.begin(); + iit != this->MocIncludePaths.end(); ++iit) { + const std::string fullPath = ((*iit) + '/' + includeBase); + if (FindHeader(header, fullPath)) { + break; + } + } + } + // Sanitize + if (!header.empty()) { + header = cmsys::SystemTools::GetRealPath(header); + } + return header; +} + +bool cmQtAutoGenerators::MocFindIncludedFile( + std::string& absFile, const std::string& sourcePath, + const std::string& includeString) const +{ + bool success = false; + // Search in vicinity of the source + { + std::string testPath = sourcePath; + testPath += includeString; + if (cmsys::SystemTools::FileExists(testPath.c_str())) { + absFile = cmsys::SystemTools::GetRealPath(testPath); + success = true; + } + } + // Search in include directories + if (!success) { + for (std::vector<std::string>::const_iterator iit = + this->MocIncludePaths.begin(); + iit != this->MocIncludePaths.end(); ++iit) { + const std::string fullPath = ((*iit) + '/' + includeString); + if (cmsys::SystemTools::FileExists(fullPath.c_str())) { + absFile = cmsys::SystemTools::GetRealPath(fullPath); + success = true; + break; + } } } return success; diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index 7891eb9..ee046de 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -7,10 +7,10 @@ #include <cmFilePathChecksum.h> #include <cmsys/RegularExpression.hxx> -#include <list> #include <map> #include <set> #include <string> +#include <utility> #include <vector> class cmMakefile; @@ -22,91 +22,135 @@ public: bool Run(const std::string& targetDirectory, const std::string& config); private: + // - Types + + /// @brief Used to extract additional dependencies from content text + struct MocDependFilter + { + std::string key; + cmsys::RegularExpression regExp; + }; + typedef std::pair<std::string, cmsys::RegularExpression> MacroFilter; + // - Configuration + bool MocDependFilterPush(const std::string& key, const std::string& regExp); bool ReadAutogenInfoFile(cmMakefile* makefile, const std::string& targetDirectory, const std::string& config); - std::string MocSettingsStringCompose(); - std::string UicSettingsStringCompose(); - std::string RccSettingsStringCompose(); - void OldSettingsReadFile(cmMakefile* makefile, - const std::string& targetDirectory); - bool OldSettingsWriteFile(const std::string& targetDirectory); + bool MocEnabled() const { return !this->MocExecutable.empty(); } + bool UicEnabled() const { return !this->UicExecutable.empty(); } + bool RccEnabled() const { return !this->RccExecutable.empty(); } + + // - Settings file + void SettingsFileRead(cmMakefile* makefile, + const std::string& targetDirectory); + bool SettingsFileWrite(const std::string& targetDirectory); + + bool GenerateAllAny() const + { + return (this->GenerateAllMoc || this->GenerateAllRcc || + this->GenerateAllUic); + } // - Init and run - void Init(); - bool RunAutogen(cmMakefile* makefile); + void Init(cmMakefile* makefile); + bool RunAutogen(); // - Content analysis - bool MocRequired(const std::string& text, std::string& macroName); - bool MocSkipTest(const std::string& absFilename); - bool UicSkipTest(const std::string& absFilename); + bool MocRequired(const std::string& contentText, + std::string* macroName = CM_NULLPTR); + void MocFindDepends( + const std::string& absFilename, const std::string& contentText, + std::map<std::string, std::set<std::string> >& mocDepends); + + bool MocSkip(const std::string& absFilename) const; + bool UicSkip(const std::string& absFilename) const; bool ParseSourceFile( const std::string& absFilename, - const std::vector<std::string>& headerExtensions, - std::map<std::string, std::string>& includedMocs, + std::map<std::string, std::string>& mocsIncluded, + std::map<std::string, std::set<std::string> >& mocDepends, std::map<std::string, std::vector<std::string> >& includedUis, bool relaxed); - void SearchHeadersForSourceFile( - const std::string& absFilename, - const std::vector<std::string>& headerExtensions, - std::set<std::string>& absHeadersMoc, - std::set<std::string>& absHeadersUic); - - void ParseHeaders( - const std::set<std::string>& absHeadersMoc, - const std::set<std::string>& absHeadersUic, - const std::map<std::string, std::string>& includedMocs, - std::map<std::string, std::string>& notIncludedMocs, + void SearchHeadersForSourceFile(const std::string& absFilename, + std::set<std::string>& mocHeaderFiles, + std::set<std::string>& uicHeaderFiles) const; + + bool ParseHeaders( + const std::set<std::string>& mocHeaderFiles, + const std::set<std::string>& uicHeaderFiles, + const std::map<std::string, std::string>& mocsIncluded, + std::map<std::string, std::string>& mocsNotIncluded, + std::map<std::string, std::set<std::string> >& mocDepends, std::map<std::string, std::vector<std::string> >& includedUis); - void ParseContentForUic( - const std::string& fileName, const std::string& contentsString, + void UicParseContent( + const std::string& fileName, const std::string& contentText, std::map<std::string, std::vector<std::string> >& includedUis); - bool ParseContentForMoc(const std::string& absFilename, - const std::string& contentsString, - const std::vector<std::string>& headerExtensions, - std::map<std::string, std::string>& includedMocs, - bool relaxed); + bool MocParseSourceContent( + const std::string& absFilename, const std::string& contentText, + std::map<std::string, std::string>& mocsIncluded, + std::map<std::string, std::set<std::string> >& mocDepends, bool relaxed); + + void MocParseHeaderContent( + const std::string& absFilename, const std::string& contentText, + std::map<std::string, std::string>& mocsNotIncluded, + std::map<std::string, std::set<std::string> >& mocDepends); // - Moc file generation bool MocGenerateAll( - const std::map<std::string, std::string>& includedMocs, - const std::map<std::string, std::string>& notIncludedMocs); - bool MocGenerateFile(const std::string& sourceFile, - const std::string& mocFileName, - const std::string& subDirPrefix); + const std::map<std::string, std::string>& mocsIncluded, + const std::map<std::string, std::string>& mocsNotIncluded, + const std::map<std::string, std::set<std::string> >& mocDepends); + bool MocGenerateFile( + const std::string& sourceFile, const std::string& mocFileName, + const std::string& subDir, + const std::map<std::string, std::set<std::string> >& mocDepends); // - Uic file generation + bool UicFindIncludedFile(std::string& absFile, const std::string& sourceFile, + const std::string& includeString); bool UicGenerateAll( const std::map<std::string, std::vector<std::string> >& includedUis); bool UicGenerateFile(const std::string& realName, const std::string& uiInputFile, const std::string& uiOutputFile); - // - Qrc file generation - bool QrcGenerateAll(); - bool QrcGenerateFile(const std::string& qrcInputFile, + // - Rcc file generation + bool RccGenerateAll(); + bool RccGenerateFile(const std::string& qrcInputFile, const std::string& qrcOutputFile, bool unique_n); // - Logging void LogErrorNameCollision( const std::string& message, - const std::multimap<std::string, std::string>& collisions); - void LogBold(const std::string& message); - void LogInfo(const std::string& message); - void LogWarning(const std::string& message); - void LogError(const std::string& message); - void LogCommand(const std::vector<std::string>& command); + const std::multimap<std::string, std::string>& collisions) const; + void LogBold(const std::string& message) const; + void LogInfo(const std::string& message) const; + void LogWarning(const std::string& message) const; + void LogError(const std::string& message) const; + void LogCommand(const std::vector<std::string>& command) const; // - Utility - bool NameCollisionTest(const std::map<std::string, std::string>& genFiles, - std::multimap<std::string, std::string>& collisions); - bool MakeParentDirectory(const std::string& filename); + bool NameCollisionTest( + const std::map<std::string, std::string>& genFiles, + std::multimap<std::string, std::string>& collisions) const; + std::string ChecksumedPath(const std::string& sourceFile, + const char* basePrefix, + const char* baseSuffix) const; + bool MakeParentDirectory(const std::string& filename) const; + bool RunCommand(const std::vector<std::string>& command, + std::string& output) const; + + bool FindHeader(std::string& header, const std::string& testBasePath) const; + + std::string MocFindHeader(const std::string& sourcePath, + const std::string& includeBase) const; + bool MocFindIncludedFile(std::string& absFile, const std::string& sourceFile, + const std::string& includeString) const; // - Target names std::string OriginTargetName; @@ -125,31 +169,32 @@ private: // - File lists std::vector<std::string> Sources; std::vector<std::string> Headers; + // - Settings + std::string SettingsStringMoc; + std::string SettingsStringUic; + std::string SettingsStringRcc; // - Moc - std::vector<std::string> SkipMoc; - std::string MocCompileDefinitionsStr; - std::string MocIncludesStr; - std::string MocOptionsStr; - std::string OutMocCppFilenameRel; - std::string OutMocCppFilenameAbs; - std::list<std::string> MocIncludes; - std::list<std::string> MocDefinitions; + std::string MocCppFilenameRel; + std::string MocCppFilenameAbs; + std::vector<std::string> MocSkipList; + std::vector<std::string> MocIncludePaths; + std::vector<std::string> MocIncludes; + std::vector<std::string> MocDefinitions; std::vector<std::string> MocOptions; - std::string MocSettingsString; + std::vector<MocDependFilter> MocDependFilters; // - Uic - std::vector<std::string> SkipUic; + std::vector<std::string> UicSkipList; std::vector<std::string> UicTargetOptions; std::map<std::string, std::string> UicOptions; - std::string UicSettingsString; + std::vector<std::string> UicSearchPaths; // - Rcc std::vector<std::string> RccSources; std::map<std::string, std::string> RccOptions; std::map<std::string, std::vector<std::string> > RccInputs; - std::string RccSettingsString; // - Utility cmFilePathChecksum fpathCheckSum; - cmsys::RegularExpression RegExpQObject; - cmsys::RegularExpression RegExpQGadget; + std::vector<std::string> HeaderExtensions; + MacroFilter MacroFilters[2]; cmsys::RegularExpression RegExpMocInclude; cmsys::RegularExpression RegExpUicInclude; // - Flags @@ -159,9 +204,9 @@ private: bool RunMocFailed; bool RunUicFailed; bool RunRccFailed; - bool GenerateMocAll; - bool GenerateUicAll; - bool GenerateRccAll; + bool GenerateAllMoc; + bool GenerateAllUic; + bool GenerateAllRcc; bool MocRelaxedMode; }; diff --git a/Source/cmServerConnection.h b/Source/cmServerConnection.h index 3efe28d..9357831 100644 --- a/Source/cmServerConnection.h +++ b/Source/cmServerConnection.h @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #pragma once +#include <cmConfigure.h> // IWYU pragma: keep + #include <string> #include <vector> diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 5555199..631f2a6 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -2,7 +2,9 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmSourceGroupCommand.h" +#include <set> #include <sstream> +#include <stddef.h> #include "cmMakefile.h" #include "cmSourceGroup.h" diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h deleted file mode 100644 index a2047af..0000000 --- a/Source/cmStandardIncludes.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -/** - * Include header files as a function of the build process, compiler, - * and operating system. - */ -#ifndef cmStandardIncludes_h -#define cmStandardIncludes_h - -#include <cmConfigure.h> - -// Provide fixed-size integer types. -#include <cm_kwiml.h> - -#include <fstream> -#include <iomanip> -#include <iostream> -#include <sstream> - -// we must have stl with the standard include style -#include <algorithm> -#include <functional> -#include <iterator> -#include <map> -#include <set> -#include <string> -#include <vector> - -// include the "c" string header -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#if defined(_MSC_VER) -typedef unsigned short mode_t; -#else -#include <sys/types.h> -#endif - -// use this class to shrink the size of symbols in .o files -// std::string is really basic_string<....lots of stuff....> -// when combined with a map or set, the symbols can be > 2000 chars! -#include <cmsys/String.hxx> -// typedef cmsys::String std::string; - -/* Poison this operator to avoid common mistakes. */ -extern void operator<<(std::ostream&, const std::ostringstream&); - -#include "cmCustomCommandLines.h" -#include "cmDocumentationEntry.h" -#include "cmTargetLinkLibraryType.h" - -#endif diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 18d5ea1..0f49731 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -20,6 +20,7 @@ cmState::cmState() : IsInTryCompile(false) + , IsGeneratorMultiConfig(false) , WindowsShell(false) , WindowsVSIDE(false) , WatcomWMake(false) @@ -364,6 +365,16 @@ void cmState::SetIsInTryCompile(bool b) this->IsInTryCompile = b; } +bool cmState::GetIsGeneratorMultiConfig() const +{ + return this->IsGeneratorMultiConfig; +} + +void cmState::SetIsGeneratorMultiConfig(bool b) +{ + this->IsGeneratorMultiConfig = b; +} + void cmState::RenameCommand(std::string const& oldName, std::string const& newName) { @@ -481,6 +492,9 @@ const char* cmState::GetGlobalProperty(const std::string& prop) } else if (prop == "IN_TRY_COMPILE") { this->SetGlobalProperty("IN_TRY_COMPILE", this->IsInTryCompile ? "1" : "0"); + } else if (prop == "GENERATOR_IS_MULTI_CONFIG") { + this->SetGlobalProperty("GENERATOR_IS_MULTI_CONFIG", + this->IsGeneratorMultiConfig ? "1" : "0"); } else if (prop == "ENABLED_LANGUAGES") { std::string langs; langs = cmJoin(this->EnabledLanguages, ";"); diff --git a/Source/cmState.h b/Source/cmState.h index 41ffcdc..5659023 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -116,6 +116,9 @@ public: bool GetIsInTryCompile() const; void SetIsInTryCompile(bool b); + bool GetIsGeneratorMultiConfig() const; + void SetIsGeneratorMultiConfig(bool b); + cmCommand* GetCommand(std::string const& name) const; void AddCommand(cmCommand* command); void RemoveUnscriptableCommands(); @@ -174,6 +177,7 @@ private: std::string SourceDirectory; std::string BinaryDirectory; bool IsInTryCompile; + bool IsGeneratorMultiConfig; bool WindowsShell; bool WindowsVSIDE; bool WatcomWMake; diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index c6288a5..d2c9d73 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -18,6 +18,10 @@ #include "cmVersion.h" #include "cmake.h" +#if !defined(_WIN32) +#include <sys/utsname.h> +#endif + #if defined(__CYGWIN__) #include "cmSystemTools.h" #endif @@ -298,9 +302,15 @@ void cmStateSnapshot::SetDefaultDefinitions() #if defined(_WIN32) this->SetDefinition("WIN32", "1"); this->SetDefinition("CMAKE_HOST_WIN32", "1"); + this->SetDefinition("CMAKE_HOST_SYSTEM_NAME", "Windows"); #else this->SetDefinition("UNIX", "1"); this->SetDefinition("CMAKE_HOST_UNIX", "1"); + + struct utsname uts_name; + if (uname(&uts_name) >= 0) { + this->SetDefinition("CMAKE_HOST_SYSTEM_NAME", uts_name.sysname); + } #endif #if defined(__CYGWIN__) std::string legacy; diff --git a/Source/cmStateTypes.h b/Source/cmStateTypes.h index 2c974c1..da14cdb 100644 --- a/Source/cmStateTypes.h +++ b/Source/cmStateTypes.h @@ -27,6 +27,9 @@ enum SnapshotType VariableScopeType }; +// There are multiple overlapping ranges represented here. Be aware that adding +// a value to this enumeration may cause failures in numerous places which +// assume details about the ordering. enum TargetType { EXECUTABLE, diff --git a/Source/cmSubdirDependsCommand.cxx b/Source/cmSubdirDependsCommand.cxx index 9259836..0bb2c0a 100644 --- a/Source/cmSubdirDependsCommand.cxx +++ b/Source/cmSubdirDependsCommand.cxx @@ -2,15 +2,10 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmSubdirDependsCommand.h" -#include "cmPolicies.h" - class cmExecutionStatus; bool cmSubdirDependsCommand::InitialPass(std::vector<std::string> const&, cmExecutionStatus&) { - this->Disallowed( - cmPolicies::CMP0029, - "The subdir_depends command should not be called; see CMP0029."); return true; } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 9efc13b..ee751f2 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -4,6 +4,7 @@ #include "cmAlgorithms.h" #include "cmProcessOutput.h" +#include "cm_sys_stat.h" #if defined(CMAKE_BUILD_WITH_CMAKE) #include "cmArchiveWrite.h" @@ -33,7 +34,6 @@ #include <cmsys/FStream.hxx> #include <cmsys/RegularExpression.hxx> #include <cmsys/System.h> -#include <cmsys/SystemTools.hxx> #include <cmsys/Terminal.h> #include <ctype.h> #include <errno.h> @@ -43,8 +43,8 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/stat.h> #include <time.h> +#include <utility> #if defined(_WIN32) #include <windows.h> @@ -1978,6 +1978,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0) // ??? } #endif + exe_dir = cmSystemTools::GetActualCaseForPath(exe_dir); cmSystemToolsCMakeCommand = exe_dir; cmSystemToolsCMakeCommand += "/cmake"; cmSystemToolsCMakeCommand += cmSystemTools::GetExecutableExtension(); @@ -2015,8 +2016,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0) // Install tree has // - "<prefix><CMAKE_BIN_DIR>/cmake" // - "<prefix><CMAKE_DATA_DIR>" - const std::string actual_case = cmSystemTools::GetActualCaseForPath(exe_dir); - if (cmHasSuffix(actual_case, CMAKE_BIN_DIR)) { + if (cmHasSuffix(exe_dir, CMAKE_BIN_DIR)) { std::string const prefix = exe_dir.substr(0, exe_dir.size() - strlen(CMAKE_BIN_DIR)); cmSystemToolsCMakeRoot = prefix + CMAKE_DATA_DIR; diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 10e8280..e93eaae 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -5,19 +5,13 @@ #include <cmConfigure.h> // IWYU pragma: keep +#include "cmsys/SystemTools.hxx" // IWYU pragma: export #include <cmProcessOutput.h> #include <cmsys/Process.h> -#include <cmsys/SystemTools.hxx> #include <stddef.h> #include <string> #include <vector> -#if defined(_MSC_VER) -typedef unsigned short mode_t; -#else -#include <sys/types.h> -#endif - class cmSystemToolsFileTime; /** \class cmSystemTools diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index fe3472d..e3c7b63 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -230,6 +230,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->SetPropertyDefault("INSTALL_NAME_DIR", CM_NULLPTR); this->SetPropertyDefault("INSTALL_RPATH", ""); this->SetPropertyDefault("INSTALL_RPATH_USE_LINK_PATH", "OFF"); + this->SetPropertyDefault("INTERPROCEDURAL_OPTIMIZATION", CM_NULLPTR); this->SetPropertyDefault("SKIP_BUILD_RPATH", "OFF"); this->SetPropertyDefault("BUILD_WITH_INSTALL_RPATH", "OFF"); this->SetPropertyDefault("ARCHIVE_OUTPUT_DIRECTORY", CM_NULLPTR); @@ -245,14 +246,17 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->SetPropertyDefault("AUTOMOC", CM_NULLPTR); this->SetPropertyDefault("AUTOUIC", CM_NULLPTR); this->SetPropertyDefault("AUTORCC", CM_NULLPTR); + this->SetPropertyDefault("AUTOMOC_DEPEND_FILTERS", CM_NULLPTR); this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", CM_NULLPTR); this->SetPropertyDefault("AUTOUIC_OPTIONS", CM_NULLPTR); + this->SetPropertyDefault("AUTOUIC_SEARCH_PATHS", CM_NULLPTR); this->SetPropertyDefault("AUTORCC_OPTIONS", CM_NULLPTR); this->SetPropertyDefault("LINK_DEPENDS_NO_SHARED", CM_NULLPTR); this->SetPropertyDefault("LINK_INTERFACE_LIBRARIES", CM_NULLPTR); this->SetPropertyDefault("WIN32_EXECUTABLE", CM_NULLPTR); this->SetPropertyDefault("MACOSX_BUNDLE", CM_NULLPTR); this->SetPropertyDefault("MACOSX_RPATH", CM_NULLPTR); + this->SetPropertyDefault("BUILD_WITH_INSTALL_NAME_DIR", CM_NULLPTR); this->SetPropertyDefault("C_CLANG_TIDY", CM_NULLPTR); this->SetPropertyDefault("C_COMPILER_LAUNCHER", CM_NULLPTR); this->SetPropertyDefault("C_CPPLINT", CM_NULLPTR); diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index 3e72d75..8ef0958 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -5,7 +5,6 @@ #include <cmsys/FStream.hxx> #include <cmsys/RegularExpression.hxx> -#include "cmPolicies.h" #include "cmSystemTools.h" class cmExecutionStatus; @@ -13,11 +12,6 @@ class cmExecutionStatus; bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& args, cmExecutionStatus&) { - if (this->Disallowed( - cmPolicies::CMP0030, - "The use_mangled_mesa command should not be called; see CMP0030.")) { - return true; - } // expected two arguments: // arguement one: the full path to gl_mangle.h // arguement two : directory for output of edited headers diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index 3b78abe..37d8bfb 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -5,7 +5,6 @@ #include <string.h> #include "cmMakefile.h" -#include "cmPolicies.h" #include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" @@ -16,11 +15,6 @@ class cmExecutionStatus; bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args, cmExecutionStatus&) { - if (this->Disallowed( - cmPolicies::CMP0034, - "The utility_source command should not be called; see CMP0034.")) { - return true; - } if (args.size() < 3) { this->SetError("called with incorrect number of arguments"); return false; diff --git a/Source/cmVS10CudaFlagTable.h b/Source/cmVS10CudaFlagTable.h new file mode 100644 index 0000000..da19d64 --- /dev/null +++ b/Source/cmVS10CudaFlagTable.h @@ -0,0 +1,51 @@ +static cmVS7FlagTable cmVS10CudaFlagTable[] = { + // Collect options meant for the host compiler. + { "AdditionalCompilerOptions", "Xcompiler=", "Host compiler options", "", + cmVS7FlagTable::UserValue | cmVS7FlagTable::SpaceAppendable }, + { "AdditionalCompilerOptions", "Xcompiler", "Host compiler options", "", + cmVS7FlagTable::UserFollowing | cmVS7FlagTable::SpaceAppendable }, + + // Select the CUDA runtime library. + { "CudaRuntime", "cudart=none", "No CUDA runtime library", "None", 0 }, + { "CudaRuntime", "cudart=shared", "Shared/dynamic CUDA runtime library", + "Shared", 0 }, + { "CudaRuntime", "cudart=static", "Static CUDA runtime library", "Static", + 0 }, + { "CudaRuntime", "cudart", "CUDA runtime library", "", + cmVS7FlagTable::UserFollowing }, + + // Capture arch/code arguments into temporaries for post-processing. + { "cmake-temp-gencode", "gencode=", "", "", + cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable }, + { "cmake-temp-gencode", "gencode", "", "", + cmVS7FlagTable::UserFollowing | cmVS7FlagTable::SemicolonAppendable }, + { "cmake-temp-gencode", "-generate-code=", "", "", + cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable }, + { "cmake-temp-gencode", "-generate-code", "", "", + cmVS7FlagTable::UserFollowing | cmVS7FlagTable::SemicolonAppendable }, + + { "cmake-temp-code", "code=", "", "", cmVS7FlagTable::UserValue }, + { "cmake-temp-code", "code", "", "", cmVS7FlagTable::UserFollowing }, + { "cmake-temp-code", "-gpu-code=", "", "", cmVS7FlagTable::UserValue }, + { "cmake-temp-code", "-gpu-code", "", "", cmVS7FlagTable::UserFollowing }, + + { "cmake-temp-arch", "arch=", "", "", cmVS7FlagTable::UserValue }, + { "cmake-temp-arch", "arch", "", "", cmVS7FlagTable::UserFollowing }, + { "cmake-temp-arch", "-gpu-architecture=", "", "", + cmVS7FlagTable::UserValue }, + { "cmake-temp-arch", "-gpu-architecture", "", "", + cmVS7FlagTable::UserFollowing }, + + // Other flags. + + { "FastMath", "use_fast_math", "", "true", 0 }, + { "FastMath", "-use_fast_math", "", "true", 0 }, + + { "GPUDebugInfo", "G", "", "true", 0 }, + { "GPUDebugInfo", "-device-debug", "", "true", 0 }, + + { "HostDebugInfo", "g", "", "true", 0 }, + { "HostDebugInfo", "-debug", "", "true", 0 }, + + { 0, 0, 0, 0, 0 } +}; diff --git a/Source/cmVS10CudaHostFlagTable.h b/Source/cmVS10CudaHostFlagTable.h new file mode 100644 index 0000000..5b61066 --- /dev/null +++ b/Source/cmVS10CudaHostFlagTable.h @@ -0,0 +1,35 @@ +static cmVS7FlagTable cmVS10CudaHostFlagTable[] = { + //{"Optimization", "", "<inherit from host>", "InheritFromHost", 0}, + { "Optimization", "Od", "Disabled", "Od", 0 }, + { "Optimization", "O1", "Minimize Size", "O1", 0 }, + { "Optimization", "O2", "Maximize Speed", "O2", 0 }, + { "Optimization", "Ox", "Full Optimization", "O3", 0 }, + + //{"Runtime", "", "<inherit from host>", "InheritFromHost", 0}, + { "Runtime", "MT", "Multi-Threaded", "MT", 0 }, + { "Runtime", "MTd", "Multi-Threaded Debug", "MTd", 0 }, + { "Runtime", "MD", "Multi-Threaded DLL", "MD", 0 }, + { "Runtime", "MDd", "Multi-threaded Debug DLL", "MDd", 0 }, + { "Runtime", "ML", "Single-Threaded", "ML", 0 }, + { "Runtime", "MLd", "Single-Threaded Debug", "MLd", 0 }, + + //{"RuntimeChecks", "", "<inherit from host>", "InheritFromHost", 0}, + //{"RuntimeChecks", "", "Default", "Default", 0}, + { "RuntimeChecks", "RTCs", "Stack Frames", "RTCs", 0 }, + { "RuntimeChecks", "RTCu", "Uninitialized Variables", "RTCu", 0 }, + { "RuntimeChecks", "RTC1", "Both", "RTC1", 0 }, + + //{"TypeInfo", "", "<inherit from host>", "InheritFromHost", 0}, + { "TypeInfo", "GR", "Yes", "true", 0 }, + { "TypeInfo", "GR-", "No", "false", 0 }, + + //{"Warning", "", "<inherit from host>", "InheritFromHost", 0}, + { "Warning", "W0", "Off: Turn Off All Warnings", "W0", 0 }, + { "Warning", "W1", "Level 1", "W1", 0 }, + { "Warning", "W2", "Level 2", "W2", 0 }, + { "Warning", "W3", "Level 3", "W3", 0 }, + { "Warning", "W4", "Level 4", "W4", 0 }, + { "Warning", "Wall", "Enable All Warnings", "Wall", 0 }, + + { 0, 0, 0, 0, 0 } +}; diff --git a/Source/cmVS10NASMFlagTable.h b/Source/cmVS10NASMFlagTable.h new file mode 100644 index 0000000..b91af92 --- /dev/null +++ b/Source/cmVS10NASMFlagTable.h @@ -0,0 +1,50 @@ +static cmVS7FlagTable cmVS10NASMFlagTable[] = { + + // Enum Properties + { "Outputswitch", "fwin32", "", "0", 0 }, + { "Outputswitch", "fwin", "", "0", 0 }, + { "Outputswitch", "fwin64", "", "1", 0 }, + { "Outputswitch", "felf", "", "2", 0 }, + { "Outputswitch", "felf32", "", "2", 0 }, + { "Outputswitch", "felf64", "", "3", 0 }, + + { "ErrorReportingFormat", "Xgnu", "", "-Xgnu GNU format: Default format", + 0 }, + { "ErrorReportingFormat", "Xvc", "", + "-Xvc Style used by Microsoft Visual C++", 0 }, + + // Bool Properties + { "TreatWarningsAsErrors", "Werror", "", "true", 0 }, + { "GenerateDebugInformation", "g", "", "true", 0 }, + { "floatunderflow", "w+float-underflow", "", "true", 0 }, + { "macrodefaults", "w-macro-defaults", "", "true", 0 }, + { "user", "w-user", "%warning directives (default on)", "true", 0 }, + { "floatoverflow", "w-float-overflow", "", "true", 0 }, + { "floatdenorm", "w+float-denorm", "", "true", 0 }, + { "numberoverflow", "w-number-overflow", "", "true", 0 }, + { "macroselfref", "w+macro-selfref", "", "true", 0 }, + { "floattoolong", "w-float-toolong", "", "true", 0 }, + { "orphanlabels", "w-orphan-labels", "", "true", 0 }, + { "tasmmode", "t", "", "true", 0 }, + + // Bool Properties With Argument + + // String List Properties + { "PreprocessorDefinitions", "D", "Preprocessor Definitions", "", + cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable }, + { "UndefinePreprocessorDefinitions", "U", + "Undefine Preprocessor Definitions", "", + cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable }, + { "IncludePaths", "I", "Include Paths", "", + cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable }, + { "AssembledCodeListingFile", "l", + "Generates an assembled code listing file.", "", + cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable }, + + // String Properties + // Skip [Inputs] - no command line Switch. + // Skip [CommandLineTemplate] - no command line Switch. + // Skip [ExecutionDescription] - no command line Switch. + // Skip [AdditionalOptions] - no command line Switch. + { 0, 0, 0, 0, 0 } +}; diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx index 1eb1f20..10b0a88 100644 --- a/Source/cmVariableRequiresCommand.cxx +++ b/Source/cmVariableRequiresCommand.cxx @@ -3,7 +3,6 @@ #include "cmVariableRequiresCommand.h" #include "cmMakefile.h" -#include "cmPolicies.h" #include "cmState.h" #include "cmSystemTools.h" @@ -13,11 +12,6 @@ class cmExecutionStatus; bool cmVariableRequiresCommand::InitialPass( std::vector<std::string> const& args, cmExecutionStatus&) { - if (this->Disallowed( - cmPolicies::CMP0035, - "The variable_requires command should not be called; see CMP0035.")) { - return true; - } if (args.size() < 3) { this->SetError("called with incorrect number of arguments"); return false; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 902fe03..a9ccc68 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -10,6 +10,7 @@ #include "cmLocalVisualStudio7Generator.h" #include "cmMakefile.h" #include "cmSourceFile.h" +#include "cmSystemTools.h" #include "cmVisualStudioGeneratorOptions.h" #include "windows.h" @@ -111,6 +112,10 @@ cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator() i != this->LinkOptions.end(); ++i) { delete i->second; } + for (OptionsMap::iterator i = this->CudaOptions.begin(); + i != this->CudaOptions.end(); ++i) { + delete i->second; + } if (!this->BuildFileStream) { return; } @@ -205,9 +210,15 @@ void cmVisualStudio10TargetGenerator::Generate() if (!this->ComputeRcOptions()) { return; } + if (!this->ComputeCudaOptions()) { + return; + } if (!this->ComputeMasmOptions()) { return; } + if (!this->ComputeNasmOptions()) { + return; + } if (!this->ComputeLinkOptions()) { return; } @@ -450,11 +461,34 @@ void cmVisualStudio10TargetGenerator::Generate() this->WriteString("<Import Project=\"" VS10_CXX_PROPS "\" />\n", 1); } this->WriteString("<ImportGroup Label=\"ExtensionSettings\">\n", 1); + if (this->GlobalGenerator->IsCudaEnabled()) { + this->WriteString("<Import Project=\"$(VCTargetsPath)\\" + "BuildCustomizations\\CUDA ", + 2); + (*this->BuildFileStream) + << cmVS10EscapeXML(this->GlobalGenerator->GetPlatformToolsetCudaString()) + << ".props\" />\n"; + } if (this->GlobalGenerator->IsMasmEnabled()) { this->WriteString("<Import Project=\"$(VCTargetsPath)\\" "BuildCustomizations\\masm.props\" />\n", 2); } + if (this->GlobalGenerator->IsNasmEnabled()) { + // Always search in the standard modules location. + std::string propsTemplate = + GetCMakeFilePath("Templates/MSBuild/nasm.props.in"); + + std::string propsLocal; + propsLocal += this->DefaultArtifactDir; + propsLocal += "\\nasm.props"; + this->ConvertToWindowsSlash(propsLocal); + this->Makefile->ConfigureFile(propsTemplate.c_str(), propsLocal.c_str(), + false, true, true); + std::string import = std::string("<Import Project=\"") + + cmVS10EscapeXML(propsLocal) + "\" />\n"; + this->WriteString(import.c_str(), 2); + } this->WriteString("</ImportGroup>\n", 1); this->WriteString("<ImportGroup Label=\"PropertySheets\">\n", 1); { @@ -505,11 +539,26 @@ void cmVisualStudio10TargetGenerator::Generate() this->WriteTargetSpecificReferences(); this->WriteString("<ImportGroup Label=\"ExtensionTargets\">\n", 1); this->WriteTargetsFileReferences(); + if (this->GlobalGenerator->IsCudaEnabled()) { + this->WriteString("<Import Project=\"$(VCTargetsPath)\\" + "BuildCustomizations\\CUDA ", + 2); + (*this->BuildFileStream) + << cmVS10EscapeXML(this->GlobalGenerator->GetPlatformToolsetCudaString()) + << ".targets\" />\n"; + } if (this->GlobalGenerator->IsMasmEnabled()) { this->WriteString("<Import Project=\"$(VCTargetsPath)\\" "BuildCustomizations\\masm.targets\" />\n", 2); } + if (this->GlobalGenerator->IsNasmEnabled()) { + std::string nasmTargets = + GetCMakeFilePath("Templates/MSBuild/nasm.targets"); + std::string import = "<Import Project=\""; + import += cmVS10EscapeXML(nasmTargets) + "\" />\n"; + this->WriteString(import.c_str(), 2); + } this->WriteString("</ImportGroup>\n", 1); if (csproj == this->ProjectType) { for (std::vector<std::string>::const_iterator i = @@ -1668,8 +1717,10 @@ void cmVisualStudio10TargetGenerator::WriteSource(std::string const& tool, // // and fail if this exceeds the maximum allowed path length. Our path // conversion uses full paths when possible to allow deeper trees. - bool forceRelative = false; - std::string sourceFile = this->ConvertPath(sf->GetFullPath(), false); + // However, CUDA 8.0 msbuild rules fail on absolute paths so for CUDA + // we must use relative paths. + bool forceRelative = sf->GetLanguage() == "CUDA"; + std::string sourceFile = this->ConvertPath(sf->GetFullPath(), forceRelative); if (this->LocalGenerator->GetVersion() == cmGlobalVisualStudioGenerator::VS10 && cmSystemTools::FileIsFullPath(sourceFile.c_str())) { @@ -1740,10 +1791,14 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() tool = "ClCompile"; } else if (lang == "ASM_MASM" && this->GlobalGenerator->IsMasmEnabled()) { tool = "MASM"; + } else if (lang == "ASM_NASM" && this->GlobalGenerator->IsNasmEnabled()) { + tool = "NASM"; } else if (lang == "RC") { tool = "ResourceCompile"; } else if (lang == "CSharp") { tool = "Compile"; + } else if (lang == "CUDA" && this->GlobalGenerator->IsCudaEnabled()) { + tool = "CudaCompile"; } if (!tool.empty()) { @@ -1813,10 +1868,9 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() (*this->BuildFileStream) << cmVS10EscapeXML(obj) << "\" />\n"; } - if (cmSourceFile const* defsrc = - this->GeneratorTarget->GetModuleDefinitionFile("")) { - this->WriteSource("None", defsrc); - } + std::vector<cmSourceFile const*> defSources; + this->GeneratorTarget->GetModuleDefinitionSources(defSources, ""); + this->WriteSources("None", defSources); if (this->IsMissingFiles) { this->WriteMissingFiles(); @@ -1932,7 +1986,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( } clOptions.AddDefines(configDefines.c_str()); clOptions.SetConfiguration((*config).c_str()); - clOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); + clOptions.PrependInheritedString("AdditionalOptions"); clOptions.OutputFlagMap(*this->BuildFileStream, " "); clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", "\n", lang); @@ -2180,8 +2234,13 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( if (linkLanguage == "CXX") { clOptions.AddFlag("CompileAs", "CompileAsCpp"); } - this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget, - linkLanguage, configName.c_str()); + if (linkLanguage != "CUDA") { + this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget, + linkLanguage, configName.c_str()); + } + + // Check IPO related warning/error. + this->GeneratorTarget->IsIPOEnabled(configName); // Get preprocessor definitions for this directory. std::string defineFlags = @@ -2265,7 +2324,7 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( return; } this->WriteString("<ClCompile>\n", 2); - clOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); + clOptions.PrependInheritedString("AdditionalOptions"); clOptions.AppendFlag("AdditionalIncludeDirectories", includes); clOptions.AppendFlag("AdditionalIncludeDirectories", "%(AdditionalIncludeDirectories)"); @@ -2369,12 +2428,105 @@ void cmVisualStudio10TargetGenerator::WriteRCOptions( rcOptions.AppendFlag("AdditionalIncludeDirectories", includes); rcOptions.AppendFlag("AdditionalIncludeDirectories", "%(AdditionalIncludeDirectories)"); + rcOptions.PrependInheritedString("AdditionalOptions"); rcOptions.OutputFlagMap(*this->BuildFileStream, " "); - rcOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); this->WriteString("</ResourceCompile>\n", 2); } +bool cmVisualStudio10TargetGenerator::ComputeCudaOptions() +{ + if (!this->GlobalGenerator->IsCudaEnabled()) { + return true; + } + for (std::vector<std::string>::const_iterator i = + this->Configurations.begin(); + i != this->Configurations.end(); ++i) { + if (!this->ComputeCudaOptions(*i)) { + return false; + } + } + return true; +} + +bool cmVisualStudio10TargetGenerator::ComputeCudaOptions( + std::string const& configName) +{ + cmGlobalVisualStudio10Generator* gg = + static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator); + CM_AUTO_PTR<Options> pOptions(new Options( + this->LocalGenerator, Options::CudaCompiler, gg->GetCudaFlagTable())); + Options& cudaOptions = *pOptions; + + // Get compile flags for CUDA in this directory. + std::string CONFIG = cmSystemTools::UpperCase(configName); + std::string configFlagsVar = std::string("CMAKE_CUDA_FLAGS_") + CONFIG; + std::string flags = + std::string(this->Makefile->GetSafeDefinition("CMAKE_CUDA_FLAGS")) + + std::string(" ") + + std::string(this->Makefile->GetSafeDefinition(configFlagsVar)); + + // Get preprocessor definitions for this directory. + std::string defineFlags = + this->GeneratorTarget->Target->GetMakefile()->GetDefineFlags(); + + cudaOptions.Parse(flags.c_str()); + cudaOptions.Parse(defineFlags.c_str()); + cudaOptions.ParseFinish(); + + if (this->GeneratorTarget->GetPropertyAsBool("CUDA_SEPARABLE_COMPILATION")) { + cudaOptions.AddFlag("GenerateRelocatableDeviceCode", "true"); + } + + // Convert the host compiler options to the toolset's abstractions + // using a secondary flag table. + cudaOptions.ClearTables(); + cudaOptions.AddTable(gg->GetCudaHostFlagTable()); + cudaOptions.Reparse("AdditionalCompilerOptions"); + + // `CUDA 8.0.targets` places these before nvcc! Just drop whatever + // did not parse and hope it works. + cudaOptions.RemoveFlag("AdditionalCompilerOptions"); + + cudaOptions.FixCudaCodeGeneration(); + + std::vector<std::string> targetDefines; + this->GeneratorTarget->GetCompileDefinitions(targetDefines, + configName.c_str(), "CUDA"); + cudaOptions.AddDefines(targetDefines); + + // Add a definition for the configuration name. + std::string configDefine = "CMAKE_INTDIR=\""; + configDefine += configName; + configDefine += "\""; + cudaOptions.AddDefine(configDefine); + if (const char* exportMacro = this->GeneratorTarget->GetExportMacro()) { + cudaOptions.AddDefine(exportMacro); + } + + this->CudaOptions[configName] = pOptions.release(); + return true; +} + +void cmVisualStudio10TargetGenerator::WriteCudaOptions( + std::string const& configName, std::vector<std::string> const& includes) +{ + if (!this->MSTools || !this->GlobalGenerator->IsCudaEnabled()) { + return; + } + this->WriteString("<CudaCompile>\n", 2); + + Options& cudaOptions = *(this->CudaOptions[configName]); + cudaOptions.AppendFlag("Include", includes); + cudaOptions.AppendFlag("Include", "%(Include)"); + cudaOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", + "\n", "CUDA"); + cudaOptions.PrependInheritedString("AdditionalOptions"); + cudaOptions.OutputFlagMap(*this->BuildFileStream, " "); + + this->WriteString("</CudaCompile>\n", 2); +} + bool cmVisualStudio10TargetGenerator::ComputeMasmOptions() { if (!this->GlobalGenerator->IsMasmEnabled()) { @@ -2427,12 +2579,77 @@ void cmVisualStudio10TargetGenerator::WriteMasmOptions( Options& masmOptions = *(this->MasmOptions[configName]); masmOptions.AppendFlag("IncludePaths", includes); masmOptions.AppendFlag("IncludePaths", "%(IncludePaths)"); + masmOptions.PrependInheritedString("AdditionalOptions"); masmOptions.OutputFlagMap(*this->BuildFileStream, " "); - masmOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); this->WriteString("</MASM>\n", 2); } +bool cmVisualStudio10TargetGenerator::ComputeNasmOptions() +{ + if (!this->GlobalGenerator->IsNasmEnabled()) { + return true; + } + for (std::vector<std::string>::const_iterator i = + this->Configurations.begin(); + i != this->Configurations.end(); ++i) { + if (!this->ComputeNasmOptions(*i)) { + return false; + } + } + return true; +} + +bool cmVisualStudio10TargetGenerator::ComputeNasmOptions( + std::string const& configName) +{ + cmGlobalVisualStudio10Generator* gg = + static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator); + CM_AUTO_PTR<Options> pOptions(new Options( + this->LocalGenerator, Options::NasmCompiler, gg->GetNasmFlagTable())); + Options& nasmOptions = *pOptions; + + std::string CONFIG = cmSystemTools::UpperCase(configName); + std::string configFlagsVar = std::string("CMAKE_ASM_NASM_FLAGS_") + CONFIG; + std::string flags = + std::string(this->Makefile->GetSafeDefinition("CMAKE_ASM_NASM_FLAGS")) + + std::string(" -f") + std::string(this->Makefile->GetSafeDefinition( + "CMAKE_ASM_NASM_OBJECT_FORMAT")) + + std::string(" ") + + std::string(this->Makefile->GetSafeDefinition(configFlagsVar)); + nasmOptions.Parse(flags.c_str()); + this->NasmOptions[configName] = pOptions.release(); + return true; +} + +void cmVisualStudio10TargetGenerator::WriteNasmOptions( + std::string const& configName, std::vector<std::string> includes) +{ + if (!this->GlobalGenerator->IsNasmEnabled()) { + return; + } + this->WriteString("<NASM>\n", 2); + + Options& nasmOptions = *(this->NasmOptions[configName]); + for (size_t i = 0; i < includes.size(); i++) { + includes[i] += "\\"; + } + + nasmOptions.AppendFlag("IncludePaths", includes); + nasmOptions.AppendFlag("IncludePaths", "%(IncludePaths)"); + nasmOptions.OutputFlagMap(*this->BuildFileStream, " "); + nasmOptions.PrependInheritedString("AdditionalOptions"); + nasmOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", + "\n", "ASM_NASM"); + + // Preprocessor definitions and includes are shared with clOptions. + Options& clOptions = *(this->ClOptions[configName]); + clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", + "\n", "ASM_NASM"); + + this->WriteString("</NASM>\n", 2); +} + void cmVisualStudio10TargetGenerator::WriteLibOptions( std::string const& config) { @@ -2451,7 +2668,7 @@ void cmVisualStudio10TargetGenerator::WriteLibOptions( this->LocalGenerator, cmVisualStudioGeneratorOptions::Linker, gg->GetLibFlagTable(), 0, this); libOptions.Parse(libflags.c_str()); - libOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); + libOptions.PrependInheritedString("AdditionalOptions"); libOptions.OutputFlagMap(*this->BuildFileStream, " "); this->WriteString("</Lib>\n", 2); } @@ -2648,8 +2865,10 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( this->LocalGenerator, Options::Linker, gg->GetLinkFlagTable(), 0, this)); Options& linkOptions = *pOptions; - const std::string& linkLanguage = - this->GeneratorTarget->GetLinkerLanguage(config.c_str()); + cmGeneratorTarget::LinkClosure const* linkClosure = + this->GeneratorTarget->GetLinkClosure(config); + + const std::string& linkLanguage = linkClosure->LinkerLanguage; if (linkLanguage.empty()) { cmSystemTools::Error( "CMake can not determine linker language for target: ", @@ -2690,25 +2909,6 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( flags += " "; flags += flagsConfig; } - std::string standardLibsVar = "CMAKE_"; - standardLibsVar += linkLanguage; - standardLibsVar += "_STANDARD_LIBRARIES"; - std::string libs = - this->Makefile->GetSafeDefinition(standardLibsVar.c_str()); - // Remove trailing spaces from libs - std::string::size_type pos = libs.size() - 1; - if (!libs.empty()) { - while (libs[pos] == ' ') { - pos--; - } - } - if (pos != libs.size() - 1) { - libs = libs.substr(0, pos + 1); - } - // Replace spaces in libs with ; - std::replace(libs.begin(), libs.end(), ' ', ';'); - std::vector<std::string> libVec; - cmSystemTools::ExpandListArgument(libs, libVec); cmComputeLinkInformation* pcli = this->GeneratorTarget->GetLinkInformation(config.c_str()); @@ -2718,10 +2918,30 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( this->Name.c_str()); return false; } - // add the libraries for the target to libs string cmComputeLinkInformation& cli = *pcli; + + std::vector<std::string> libVec; std::vector<std::string> vsTargetVec; this->AddLibraries(cli, libVec, vsTargetVec); + if (std::find(linkClosure->Languages.begin(), linkClosure->Languages.end(), + "CUDA") != linkClosure->Languages.end()) { + switch (this->CudaOptions[config]->GetCudaRuntime()) { + case cmVisualStudioGeneratorOptions::CudaRuntimeStatic: + libVec.push_back("cudart_static.lib"); + break; + case cmVisualStudioGeneratorOptions::CudaRuntimeShared: + libVec.push_back("cudart.lib"); + break; + case cmVisualStudioGeneratorOptions::CudaRuntimeNone: + break; + } + } + std::string standardLibsVar = "CMAKE_"; + standardLibsVar += linkLanguage; + standardLibsVar += "_STANDARD_LIBRARIES"; + std::string const libs = + this->Makefile->GetSafeDefinition(standardLibsVar.c_str()); + cmSystemTools::ParseWindowsCommandLine(libs.c_str(), libVec); linkOptions.AddFlag("AdditionalDependencies", libVec); // Populate TargetsFileAndConfigsVec @@ -2836,24 +3056,15 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( linkOptions.Parse(flags.c_str()); if (this->MSTools) { - if (cmSourceFile const* defsrc = - this->GeneratorTarget->GetModuleDefinitionFile("")) { - linkOptions.AddFlag("ModuleDefinitionFile", - defsrc->GetFullPath().c_str()); + cmGeneratorTarget::ModuleDefinitionInfo const* mdi = + this->GeneratorTarget->GetModuleDefinitionInfo(config); + if (mdi && !mdi->DefFile.empty()) { + linkOptions.AddFlag("ModuleDefinitionFile", mdi->DefFile.c_str()); } linkOptions.AppendFlag("IgnoreSpecificDefaultLibraries", "%(IgnoreSpecificDefaultLibraries)"); } - if ((this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY || - this->GeneratorTarget->IsExecutableWithExports()) && - this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) { - if (this->GeneratorTarget->GetPropertyAsBool( - "WINDOWS_EXPORT_ALL_SYMBOLS")) { - linkOptions.AddFlag("ModuleDefinitionFile", "$(IntDir)exportall.def"); - } - } - // Hack to fix flag version selection in a common use case. // FIXME: Select flag table based on toolset instead of VS version. if (this->LocalGenerator->GetVersion() >= @@ -2940,7 +3151,7 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions( Options& linkOptions = *(this->LinkOptions[config]); this->WriteString("<Link>\n", 2); - linkOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); + linkOptions.PrependInheritedString("AdditionalOptions"); linkOptions.OutputFlagMap(*this->BuildFileStream, " "); this->WriteString("</Link>\n", 2); @@ -3063,7 +3274,9 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups() this->WriteClOptions(*i, includes); // output rc compile flags <ResourceCompile></ResourceCompile> this->WriteRCOptions(*i, includes); + this->WriteCudaOptions(*i, includes); this->WriteMasmOptions(*i, includes); + this->WriteNasmOptions(*i, includes); } // output midl flags <Midl></Midl> this->WriteMidlOptions(*i, includes); @@ -3090,18 +3303,15 @@ void cmVisualStudio10TargetGenerator::WriteEvents( std::string const& configName) { bool addedPrelink = false; - if ((this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY || - this->GeneratorTarget->IsExecutableWithExports()) && - this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) { - if (this->GeneratorTarget->GetPropertyAsBool( - "WINDOWS_EXPORT_ALL_SYMBOLS")) { - addedPrelink = true; - std::vector<cmCustomCommand> commands = - this->GeneratorTarget->GetPreLinkCommands(); - this->GlobalGenerator->AddSymbolExportCommand(this->GeneratorTarget, - commands, configName); - this->WriteEvent("PreLinkEvent", commands, configName); - } + cmGeneratorTarget::ModuleDefinitionInfo const* mdi = + this->GeneratorTarget->GetModuleDefinitionInfo(configName); + if (mdi && mdi->DefFileGenerated) { + addedPrelink = true; + std::vector<cmCustomCommand> commands = + this->GeneratorTarget->GetPreLinkCommands(); + this->GlobalGenerator->AddSymbolExportCommand(this->GeneratorTarget, + commands, configName); + this->WriteEvent("PreLinkEvent", commands, configName); } if (!addedPrelink) { this->WriteEvent("PreLinkEvent", @@ -3990,3 +4200,14 @@ bool cmVisualStudio10TargetGenerator::ForceOld(const std::string& source) const CloseHandle(h); return true; } + +std::string cmVisualStudio10TargetGenerator::GetCMakeFilePath( + const char* relativeFilePath) const +{ + // Always search in the standard modules location. + std::string path = cmSystemTools::GetCMakeRoot() + "/"; + path += relativeFilePath; + this->ConvertToWindowsSlash(path); + + return path; +} diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 45464c0..52d5550 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -51,7 +51,7 @@ private: }; std::string ConvertPath(std::string const& path, bool forceRelative); - void ConvertToWindowsSlash(std::string& s); + static void ConvertToWindowsSlash(std::string& s); void WriteString(const char* line, int indentLevel); void WriteProjectConfigurations(); void WriteProjectConfigurationValues(); @@ -98,10 +98,19 @@ private: bool ComputeRcOptions(std::string const& config); void WriteRCOptions(std::string const& config, std::vector<std::string> const& includes); + bool ComputeCudaOptions(); + bool ComputeCudaOptions(std::string const& config); + void WriteCudaOptions(std::string const& config, + std::vector<std::string> const& includes); bool ComputeMasmOptions(); bool ComputeMasmOptions(std::string const& config); void WriteMasmOptions(std::string const& config, std::vector<std::string> const& includes); + bool ComputeNasmOptions(); + bool ComputeNasmOptions(std::string const& config); + void WriteNasmOptions(std::string const& config, + std::vector<std::string> includes); + bool ComputeLinkOptions(); bool ComputeLinkOptions(std::string const& config); bool ComputeLibOptions(); @@ -145,7 +154,9 @@ private: typedef std::map<std::string, Options*> OptionsMap; OptionsMap ClOptions; OptionsMap RcOptions; + OptionsMap CudaOptions; OptionsMap MasmOptions; + OptionsMap NasmOptions; OptionsMap LinkOptions; std::string PathToProjectFile; std::string ProjectFileExtension; @@ -177,6 +188,7 @@ private: typedef std::map<std::string, ToolSources> ToolSourceMap; ToolSourceMap Tools; + std::string GetCMakeFilePath(const char* name) const; }; #endif diff --git a/Source/cmVisualStudio10ToolsetOptions.cxx b/Source/cmVisualStudio10ToolsetOptions.cxx index afca216..0f15ec4 100644 --- a/Source/cmVisualStudio10ToolsetOptions.cxx +++ b/Source/cmVisualStudio10ToolsetOptions.cxx @@ -11,6 +11,7 @@ #include "cmVS10LibFlagTable.h" #include "cmVS10LinkFlagTable.h" #include "cmVS10MASMFlagTable.h" +#include "cmVS10NASMFlagTable.h" #include "cmVS10RCFlagTable.h" #include "cmVS11CLFlagTable.h" #include "cmVS11CSharpFlagTable.h" diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index da6f9a7..abc4924 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -44,6 +44,8 @@ cmVisualStudioGeneratorOptions::cmVisualStudioGeneratorOptions( this->FortranRuntimeDebug = false; this->FortranRuntimeDLL = false; this->FortranRuntimeMT = false; + + this->UnknownFlagField = "AdditionalOptions"; } cmVisualStudioGeneratorOptions::cmVisualStudioGeneratorOptions( @@ -68,6 +70,8 @@ cmVisualStudioGeneratorOptions::cmVisualStudioGeneratorOptions( this->FortranRuntimeDebug = false; this->FortranRuntimeDLL = false; this->FortranRuntimeMT = false; + + this->UnknownFlagField = "AdditionalOptions"; } void cmVisualStudioGeneratorOptions::AddTable(cmVS7FlagTable const* table) @@ -82,6 +86,13 @@ void cmVisualStudioGeneratorOptions::AddTable(cmVS7FlagTable const* table) } } +void cmVisualStudioGeneratorOptions::ClearTables() +{ + for (int i = 0; i < FlagTableCount; ++i) { + this->FlagTable[i] = CM_NULLPTR; + } +} + void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault() { // Exception handling is on by default because the platform file has @@ -177,6 +188,78 @@ bool cmVisualStudioGeneratorOptions::UsingSBCS() const return false; } +cmVisualStudioGeneratorOptions::CudaRuntime +cmVisualStudioGeneratorOptions::GetCudaRuntime() const +{ + std::map<std::string, FlagValue>::const_iterator i = + this->FlagMap.find("CudaRuntime"); + if (i != this->FlagMap.end() && i->second.size() == 1) { + std::string const& cudaRuntime = i->second[0]; + if (cudaRuntime == "Static") { + return CudaRuntimeStatic; + } + if (cudaRuntime == "Shared") { + return CudaRuntimeShared; + } + if (cudaRuntime == "None") { + return CudaRuntimeNone; + } + } + // nvcc default is static + return CudaRuntimeStatic; +} + +void cmVisualStudioGeneratorOptions::FixCudaCodeGeneration() +{ + // Extract temporary values stored by our flag table. + FlagValue arch = this->TakeFlag("cmake-temp-arch"); + FlagValue code = this->TakeFlag("cmake-temp-code"); + FlagValue gencode = this->TakeFlag("cmake-temp-gencode"); + + // No -code allowed without -arch. + if (arch.empty()) { + code.clear(); + } + + if (arch.empty() && gencode.empty()) { + return; + } + + // Create a CodeGeneration field with [arch],[code] syntax in each entry. + // CUDA will convert it to `-gencode=arch=[arch],code="[code],[arch]"`. + FlagValue& result = this->FlagMap["CodeGeneration"]; + + // First entries for the -arch=<arch> [-code=<code>,...] pair. + if (!arch.empty()) { + std::string arch_name = arch[0]; + std::vector<std::string> codes; + if (!code.empty()) { + codes = cmSystemTools::tokenize(code[0], ","); + } + if (codes.empty()) { + codes.push_back(arch_name); + // nvcc -arch=<arch> has a special case that allows a real + // architecture to be specified instead of a virtual arch. + // It translates to -arch=<virtual> -code=<real>. + cmSystemTools::ReplaceString(arch_name, "sm_", "compute_"); + } + for (std::vector<std::string>::iterator ci = codes.begin(); + ci != codes.end(); ++ci) { + std::string entry = arch_name + "," + *ci; + result.push_back(entry); + } + } + + // Now add entries for the -gencode=<arch>,<code> pairs. + for (std::vector<std::string>::iterator ei = gencode.begin(); + ei != gencode.end(); ++ei) { + std::string entry = *ei; + cmSystemTools::ReplaceString(entry, "arch=", ""); + cmSystemTools::ReplaceString(entry, "code=", ""); + result.push_back(entry); + } +} + void cmVisualStudioGeneratorOptions::Parse(const char* flags) { // Parse the input string as a windows command line since the string @@ -210,6 +293,44 @@ void cmVisualStudioGeneratorOptions::ParseFinish() rl += this->FortranRuntimeDLL ? "DLL" : ""; this->FlagMap["RuntimeLibrary"] = rl; } + + if (this->CurrentTool == CudaCompiler) { + std::map<std::string, FlagValue>::iterator i = + this->FlagMap.find("CudaRuntime"); + if (i != this->FlagMap.end() && i->second.size() == 1) { + std::string& cudaRuntime = i->second[0]; + if (cudaRuntime == "static") { + cudaRuntime = "Static"; + } else if (cudaRuntime == "shared") { + cudaRuntime = "Shared"; + } else if (cudaRuntime == "none") { + cudaRuntime = "None"; + } + } + } +} + +void cmVisualStudioGeneratorOptions::PrependInheritedString( + std::string const& key) +{ + std::map<std::string, FlagValue>::iterator i = this->FlagMap.find(key); + if (i == this->FlagMap.end() || i->second.size() != 1) { + return; + } + std::string& value = i->second[0]; + value = "%(" + key + ") " + value; +} + +void cmVisualStudioGeneratorOptions::Reparse(std::string const& key) +{ + std::map<std::string, FlagValue>::iterator i = this->FlagMap.find(key); + if (i == this->FlagMap.end() || i->second.size() != 1) { + return; + } + std::string const original = i->second[0]; + i->second[0] = ""; + this->UnknownFlagField = key; + this->Parse(original.c_str()); } void cmVisualStudioGeneratorOptions::StoreUnknownFlag(const char* flag) @@ -235,10 +356,22 @@ void cmVisualStudioGeneratorOptions::StoreUnknownFlag(const char* flag) } // This option is not known. Store it in the output flags. - this->FlagString += " "; - this->FlagString += cmOutputConverter::EscapeWindowsShellArgument( + std::string const opts = cmOutputConverter::EscapeWindowsShellArgument( flag, cmOutputConverter::Shell_Flag_AllowMakeVariables | cmOutputConverter::Shell_Flag_VSIDE); + this->AppendFlagString(this->UnknownFlagField, opts); +} + +cmIDEOptions::FlagValue cmVisualStudioGeneratorOptions::TakeFlag( + std::string const& key) +{ + FlagValue value; + std::map<std::string, FlagValue>::iterator i = this->FlagMap.find(key); + if (i != this->FlagMap.end()) { + value = i->second; + this->FlagMap.erase(i); + } + return value; } void cmVisualStudioGeneratorOptions::SetConfiguration(const char* config) @@ -253,19 +386,22 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions( if (this->Defines.empty()) { return; } + const char* tag = "PreprocessorDefinitions"; + if (lang == "CUDA") { + tag = "Defines"; + } if (this->Version >= cmGlobalVisualStudioGenerator::VS10) { // if there are configuration specific flags, then // use the configuration specific tag for PreprocessorDefinitions if (!this->Configuration.empty()) { fout << prefix; this->TargetGenerator->WritePlatformConfigTag( - "PreprocessorDefinitions", this->Configuration.c_str(), 0, 0, 0, - &fout); + tag, this->Configuration.c_str(), 0, 0, 0, &fout); } else { - fout << prefix << "<PreprocessorDefinitions>"; + fout << prefix << "<" << tag << ">"; } } else { - fout << prefix << "PreprocessorDefinitions=\""; + fout << prefix << tag << "=\""; } const char* sep = ""; std::vector<std::string>::const_iterator de = @@ -294,7 +430,7 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions( sep = ";"; } if (this->Version >= cmGlobalVisualStudioGenerator::VS10) { - fout << ";%(PreprocessorDefinitions)</PreprocessorDefinitions>" << suffix; + fout << ";%(" << tag << ")</" << tag << ">" << suffix; } else { fout << "\"" << suffix; } @@ -335,26 +471,3 @@ void cmVisualStudioGeneratorOptions::OutputFlagMap(std::ostream& fout, } } } - -void cmVisualStudioGeneratorOptions::OutputAdditionalOptions( - std::ostream& fout, const char* prefix, const char* suffix) -{ - if (!this->FlagString.empty()) { - if (this->Version >= cmGlobalVisualStudioGenerator::VS10) { - fout << prefix; - if (!this->Configuration.empty()) { - this->TargetGenerator->WritePlatformConfigTag( - "AdditionalOptions", this->Configuration.c_str(), 0, 0, 0, &fout); - } else { - fout << "<AdditionalOptions>"; - } - fout << "%(AdditionalOptions) " - << cmVisualStudio10GeneratorOptionsEscapeForXML(this->FlagString) - << "</AdditionalOptions>\n"; - } else { - fout << prefix << "AdditionalOptions=\""; - fout << cmVisualStudioGeneratorOptionsEscapeForXML(this->FlagString); - fout << "\"" << suffix; - } - } -} diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h index ab6b8cc..52689e0 100644 --- a/Source/cmVisualStudioGeneratorOptions.h +++ b/Source/cmVisualStudioGeneratorOptions.h @@ -26,7 +26,9 @@ public: { Compiler, ResourceCompiler, + CudaCompiler, MasmCompiler, + NasmCompiler, Linker, FortranCompiler, CSharpCompiler @@ -42,10 +44,19 @@ public: // Add a table of flags. void AddTable(cmVS7FlagTable const* table); + // Clear the flag tables. + void ClearTables(); + // Store options from command line flags. void Parse(const char* flags); void ParseFinish(); + void PrependInheritedString(std::string const& key); + + // Parse the content of the given flag table entry again to extract + // known flags and leave the rest in the original entry. + void Reparse(std::string const& key); + // Fix the ExceptionHandling option to default to off. void FixExceptionHandlingDefault(); @@ -56,6 +67,16 @@ public: bool UsingUnicode() const; bool UsingSBCS() const; + enum CudaRuntime + { + CudaRuntimeStatic, + CudaRuntimeShared, + CudaRuntimeNone + }; + CudaRuntime GetCudaRuntime() const; + + void FixCudaCodeGeneration(); + bool IsDebug() const; bool IsWinRt() const; bool IsManaged() const; @@ -64,8 +85,6 @@ public: const char* suffix, const std::string& lang); void OutputFlagMap(std::ostream& fout, const char* indent); - void OutputAdditionalOptions(std::ostream& fout, const char* prefix, - const char* suffix); void SetConfiguration(const char* config); private: @@ -80,7 +99,11 @@ private: bool FortranRuntimeDLL; bool FortranRuntimeMT; + std::string UnknownFlagField; + virtual void StoreUnknownFlag(const char* flag); + + FlagValue TakeFlag(std::string const& key); }; #endif diff --git a/Source/cmWorkingDirectory.cxx b/Source/cmWorkingDirectory.cxx new file mode 100644 index 0000000..99c9ba8 --- /dev/null +++ b/Source/cmWorkingDirectory.cxx @@ -0,0 +1,24 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmWorkingDirectory.h" + +#include "cmSystemTools.h" + +cmWorkingDirectory::cmWorkingDirectory(std::string const& newdir) +{ + this->OldDir = cmSystemTools::GetCurrentWorkingDirectory(); + cmSystemTools::ChangeDirectory(newdir); +} + +cmWorkingDirectory::~cmWorkingDirectory() +{ + this->Pop(); +} + +void cmWorkingDirectory::Pop() +{ + if (!this->OldDir.empty()) { + cmSystemTools::ChangeDirectory(this->OldDir); + this->OldDir.clear(); + } +} diff --git a/Source/cmWorkingDirectory.h b/Source/cmWorkingDirectory.h new file mode 100644 index 0000000..af0fd44 --- /dev/null +++ b/Source/cmWorkingDirectory.h @@ -0,0 +1,25 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmWorkingDirectory_h +#define cmWorkingDirectory_h + +#include <cmConfigure.h> // IWYU pragma: keep + +#include <string> + +/** \class cmWorkingDirectory + * \brief An RAII class to manipulate the working directory. + */ +class cmWorkingDirectory +{ +public: + cmWorkingDirectory(std::string const& newdir); + ~cmWorkingDirectory(); + + void Pop(); + +private: + std::string OldDir; +}; + +#endif diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index 96c8e27..ce2de57 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -4,12 +4,9 @@ #include <cmsys/FStream.hxx> -#include <sys/types.h> -// include sys/stat.h after sys/types.h -#include <sys/stat.h> - #include "cmMakefile.h" #include "cmSystemTools.h" +#include "cm_sys_stat.h" class cmExecutionStatus; diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx new file mode 100644 index 0000000..5c22531 --- /dev/null +++ b/Source/cmXCodeScheme.cxx @@ -0,0 +1,227 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmXCodeScheme.h" + +#include <iomanip> +#include <iostream> +#include <sstream> + +#include "cmGeneratedFileStream.h" +#include "cmGeneratorTarget.h" +#include "cmXMLSafe.h" + +cmXCodeScheme::cmXCodeScheme(cmXCodeObject* xcObj, + const std::vector<std::string>& configList, + unsigned int xcVersion) + : Target(xcObj) + , TargetName(xcObj->GetTarget()->GetName()) + , BuildableName(xcObj->GetTarget()->GetFullName()) + , TargetId(xcObj->GetId()) + , ConfigList(configList) + , XcodeVersion(xcVersion) +{ +} + +void cmXCodeScheme::WriteXCodeSharedScheme(const std::string& xcProjDir, + const std::string& container) +{ + // Create shared scheme sub-directory tree + // + std::string xcodeSchemeDir = xcProjDir; + xcodeSchemeDir += "/xcshareddata/xcschemes"; + cmSystemTools::MakeDirectory(xcodeSchemeDir.c_str()); + + std::string xcodeSchemeFile = xcodeSchemeDir; + xcodeSchemeFile += "/"; + xcodeSchemeFile += this->TargetName; + xcodeSchemeFile += ".xcscheme"; + + cmGeneratedFileStream fout(xcodeSchemeFile.c_str()); + fout.SetCopyIfDifferent(true); + if (!fout) { + return; + } + + WriteXCodeXCScheme(fout, container); +} + +void cmXCodeScheme::WriteXCodeXCScheme(std::ostream& fout, + const std::string& container) +{ + cmXMLWriter xout(fout); + xout.SetIndentationElement(std::string(3, ' ')); + xout.StartDocument(); + + xout.StartElement("Scheme"); + xout.BreakAttributes(); + xout.Attribute("LastUpgradeVersion", WriteVersionString()); + xout.Attribute("version", "1.3"); + + WriteBuildAction(xout, container); + WriteTestAction(xout, FindConfiguration("Debug")); + WriteLaunchAction(xout, FindConfiguration("Debug"), container); + WriteProfileAction(xout, FindConfiguration("Release")); + WriteAnalyzeAction(xout, FindConfiguration("Debug")); + WriteArchiveAction(xout, FindConfiguration("Release")); + + xout.EndElement(); +} + +void cmXCodeScheme::WriteBuildAction(cmXMLWriter& xout, + const std::string& container) +{ + xout.StartElement("BuildAction"); + xout.BreakAttributes(); + xout.Attribute("parallelizeBuildables", "YES"); + xout.Attribute("buildImplicitDependencies", "YES"); + + xout.StartElement("BuildActionEntries"); + xout.StartElement("BuildActionEntry"); + xout.BreakAttributes(); + xout.Attribute("buildForTesting", "YES"); + xout.Attribute("buildForRunning", "YES"); + xout.Attribute("buildForProfiling", "YES"); + xout.Attribute("buildForArchiving", "YES"); + xout.Attribute("buildForAnalyzing", "YES"); + + xout.StartElement("BuildableReference"); + xout.BreakAttributes(); + xout.Attribute("BuildableIdentifier", "primary"); + xout.Attribute("BlueprintIdentifier", this->TargetId); + xout.Attribute("BuildableName", this->BuildableName); + xout.Attribute("BlueprintName", this->TargetName); + xout.Attribute("ReferencedContainer", "container:" + container); + xout.EndElement(); + + xout.EndElement(); // BuildActionEntry + xout.EndElement(); // BuildActionEntries + xout.EndElement(); // BuildAction +} + +void cmXCodeScheme::WriteTestAction(cmXMLWriter& xout, + std::string configuration) +{ + xout.StartElement("TestAction"); + xout.BreakAttributes(); + xout.Attribute("buildConfiguration", configuration); + xout.Attribute("selectedDebuggerIdentifier", + "Xcode.DebuggerFoundation.Debugger.LLDB"); + xout.Attribute("selectedLauncherIdentifier", + "Xcode.DebuggerFoundation.Launcher.LLDB"); + xout.Attribute("shouldUseLaunchSchemeArgsEnv", "YES"); + + xout.StartElement("Testables"); + xout.EndElement(); + + xout.StartElement("AdditionalOptions"); + xout.EndElement(); + + xout.EndElement(); // TestAction +} + +void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout, + std::string configuration, + const std::string& container) +{ + xout.StartElement("LaunchAction"); + xout.BreakAttributes(); + xout.Attribute("buildConfiguration", configuration); + xout.Attribute("selectedDebuggerIdentifier", + "Xcode.DebuggerFoundation.Debugger.LLDB"); + xout.Attribute("selectedLauncherIdentifier", + "Xcode.DebuggerFoundation.Launcher.LLDB"); + xout.Attribute("launchStyle", "0"); + xout.Attribute("useCustomWorkingDirectory", "NO"); + xout.Attribute("ignoresPersistentStateOnLaunch", "NO"); + xout.Attribute("debugDocumentVersioning", "YES"); + xout.Attribute("debugServiceExtension", "internal"); + xout.Attribute("allowLocationSimulation", "YES"); + + if (IsExecutable(this->Target)) { + xout.StartElement("BuildableProductRunnable"); + xout.BreakAttributes(); + xout.Attribute("runnableDebuggingMode", "0"); + + } else { + xout.StartElement("MacroExpansion"); + } + + xout.StartElement("BuildableReference"); + xout.BreakAttributes(); + xout.Attribute("BuildableIdentifier", "primary"); + xout.Attribute("BlueprintIdentifier", this->TargetId); + xout.Attribute("BuildableName", this->BuildableName); + xout.Attribute("BlueprintName", this->TargetName); + xout.Attribute("ReferencedContainer", "container:" + container); + xout.EndElement(); + + xout.EndElement(); // MacroExpansion + + xout.StartElement("AdditionalOptions"); + xout.EndElement(); + + xout.EndElement(); // LaunchAction +} + +void cmXCodeScheme::WriteProfileAction(cmXMLWriter& xout, + std::string configuration) +{ + xout.StartElement("ProfileAction"); + xout.BreakAttributes(); + xout.Attribute("buildConfiguration", configuration); + xout.Attribute("shouldUseLaunchSchemeArgsEnv", "YES"); + xout.Attribute("savedToolIdentifier", ""); + xout.Attribute("useCustomWorkingDirectory", "NO"); + xout.Attribute("debugDocumentVersioning", "YES"); + xout.EndElement(); +} + +void cmXCodeScheme::WriteAnalyzeAction(cmXMLWriter& xout, + std::string configuration) +{ + xout.StartElement("AnalyzeAction"); + xout.BreakAttributes(); + xout.Attribute("buildConfiguration", configuration); + xout.EndElement(); +} + +void cmXCodeScheme::WriteArchiveAction(cmXMLWriter& xout, + std::string configuration) +{ + xout.StartElement("ArchiveAction"); + xout.BreakAttributes(); + xout.Attribute("buildConfiguration", configuration); + xout.Attribute("revealArchiveInOrganizer", "YES"); + xout.EndElement(); +} + +std::string cmXCodeScheme::WriteVersionString() +{ + std::ostringstream v; + v << std::setfill('0') << std::setw(4) << this->XcodeVersion * 10; + return v.str(); +} + +std::string cmXCodeScheme::FindConfiguration(const std::string& name) +{ + // Try to find the desired configuration by name, + // and if it's not found return first from the list + // + if (std::find(this->ConfigList.begin(), this->ConfigList.end(), name) == + this->ConfigList.end() && + this->ConfigList.size() > 0) + return this->ConfigList[0]; + + return name; +} + +bool cmXCodeScheme::IsExecutable(const cmXCodeObject* target) +{ + cmGeneratorTarget* gt = target->GetTarget(); + if (!gt) { + cmSystemTools::Error("Error no target on xobject\n"); + return false; + } + + return gt->GetType() == cmStateEnums::EXECUTABLE; +} diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h new file mode 100644 index 0000000..0a8e737 --- /dev/null +++ b/Source/cmXCodeScheme.h @@ -0,0 +1,50 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmXCodeScheme_h +#define cmXCodeScheme_h + +#include <cmConfigure.h> // IWYU pragma: keep + +#include "cmGlobalXCodeGenerator.h" +#include "cmSystemTools.h" +#include "cmXCodeObject.h" +#include "cmXMLWriter.h" + +/** \class cmXCodeScheme + * \brief Write shared schemes for native targets in Xcode project. + */ +class cmXCodeScheme +{ +public: + cmXCodeScheme(cmXCodeObject* xcObj, + const std::vector<std::string>& configList, + unsigned int xcVersion); + + void WriteXCodeSharedScheme(const std::string& xcProjDir, + const std::string& container); + +private: + const cmXCodeObject* const Target; + const std::string& TargetName; + const std::string BuildableName; + const std::string& TargetId; + const std::vector<std::string>& ConfigList; + const unsigned int XcodeVersion; + + void WriteXCodeXCScheme(std::ostream& fout, const std::string& container); + + void WriteBuildAction(cmXMLWriter& xout, const std::string& container); + void WriteTestAction(cmXMLWriter& xout, std::string configuration); + void WriteLaunchAction(cmXMLWriter& xout, std::string configuration, + const std::string& container); + void WriteProfileAction(cmXMLWriter& xout, std::string configuration); + void WriteAnalyzeAction(cmXMLWriter& xout, std::string configuration); + void WriteArchiveAction(cmXMLWriter& xout, std::string configuration); + + std::string WriteVersionString(); + std::string FindConfiguration(const std::string& name); + + static bool IsExecutable(const cmXCodeObject* target); +}; + +#endif diff --git a/Source/cmXMLWriter.cxx b/Source/cmXMLWriter.cxx index 2f50fe9..541cb3d 100644 --- a/Source/cmXMLWriter.cxx +++ b/Source/cmXMLWriter.cxx @@ -7,6 +7,7 @@ cmXMLWriter::cmXMLWriter(std::ostream& output, std::size_t level) : Output(output) + , IndentationElement(1, '\t') , Level(level) , ElementOpen(false) , BreakAttrib(false) @@ -100,10 +101,18 @@ void cmXMLWriter::FragmentFile(const char* fname) this->Output << fin.rdbuf(); } +void cmXMLWriter::SetIndentationElement(std::string const& element) +{ + this->IndentationElement = element; +} + void cmXMLWriter::ConditionalLineBreak(bool condition, std::size_t indent) { if (condition) { - this->Output << '\n' << std::string(indent + this->Level, '\t'); + this->Output << '\n'; + for (std::size_t i = 0; i < indent + this->Level; ++i) { + this->Output << this->IndentationElement; + } } } diff --git a/Source/cmXMLWriter.h b/Source/cmXMLWriter.h index 904f73b..6d1e6b4 100644 --- a/Source/cmXMLWriter.h +++ b/Source/cmXMLWriter.h @@ -60,6 +60,8 @@ public: void FragmentFile(const char* fname); + void SetIndentationElement(std::string const& element); + private: cmXMLWriter(const cmXMLWriter&); cmXMLWriter& operator=(const cmXMLWriter&); @@ -107,6 +109,7 @@ private: private: std::ostream& Output; std::stack<std::string, std::vector<std::string> > Elements; + std::string IndentationElement; std::size_t Level; bool ElementOpen; bool BreakAttrib; diff --git a/Source/cm_sys_stat.h b/Source/cm_sys_stat.h new file mode 100644 index 0000000..26e4baa --- /dev/null +++ b/Source/cm_sys_stat.h @@ -0,0 +1,14 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cm_sys_stat_h +#define cm_sys_stat_h + +#if defined(_MSC_VER) +typedef unsigned short mode_t; +#endif + +#include <sys/types.h> +// include sys/stat.h after sys/types.h +#include <sys/stat.h> + +#endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 6141f50..4363c12 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -23,7 +23,9 @@ #include "cmTargetLinkLibraryType.h" #include "cmUtils.hxx" #include "cmVersionConfig.h" +#include "cmWorkingDirectory.h" #include "cm_auto_ptr.hxx" +#include "cm_sys_stat.h" #if defined(CMAKE_BUILD_WITH_CMAKE) #include <cm_jsoncpp_writer.h> @@ -105,10 +107,6 @@ #include <sys/time.h> #endif -#include <sys/types.h> -// include sys/stat.h after sys/types.h -#include <sys/stat.h> // struct stat - #include <algorithm> #include <cmsys/FStream.hxx> #include <cmsys/Glob.hxx> @@ -120,8 +118,6 @@ #include <string.h> #include <utility> -class cmCommand; - namespace { #if defined(CMAKE_BUILD_WITH_CMAKE) @@ -179,7 +175,8 @@ cmake::cmake() this->AddDefaultGenerators(); this->AddDefaultExtraGenerators(); - this->AddDefaultCommands(); + this->AddScriptingCommands(); + this->AddProjectCommands(); // Make sure we can capture the build tool output. cmSystemTools::EnableVSConsoleOutput(); @@ -1654,13 +1651,14 @@ const char* cmake::GetCacheDefinition(const std::string& name) const return this->State->GetInitializedCacheValue(name); } -void cmake::AddDefaultCommands() +void cmake::AddScriptingCommands() { - std::vector<cmCommand*> const commands = GetPredefinedCommands(); - for (std::vector<cmCommand*>::const_iterator i = commands.begin(); - i != commands.end(); ++i) { - this->State->AddCommand(*i); - } + GetScriptingCommands(this->State); +} + +void cmake::AddProjectCommands() +{ + GetProjectCommands(this->State); } void cmake::AddDefaultGenerators() @@ -2199,24 +2197,23 @@ int cmake::GetSystemInformation(std::vector<std::string>& args) resultFile += "/__cmake_systeminformation/results.txt"; } - // now run cmake on the CMakeLists file - cmSystemTools::ChangeDirectory(destPath); - std::vector<std::string> args2; - args2.push_back(args[0]); - args2.push_back(destPath); - std::string resultArg = "-DRESULT_FILE="; - resultArg += resultFile; - args2.push_back(resultArg); - int res = this->Run(args2, false); + { + // now run cmake on the CMakeLists file + cmWorkingDirectory workdir(destPath); + std::vector<std::string> args2; + args2.push_back(args[0]); + args2.push_back(destPath); + std::string resultArg = "-DRESULT_FILE="; + resultArg += resultFile; + args2.push_back(resultArg); + int res = this->Run(args2, false); - if (res != 0) { - std::cerr << "Error: --system-information failed on internal CMake!\n"; - return res; + if (res != 0) { + std::cerr << "Error: --system-information failed on internal CMake!\n"; + return res; + } } - // change back to the original directory - cmSystemTools::ChangeDirectory(cwd); - // echo results to stdout if needed if (writeToStdout) { FILE* fin = cmsys::SystemTools::Fopen(resultFile, "r"); diff --git a/Source/cmake.h b/Source/cmake.h index 5347745..abb13ac 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -425,7 +425,8 @@ protected: typedef std::vector<cmExternalMakefileProjectGeneratorFactory*> RegisteredExtraGeneratorsVector; RegisteredExtraGeneratorsVector ExtraGenerators; - void AddDefaultCommands(); + void AddScriptingCommands(); + void AddProjectCommands(); void AddDefaultGenerators(); void AddDefaultExtraGenerators(); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index b8e227f..805a9f7 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -1,11 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -// include these first, otherwise there will be problems on Windows -// with GetCurrentDirectory() being redefined -#ifdef CMAKE_BUILD_WITH_CMAKE -#include "cmDocumentation.h" -#include "cmDynamicLoader.h" -#endif +#include <cmConfigure.h> #include "cmAlgorithms.h" #include "cmDocumentationEntry.h" @@ -17,7 +12,11 @@ #include "cmake.h" #include "cmcmd.h" -#include <cmConfigure.h> +#ifdef CMAKE_BUILD_WITH_CMAKE +#include "cmDocumentation.h" +#include "cmDynamicLoader.h" +#endif + #include <cmsys/Encoding.hxx> #if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE) #include <cmsys/ConsoleBuf.hxx> diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 823b38f..9e08b9c 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -258,11 +258,18 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) << "\n"; return 1; } - std::string objfile; + std::string file; bindexplib deffile; - while (cmSystemTools::GetLineFromStream(fin, objfile)) { - if (!deffile.AddObjectFile(objfile.c_str())) { - return 1; + while (cmSystemTools::GetLineFromStream(fin, file)) { + std::string const& ext = cmSystemTools::GetFilenameLastExtension(file); + if (cmSystemTools::LowerCase(ext) == ".def") { + if (!deffile.AddDefinitionFile(file.c_str())) { + return 1; + } + } else { + if (!deffile.AddObjectFile(file.c_str())) { + return 1; + } } } deffile.WriteFile(fout); diff --git a/Source/kwsys/.gitattributes b/Source/kwsys/.gitattributes index a121ad1..3583f39 100644 --- a/Source/kwsys/.gitattributes +++ b/Source/kwsys/.gitattributes @@ -1,12 +1,15 @@ .git* export-ignore -*.c whitespace=tab-in-indent,no-lf-at-eof -*.h whitespace=tab-in-indent,no-lf-at-eof -*.h.in whitespace=tab-in-indent,no-lf-at-eof -*.cxx whitespace=tab-in-indent,no-lf-at-eof -*.hxx whitespace=tab-in-indent,no-lf-at-eof -*.hxx.in whitespace=tab-in-indent,no-lf-at-eof -*.txt whitespace=tab-in-indent,no-lf-at-eof -*.cmake whitespace=tab-in-indent,no-lf-at-eof +*.c our-c-style +*.c.in our-c-style +*.cxx our-c-style +*.h our-c-style +*.h.in our-c-style +*.hxx our-c-style +*.hxx.in our-c-style +*.cmake whitespace=tab-in-indent *.rst whitespace=tab-in-indent conflict-marker-size=79 +*.txt whitespace=tab-in-indent + +* -format.clang-format diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index d4fe8a7..de68118 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -946,7 +946,7 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) testConsoleBuf ) IF("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC" AND - NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.0") + CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "19.0.23506") set_property(SOURCE testConsoleBuf.cxx testConsoleBufChild.cxx PROPERTY COMPILE_FLAGS /utf-8) ENDIF() SET_PROPERTY(SOURCE testConsoleBuf.cxx APPEND PROPERTY COMPILE_DEFINITIONS diff --git a/Source/kwsys/ConsoleBuf.hxx.in b/Source/kwsys/ConsoleBuf.hxx.in index cb58865..32e680c 100644 --- a/Source/kwsys/ConsoleBuf.hxx.in +++ b/Source/kwsys/ConsoleBuf.hxx.in @@ -25,8 +25,7 @@ namespace @KWSYS_NAMESPACE@ { #if defined(_WIN32) template <class CharT, class Traits = std::char_traits<CharT> > -class @KWSYS_NAMESPACE@_EXPORT BasicConsoleBuf - : public std::basic_streambuf<CharT, Traits> +class BasicConsoleBuf : public std::basic_streambuf<CharT, Traits> { public: typedef typename Traits::int_type int_type; diff --git a/Source/kwsys/Encoding.hxx.in b/Source/kwsys/Encoding.hxx.in index 6639efd..bf93f50 100644 --- a/Source/kwsys/Encoding.hxx.in +++ b/Source/kwsys/Encoding.hxx.in @@ -13,7 +13,7 @@ class @KWSYS_NAMESPACE@_EXPORT Encoding { public: // Container class for argc/argv. - class CommandLineArguments + class @KWSYS_NAMESPACE@_EXPORT CommandLineArguments { public: // On Windows, get the program command line arguments diff --git a/Source/kwsys/FStream.hxx.in b/Source/kwsys/FStream.hxx.in index 736214f..d4bc6c9 100644 --- a/Source/kwsys/FStream.hxx.in +++ b/Source/kwsys/FStream.hxx.in @@ -170,8 +170,6 @@ template <typename CharType, typename Traits = std::char_traits<CharType> > class basic_ifstream : public std::basic_istream<CharType, Traits>, public basic_efilebuf<CharType, Traits> { - using basic_efilebuf<CharType, Traits>::is_open; - public: typedef typename basic_efilebuf<CharType, Traits>::internal_buffer_type internal_buffer_type; @@ -201,6 +199,8 @@ public: void close() { this->_set_state(this->_close(), this, this); } + using basic_efilebuf<CharType, Traits>::is_open; + internal_buffer_type* rdbuf() const { return this->buf_; } ~basic_ifstream() @KWSYS_NAMESPACE@_FStream_NOEXCEPT { close(); } @@ -269,7 +269,7 @@ enum BOM // If a BOM exists, the stream is advanced to after the BOM. // This function requires a seekable stream (but not a relative // seekable stream). -BOM ReadBOM(std::istream& in); +@KWSYS_NAMESPACE@_EXPORT BOM ReadBOM(std::istream& in); } } diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index e01dcd7..93312e9 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -35,8 +35,13 @@ #include "SystemInformation.hxx.in" #endif +#include <algorithm> +#include <bitset> +#include <cassert> #include <fstream> #include <iostream> +#include <limits> +#include <set> #include <sstream> #include <string> #include <vector> @@ -394,7 +399,6 @@ public: bool SupportsMP; bool HasMMXPlus; bool HasSSEMMX; - bool SupportsHyperthreading; unsigned int LogicalProcessorsPerPhysical; int APIC_ID; CPUPowerManagement PowerManagement; @@ -463,10 +467,9 @@ protected: unsigned int NumberOfLogicalCPU; unsigned int NumberOfPhysicalCPU; - int CPUCount(); // For windows - unsigned char LogicalCPUPerPhysicalCPU(); + void CPUCountWindows(); // For windows unsigned char GetAPICId(); // For windows - bool IsHyperThreadingSupported(); + bool IsSMTSupported(); static LongLong GetCyclesDifference(DELAY_FUNC, unsigned int); // For windows // For Linux and Cygwin, /proc/cpuinfo formats are slightly different @@ -536,6 +539,7 @@ protected: std::string OSRelease; std::string OSVersion; std::string OSPlatform; + bool OSIs64Bit; }; SystemInformation::SystemInformation() @@ -1496,6 +1500,7 @@ SystemInformationImplementation::SystemInformationImplementation() this->OSRelease = ""; this->OSVersion = ""; this->OSPlatform = ""; + this->OSIs64Bit = (sizeof(void*) == 8); } SystemInformationImplementation::~SystemInformationImplementation() @@ -1542,7 +1547,7 @@ void SystemInformationImplementation::RunCPUCheck() RetrieveProcessorSerialNumber(); } - this->CPUCount(); + this->CPUCountWindows(); #elif defined(__APPLE__) this->ParseSysCtl(); @@ -2090,16 +2095,10 @@ bool SystemInformationImplementation::RetrieveCPUFeatures() // Retrieve Intel specific extended features. if (this->ChipManufacturer == Intel) { - this->Features.ExtendedFeatures.SupportsHyperthreading = - ((cpuinfo[3] & 0x10000000) != - 0); // Intel specific: Hyperthreading --> Bit 28 - this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical = - (this->Features.ExtendedFeatures.SupportsHyperthreading) - ? ((cpuinfo[1] & 0x00FF0000) >> 16) - : 1; - - if ((this->Features.ExtendedFeatures.SupportsHyperthreading) && - (this->Features.HasAPIC)) { + bool SupportsSMT = + ((cpuinfo[3] & 0x10000000) != 0); // Intel specific: SMT --> Bit 28 + + if ((SupportsSMT) && (this->Features.HasAPIC)) { // Retrieve APIC information if there is one present. this->Features.ExtendedFeatures.APIC_ID = ((cpuinfo[1] & 0xFF000000) >> 24); @@ -3401,7 +3400,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() fclose(fd); buffer.resize(fileSize - 2); // Number of logical CPUs (combination of multiple processors, multi-core - // and hyperthreading) + // and SMT) size_t pos = buffer.find("processor\t"); while (pos != buffer.npos) { this->NumberOfLogicalCPU++; @@ -3409,30 +3408,25 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() } #ifdef __linux - // Find the largest physical id. - int maxId = -1; + // Count sockets. + std::set<int> PhysicalIDs; std::string idc = this->ExtractValueFromCpuInfoFile(buffer, "physical id"); while (this->CurrentPositionInFile != buffer.npos) { int id = atoi(idc.c_str()); - if (id > maxId) { - maxId = id; - } + PhysicalIDs.insert(id); idc = this->ExtractValueFromCpuInfoFile(buffer, "physical id", this->CurrentPositionInFile + 1); } + uint64_t NumberOfSockets = PhysicalIDs.size(); + NumberOfSockets = std::max(NumberOfSockets, (uint64_t)1); // Physical ids returned by Linux don't distinguish cores. // We want to record the total number of cores in this->NumberOfPhysicalCPU // (checking only the first proc) - std::string cores = this->ExtractValueFromCpuInfoFile(buffer, "cpu cores"); - int numberOfCoresPerCPU = atoi(cores.c_str()); - if (maxId > 0) { - this->NumberOfPhysicalCPU = - static_cast<unsigned int>(numberOfCoresPerCPU * (maxId + 1)); - } else { - // Linux Sparc: get cpu count - this->NumberOfPhysicalCPU = - atoi(this->ExtractValueFromCpuInfoFile(buffer, "ncpus active").c_str()); - } + std::string Cores = this->ExtractValueFromCpuInfoFile(buffer, "cpu cores"); + unsigned int NumberOfCoresPerSocket = (unsigned int)atoi(Cores.c_str()); + NumberOfCoresPerSocket = std::max(NumberOfCoresPerSocket, 1u); + this->NumberOfPhysicalCPU = + NumberOfCoresPerSocket * (unsigned int)NumberOfSockets; #else // __CYGWIN__ // does not have "physical id" entries, neither "cpu cores" @@ -3447,7 +3441,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() if (this->NumberOfPhysicalCPU <= 0) { this->NumberOfPhysicalCPU = 1; } - // LogicalProcessorsPerPhysical>1 => hyperthreading. + // LogicalProcessorsPerPhysical>1 => SMT. this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical = this->NumberOfLogicalCPU / this->NumberOfPhysicalCPU; @@ -4322,68 +4316,10 @@ void SystemInformationImplementation::DelayOverhead(unsigned int uiMS) (void)uiMS; } -/** Return the number of logical CPU per physical CPUs Works only for windows - */ -unsigned char SystemInformationImplementation::LogicalCPUPerPhysicalCPU(void) -{ -#ifdef __APPLE__ - size_t len = 4; - int cores_per_package = 0; - int err = sysctlbyname("machdep.cpu.cores_per_package", &cores_per_package, - &len, NULL, 0); - if (err != 0) { - return 1; // That name was not found, default to 1 - } - return static_cast<unsigned char>(cores_per_package); -#else - int Regs[4] = { 0, 0, 0, 0 }; -#if USE_CPUID - if (!this->IsHyperThreadingSupported()) { - return static_cast<unsigned char>(1); // HT not supported - } - call_cpuid(1, Regs); -#endif - return static_cast<unsigned char>((Regs[1] & NUM_LOGICAL_BITS) >> 16); -#endif -} - /** Works only for windows */ -bool SystemInformationImplementation::IsHyperThreadingSupported() +bool SystemInformationImplementation::IsSMTSupported() { - if (this->Features.ExtendedFeatures.SupportsHyperthreading) { - return true; - } - -#if USE_CPUID - int Regs[4] = { 0, 0, 0, 0 }, VendorId[4] = { 0, 0, 0, 0 }; - // Get vendor id string - if (!call_cpuid(0, VendorId)) { - return false; - } - // eax contains family processor type - // edx has info about the availability of hyper-Threading - if (!call_cpuid(1, Regs)) { - return false; - } - - if (((Regs[0] & FAMILY_ID) == PENTIUM4_ID) || (Regs[0] & EXT_FAMILY_ID)) { - if (VendorId[1] == 0x756e6547) // 'uneG' - { - if (VendorId[3] == 0x49656e69) // 'Ieni' - { - if (VendorId[2] == 0x6c65746e) // 'letn' - { - // Genuine Intel with hyper-Threading technology - this->Features.ExtendedFeatures.SupportsHyperthreading = - ((Regs[3] & HT_BIT) != 0); - return this->Features.ExtendedFeatures.SupportsHyperthreading; - } - } - } - } -#endif - - return 0; // Not genuine Intel processor + return this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical > 1; } /** Return the APIC Id. Works only for windows. */ @@ -4392,7 +4328,7 @@ unsigned char SystemInformationImplementation::GetAPICId() int Regs[4] = { 0, 0, 0, 0 }; #if USE_CPUID - if (!this->IsHyperThreadingSupported()) { + if (!this->IsSMTSupported()) { return static_cast<unsigned char>(-1); // HT not supported } // Logical processor = 1 call_cpuid(1, Regs); @@ -4402,102 +4338,46 @@ unsigned char SystemInformationImplementation::GetAPICId() } /** Count the number of CPUs. Works only on windows. */ -int SystemInformationImplementation::CPUCount() +void SystemInformationImplementation::CPUCountWindows() { #if defined(_WIN32) - unsigned char StatusFlag = 0; - SYSTEM_INFO info; - + std::vector<SYSTEM_LOGICAL_PROCESSOR_INFORMATION> ProcInfo; this->NumberOfPhysicalCPU = 0; this->NumberOfLogicalCPU = 0; - info.dwNumberOfProcessors = 0; - GetSystemInfo(&info); - - // Number of physical processors in a non-Intel system - // or in a 32-bit Intel system with Hyper-Threading technology disabled - this->NumberOfPhysicalCPU = (unsigned char)info.dwNumberOfProcessors; - - if (this->IsHyperThreadingSupported()) { - unsigned char HT_Enabled = 0; - this->NumberOfLogicalCPU = this->LogicalCPUPerPhysicalCPU(); - if (this->NumberOfLogicalCPU >= - 1) // >1 Doesn't mean HT is enabled in the BIOS - { - HANDLE hCurrentProcessHandle; -#ifndef _WIN64 -#define DWORD_PTR DWORD -#endif - DWORD_PTR dwProcessAffinity; - DWORD_PTR dwSystemAffinity; - DWORD dwAffinityMask; - - // Calculate the appropriate shifts and mask based on the - // number of logical processors. - unsigned int i = 1; - unsigned char PHY_ID_MASK = 0xFF; - // unsigned char PHY_ID_SHIFT = 0; - - while (i < this->NumberOfLogicalCPU) { - i *= 2; - PHY_ID_MASK <<= 1; - // PHY_ID_SHIFT++; - } - - hCurrentProcessHandle = GetCurrentProcess(); - GetProcessAffinityMask(hCurrentProcessHandle, &dwProcessAffinity, - &dwSystemAffinity); - - // Check if available process affinity mask is equal to the - // available system affinity mask - if (dwProcessAffinity != dwSystemAffinity) { - StatusFlag = HT_CANNOT_DETECT; - this->NumberOfPhysicalCPU = (unsigned char)-1; - return StatusFlag; - } - - dwAffinityMask = 1; - while (dwAffinityMask != 0 && dwAffinityMask <= dwProcessAffinity) { - // Check if this CPU is available - if (dwAffinityMask & dwProcessAffinity) { - if (SetProcessAffinityMask(hCurrentProcessHandle, dwAffinityMask)) { - unsigned char APIC_ID, LOG_ID; - Sleep(0); // Give OS time to switch CPU - APIC_ID = GetAPICId(); - LOG_ID = APIC_ID & ~PHY_ID_MASK; - - if (LOG_ID != 0) { - HT_Enabled = 1; - } - } - } - dwAffinityMask = dwAffinityMask << 1; - } - // Reset the processor affinity - SetProcessAffinityMask(hCurrentProcessHandle, dwProcessAffinity); + { + DWORD Length = 0; + DWORD rc = GetLogicalProcessorInformation(NULL, &Length); + assert(FALSE == rc); + (void)rc; // Silence unused variable warning in Borland C++ 5.81 + assert(GetLastError() == ERROR_INSUFFICIENT_BUFFER); + ProcInfo.resize(Length / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION)); + rc = GetLogicalProcessorInformation(&ProcInfo[0], &Length); + assert(rc != FALSE); + (void)rc; // Silence unused variable warning in Borland C++ 5.81 + } + + typedef std::vector<SYSTEM_LOGICAL_PROCESSOR_INFORMATION>::iterator + pinfoIt_t; + for (pinfoIt_t it = ProcInfo.begin(); it != ProcInfo.end(); ++it) { + SYSTEM_LOGICAL_PROCESSOR_INFORMATION PInfo = *it; + if (PInfo.Relationship != RelationProcessorCore) { + continue; + } - if (this->NumberOfLogicalCPU == - 1) // Normal P4 : HT is disabled in hardware - { - StatusFlag = HT_DISABLED; - } else { - if (HT_Enabled) { - // Total physical processors in a Hyper-Threading enabled system. - this->NumberOfPhysicalCPU /= (this->NumberOfLogicalCPU); - StatusFlag = HT_ENABLED; - } else { - StatusFlag = HT_SUPPORTED_NOT_ENABLED; - } - } + std::bitset<std::numeric_limits<ULONG_PTR>::digits> ProcMask( + (unsigned long long)PInfo.ProcessorMask); + unsigned int count = (unsigned int)ProcMask.count(); + if (count == 0) { // I think this should never happen, but just to be safe. + continue; } - } else { - // Processors do not have Hyper-Threading technology - StatusFlag = HT_NOT_CAPABLE; - this->NumberOfLogicalCPU = 1; + this->NumberOfPhysicalCPU++; + this->NumberOfLogicalCPU += (unsigned int)count; + this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical = count; } - return StatusFlag; + this->NumberOfPhysicalCPU = std::max(1u, this->NumberOfPhysicalCPU); + this->NumberOfLogicalCPU = std::max(1u, this->NumberOfLogicalCPU); #else - return 0; #endif } @@ -4559,8 +4439,14 @@ bool SystemInformationImplementation::ParseSysCtl() sysctlbyname("hw.physicalcpu", &this->NumberOfPhysicalCPU, &len, NULL, 0); len = sizeof(this->NumberOfLogicalCPU); sysctlbyname("hw.logicalcpu", &this->NumberOfLogicalCPU, &len, NULL, 0); + + int cores_per_package = 0; + len = sizeof(cores_per_package); + err = sysctlbyname("machdep.cpu.cores_per_package", &cores_per_package, &len, + NULL, 0); + // That name was not found, default to 1 this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical = - this->LogicalCPUPerPhysicalCPU(); + err != 0 ? 1 : static_cast<unsigned char>(cores_per_package); len = sizeof(value); sysctlbyname("hw.cpufrequency", &value, &len, NULL, 0); @@ -5436,10 +5322,20 @@ bool SystemInformationImplementation::QueryOSInformation() this->Hostname = name; const char* arch = getenv("PROCESSOR_ARCHITECTURE"); + const char* wow64 = getenv("PROCESSOR_ARCHITEW6432"); if (arch) { this->OSPlatform = arch; } + if (wow64) { + // the PROCESSOR_ARCHITEW6432 is only defined when running 32bit programs + // on 64bit OS + this->OSIs64Bit = true; + } else if (arch) { + // all values other than x86 map to 64bit architectures + this->OSIs64Bit = (strncmp(arch, "x86", 3) != 0); + } + #else struct utsname unameInfo; @@ -5450,6 +5346,12 @@ bool SystemInformationImplementation::QueryOSInformation() this->OSRelease = unameInfo.release; this->OSVersion = unameInfo.version; this->OSPlatform = unameInfo.machine; + + // This is still insufficient to capture 64bit architecture such + // powerpc and possible mips and sparc + if (this->OSPlatform.find_first_of("64") != std::string::npos) { + this->OSIs64Bit = true; + } } #ifdef __APPLE__ @@ -5503,6 +5405,6 @@ void SystemInformationImplementation::TrimNewline(std::string& output) /** Return true if the machine is 64 bits */ bool SystemInformationImplementation::Is64Bits() { - return (sizeof(void*) == 8); + return this->OSIs64Bit; } } diff --git a/Source/kwsys/SystemInformation.hxx.in b/Source/kwsys/SystemInformation.hxx.in index 0fc1067..54e7fc1 100644 --- a/Source/kwsys/SystemInformation.hxx.in +++ b/Source/kwsys/SystemInformation.hxx.in @@ -65,9 +65,10 @@ public: // on this system. std::string GetOSDescription(); + // returns if the operating system is 64bit or not. bool Is64Bits(); - unsigned int GetNumberOfLogicalCPU(); // per physical cpu + unsigned int GetNumberOfLogicalCPU(); unsigned int GetNumberOfPhysicalCPU(); bool DoesCPUSupportCPUID(); diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 97dd4ae..65b7b26 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -3067,6 +3067,28 @@ bool SystemTools::FileIsSymlink(const std::string& name) #endif } +bool SystemTools::FileIsFIFO(const std::string& name) +{ +#if defined(_WIN32) + HANDLE hFile = + CreateFileW(Encoding::ToWide(name).c_str(), GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + if (hFile == INVALID_HANDLE_VALUE) { + return false; + } + const DWORD type = GetFileType(hFile); + CloseHandle(hFile); + return type == FILE_TYPE_PIPE; +#else + struct stat fs; + if (lstat(name.c_str(), &fs) == 0) { + return S_ISFIFO(fs.st_mode); + } else { + return false; + } +#endif +} + #if defined(_WIN32) && !defined(__CYGWIN__) bool SystemTools::CreateSymlink(const std::string&, const std::string&) { @@ -3309,7 +3331,7 @@ std::string SystemTools::CollapseFullPath(const std::string& in_path, SystemTools::SplitPath(in_path, path_components); // If the input path is relative, start with a base path. - if (path_components[0].length() == 0) { + if (path_components[0].empty()) { std::vector<std::string> base_components; if (in_base) { // Use the given base path. diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index f3d06fe..7a5256b 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -654,6 +654,11 @@ public: static bool FileIsSymlink(const std::string& name); /** + * Return true if the file is a FIFO + */ + static bool FileIsFIFO(const std::string& name); + + /** * Return true if the file has a given signature (first set of bytes) */ static bool FileHasSignature(const char* filename, const char* signature, diff --git a/Source/kwsys/testSystemInformation.cxx b/Source/kwsys/testSystemInformation.cxx index 86a1e1e..3a9217f 100644 --- a/Source/kwsys/testSystemInformation.cxx +++ b/Source/kwsys/testSystemInformation.cxx @@ -52,6 +52,7 @@ int testSystemInformation(int, char* []) printMethod(info, GetOSRelease); printMethod(info, GetOSVersion); printMethod(info, GetOSPlatform); + printMethod(info, Is64Bits); printMethod(info, GetVendorString); printMethod(info, GetVendorID); printMethod(info, GetTypeID); @@ -63,7 +64,6 @@ int testSystemInformation(int, char* []) printMethod2(info, GetProcessorCacheSize, "KB"); printMethod(info, GetLogicalProcessorsPerPhysical); printMethod2(info, GetProcessorClockFrequency, "MHz"); - printMethod(info, Is64Bits); printMethod(info, GetNumberOfLogicalCPU); printMethod(info, GetNumberOfPhysicalCPU); printMethod(info, DoesCPUSupportCPUID); |