Skip to content

introduce dstringt::starts_with #5488

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
merged 1 commit into from
Jul 28, 2022
Merged

introduce dstringt::starts_with #5488

merged 1 commit into from
Jul 28, 2022

Conversation

kroening
Copy link
Member

@kroening kroening commented Sep 4, 2020

  • 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.
  • n/a 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).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

Copy link
Contributor

@NlightNFotis NlightNFotis left a comment

Choose a reason for hiding this comment

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

There's a weird build failure on Travis, on osx, but aside from that, this is good stuff!

I very much like the readability of this compared to has_prefix. Does it mean that has_prefix is now deprecated? If yes, should it be marked so?

@hannes-steffenhagen-diffblue
Copy link
Contributor

hannes-steffenhagen-diffblue commented Sep 7, 2020

Does that mean we no longer care about being able to swap in std::string for dstringt? No objection to that personally, but if we do that we should also remove USE_STD_STRING (that’d have to happen before this PR because we do actually test if cbmc builds with USE_STD_STRING).

@tautschnig
Copy link
Collaborator

Does that mean we no longer care about being able to swap in std::string for dstringt? No objection to that personally, but if we do that we should also remove USE_STD_STRING (that’d have to happen before this PR because we do actually test if cbmc builds with USE_STD_STRING).

I would believe we maintain full compatibility: with this patch, .starts_with() can be used the same way with dstringt and std::string.

@kroening I'd +1 the suggestion to deprecate has_prefix, and in a lot of files the #include <util/prefix.h> should be removed.

@kroening
Copy link
Member Author

kroening commented Nov 7, 2020

We can either wait for C++20 (which adds .starts_with() to std::string) or remove USE_STD_STRING.

@kroening kroening force-pushed the dstring_starts_with branch from 5788edf to e5d77fd Compare November 7, 2020 11:45
@codecov
Copy link

codecov bot commented Nov 7, 2020

Codecov Report

Merging #5488 (e5d77fd) into develop (a1ecd93) will decrease coverage by 9.34%.
The diff coverage is 60.52%.

❗ Current head e5d77fd differs from pull request most recent head f44cac4. Consider uploading reports for the commit f44cac4 to get more accurate results

@@             Coverage Diff             @@
##           develop    #5488      +/-   ##
===========================================
- Coverage    77.88%   68.53%   -9.35%     
===========================================
  Files         1569     1187     -382     
  Lines       180894    98262   -82632     
===========================================
- Hits        140882    67340   -73542     
+ Misses       40012    30922    -9090     
Flag Coverage Δ
cproversmt2 42.96% <53.84%> (?)
regression 65.68% <60.52%> (?)
unit 32.25% <39.34%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/analyses/goto_check.cpp 88.20% <0.00%> (ø)
src/goto-instrument/branch.cpp 0.00% <0.00%> (ø)
src/goto-instrument/function.cpp 0.00% <0.00%> (ø)
src/goto-instrument/race_check.cpp 0.00% <0.00%> (ø)
src/goto-instrument/wmm/shared_buffers.cpp 0.00% <0.00%> (-77.80%) ⬇️
src/goto-programs/show_goto_functions_xml.cpp 0.00% <0.00%> (ø)
src/jsil/jsil_typecheck.cpp 0.00% <0.00%> (ø)
src/goto-programs/graphml_witness.cpp 56.00% <20.00%> (+2.91%) ⬆️
src/ansi-c/c_preprocess.cpp 32.31% <33.33%> (-2.75%) ⬇️
src/goto-instrument/goto_program2code.cpp 65.62% <42.85%> (-3.22%) ⬇️
... and 1615 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 74c7764...f44cac4. Read the comment docs.

This prepares for the transition to C++20, which adds
std::string::starts_with(...).  This will allow us to drop has_prefix(s, t).
@kroening kroening force-pushed the dstring_starts_with branch from e5d77fd to f44cac4 Compare July 28, 2022 19:40
@kroening
Copy link
Member Author

I've dropped the second commit until we do C++20. The first commit is useful in preparation.

@kroening kroening marked this pull request as ready for review July 28, 2022 19:43
@tautschnig tautschnig merged commit beb35ec into develop Jul 28, 2022
@tautschnig tautschnig deleted the dstring_starts_with branch July 28, 2022 21:30
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.

4 participants