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

Conversation

hannes-steffenhagen-diffblue
Copy link
Contributor

@hannes-steffenhagen-diffblue hannes-steffenhagen-diffblue commented May 21, 2019

Previously this check would just lead to a silent return when
trying to output an empty XML document. As per the comment this is
actually an error.

Also fixes one instance where this function was used incorrectly in
goto-analyzer.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

Previously this check would just lead to a silent return when
trying to output an empty XML document. As per the comment this is
actually an error.

Also fixes one instance where this function was used incorrectly in
goto-analyzer.
@@ -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.

Copy link
Contributor

@chrisr-diffblue chrisr-diffblue left a comment

Choose a reason for hiding this comment

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

Discussed off-line with Hannes. Approving as is.

@tautschnig tautschnig merged commit 2ceb3e3 into diffblue:develop May 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants