Bug 19604 - abidiff --suppressions doesn't complain about invalid file name

* tools/abidiff.cc (maybe_check_suppression_files): Define new
	static function.
	(main): Use it.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2016-02-11 09:26:28 +01:00
parent ef2211831f
commit 2c4efc0c3e

View File

@ -403,6 +403,25 @@ display_symtabs(const corpus_sptr c1, const corpus_sptr c2, ostream& o)
using abigail::comparison::diff_context_sptr;
using abigail::comparison::diff_context;
/// Check that the suppression specification files supplied are
/// present. If not, emit an error on stderr.
///
/// @param opts the options instance to use.
///
/// @return true if all suppression specification files are present,
/// false otherwise.
static bool
maybe_check_suppression_files(const options& opts)
{
for (vector<string>::const_iterator i = opts.suppression_paths.begin();
i != opts.suppression_paths.end();
++i)
if (!check_file(*i, cerr))
return false;
return true;
}
/// Update the diff context from the @ref options data structure.
///
/// @param ctxt the diff context to update.
@ -524,6 +543,10 @@ main(int argc, char* argv[])
return 0;
}
if (!maybe_check_suppression_files(opts))
return (abigail::tools_utils::ABIDIFF_USAGE_ERROR
| abigail::tools_utils::ABIDIFF_ERROR);
abidiff_status status = abigail::tools_utils::ABIDIFF_OK;
if (!opts.file1.empty() && !opts.file2.empty())
{