diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2016-11-30 20:17:38 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-12-07 13:23:58 (GMT) |
commit | 7731121d66dc2212c67eb9d49840ac846bd00ce7 (patch) | |
tree | a77ba2c0dd2525e06c476266346ed2f3c452bd24 /Source | |
parent | 00750ece6a5dbfd51a8dd789c4d7dc1246f63ec3 (diff) | |
download | CMake-7731121d66dc2212c67eb9d49840ac846bd00ce7.zip CMake-7731121d66dc2212c67eb9d49840ac846bd00ce7.tar.gz CMake-7731121d66dc2212c67eb9d49840ac846bd00ce7.tar.bz2 |
QtAutogen: Improved error handling
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 46 | ||||
-rw-r--r-- | Source/cmQtAutoGenerators.h | 4 |
2 files changed, 32 insertions, 18 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index a6099fa..c6781de 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -515,10 +515,15 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile) this->LogInfo(err.str()); } if (this->MocRelaxedMode) { - this->ParseCppFile(absFilename, headerExtensions, includedMocs, uiFiles); + if (!this->ParseCppFile(absFilename, headerExtensions, includedMocs, + uiFiles)) { + return false; + } } else { - this->StrictParseCppFile(absFilename, headerExtensions, includedMocs, - uiFiles); + if (!this->StrictParseCppFile(absFilename, headerExtensions, + includedMocs, uiFiles)) { + return false; + } } this->SearchHeadersForCppFile(absFilename, headerExtensions, headerFiles); } @@ -568,7 +573,10 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile) return true; } -void cmQtAutoGenerators::ParseCppFile( +/** + * @return True on success + */ +bool cmQtAutoGenerators::ParseCppFile( const std::string& absFilename, const std::vector<std::string>& headerExtensions, std::map<std::string, std::string>& includedMocs, @@ -584,11 +592,11 @@ void cmQtAutoGenerators::ParseCppFile( err << "AUTOGEN: warning: " << absFilename << ": file is empty\n" << std::endl; this->LogWarning(err.str()); - return; + return true; } this->ParseForUic(absFilename, contentsString, includedUis); if (this->MocExecutable.empty()) { - return; + return true; } const std::string absPath = cmsys::SystemTools::GetFilenamePath( @@ -652,7 +660,7 @@ void cmQtAutoGenerators::ParseCppFile( << std::endl; } this->LogError(err.str()); - ::exit(EXIT_FAILURE); + return false; } } else { std::string fileToMoc = absFilename; @@ -700,7 +708,7 @@ void cmQtAutoGenerators::ParseCppFile( "header.\n" << std::endl; this->LogError(err.str()); - ::exit(EXIT_FAILURE); + return false; } } else { dotMocIncluded = true; @@ -744,13 +752,17 @@ void cmQtAutoGenerators::ParseCppFile( << "\"" << scannedFileBasename << ".moc\" !\n" << std::endl; this->LogError(err.str()); - - ::exit(EXIT_FAILURE); + return false; } } + + return true; } -void cmQtAutoGenerators::StrictParseCppFile( +/** + * @return True on success + */ +bool cmQtAutoGenerators::StrictParseCppFile( const std::string& absFilename, const std::vector<std::string>& headerExtensions, std::map<std::string, std::string>& includedMocs, @@ -766,11 +778,11 @@ void cmQtAutoGenerators::StrictParseCppFile( err << "AUTOGEN: warning: " << absFilename << ": file is empty\n" << std::endl; this->LogWarning(err.str()); - return; + return true; } this->ParseForUic(absFilename, contentsString, includedUis); if (this->MocExecutable.empty()) { - return; + return true; } const std::string absPath = cmsys::SystemTools::GetFilenamePath( @@ -823,7 +835,7 @@ void cmQtAutoGenerators::StrictParseCppFile( << std::endl; } this->LogError(err.str()); - ::exit(EXIT_FAILURE); + return false; } } else { if (basename != scannedFileBasename) { @@ -839,7 +851,7 @@ void cmQtAutoGenerators::StrictParseCppFile( "moc on this source file.\n" << std::endl; this->LogError(err.str()); - ::exit(EXIT_FAILURE); + return false; } dotMocIncluded = true; includedMocs[absFilename] = currentMoc; @@ -861,8 +873,10 @@ void cmQtAutoGenerators::StrictParseCppFile( << "\"" << scannedFileBasename << ".moc\" !\n" << std::endl; this->LogError(err.str()); - ::exit(EXIT_FAILURE); + return false; } + + return true; } void cmQtAutoGenerators::ParseForUic( diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index 816c380..99b1fbf 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -43,12 +43,12 @@ private: bool GenerateQrc(const std::string& qrcInputFile, const std::string& qrcOutputFile, bool unique_n); - void ParseCppFile( + bool ParseCppFile( 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); - void StrictParseCppFile( + bool StrictParseCppFile( const std::string& absFilename, const std::vector<std::string>& headerExtensions, std::map<std::string, std::string>& includedMocs, |