@@ -247,7 +247,7 @@ bool CmdLineParser::fillSettingsFromArgs(int argc, const char* const argv[])
247247 std::list<FileWithDetails> filesResolved;
248248 // Execute recursiveAddFiles() to each given file parameter
249249 // TODO: verbose log which files were ignored?
250- const PathMatch matcher (ignored, Path::getCurrentPath ());
250+ PathMatch matcher (ignored, Path::getCurrentPath ());
251251 for (const std::string &pathname : pathnamesRef) {
252252 const std::string err = FileLister::recursiveAddFiles (filesResolved, Path::toNativeSeparators (pathname), mSettings .library .markupExtensions (), matcher, mSettings .debugignore );
253253 if (!err.empty ()) {
@@ -264,6 +264,12 @@ bool CmdLineParser::fillSettingsFromArgs(int argc, const char* const argv[])
264264 return false ;
265265 }
266266
267+ const auto & unmatched = matcher.unmatched ();
268+ if (!unmatched.empty ()) {
269+ mLogger .printError (" unused ignore/exclude path '" + unmatched.front () + " ' to hide warnings in certain files use suppressions instead." );
270+ return false ;
271+ }
272+
267273 std::list<FileWithDetails> files;
268274 if (!mSettings .fileFilters .empty ()) {
269275 files = filterFiles (mSettings .fileFilters , filesResolved);
@@ -1723,12 +1729,16 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
17231729 mPathNames = project.guiProject .pathNames ;
17241730
17251731 if (!project.fileSettings .empty ()) {
1726- project.ignorePaths (mIgnoredPaths , mSettings .debugignore );
1732+ const auto & unmatched = project.ignorePaths (mIgnoredPaths , mSettings .debugignore );
17271733 if (project.fileSettings .empty ()) {
17281734 mLogger .printError (" no C or C++ source files found." );
17291735 mLogger .printMessage (" all paths were ignored" ); // TODO: log this differently?
17301736 return Result::Fail;
17311737 }
1738+ if (!unmatched.empty ()) {
1739+ mLogger .printError (" unused ignore/exclude path '" + unmatched.front () + " ' to hide warnings in certain files use suppressions instead." );
1740+ return Result::Fail;
1741+ }
17321742 mFileSettings = project.fileSettings ;
17331743 }
17341744
0 commit comments