Skip to content

Make check in XML output function a precondition #4682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/goto-analyzer/static_verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static void static_verifier_xml(
{
m.status() << "Writing XML report" << messaget::eom;

xmlt xml_result;
xmlt xml_result{"cprover"};

for(const auto &result : results)
{
Expand Down
3 changes: 1 addition & 2 deletions src/util/xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ void xmlt::output(std::ostream &out, unsigned indent) const
// 'name' needs to be set, or we produce mal-formed
// XML.

if(name.empty())
return;
PRECONDITION(!name.empty());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! - but should this also be an invariant/precondition in the constructor as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That'd make xmlt not default constructible anymore which'd be a bigger change.

I'm also noticing that the xmlt class seems to be limited to a single piece of text content, rather than allowing text and markup to intersperse like normal xml, but that's also a different issue.


do_indent(out, indent);

Expand Down