Skip to content

C library header de-duplication #6490

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 5 commits into from
Dec 5, 2021

Conversation

tautschnig
Copy link
Collaborator

Please review commit-by-commit: the goal of this PR is spelled out in the last commit in this series (removing duplicate-and-conflicting declarations), and the commits before this one enable this work while making sure library_check.sh remains happy.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a 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.

@codecov
Copy link

codecov bot commented Nov 30, 2021

Codecov Report

Merging #6490 (5295845) into develop (21a6267) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #6490   +/-   ##
========================================
  Coverage    76.10%   76.10%           
========================================
  Files         1548     1548           
  Lines       166326   166326           
========================================
  Hits        126576   126576           
  Misses       39750    39750           

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 fdc7ba5...5295845. Read the comment docs.

@@ -7,6 +7,7 @@ for f in "$@"; do
echo "Checking ${f}"
cp "${f}" __libcheck.c
perl -p -i -e 's/(__builtin_[^v])/s$1/' __libcheck.c
perl -p -i -e 's/s(__builtin_unreachable)/$1/' __libcheck.c
Copy link
Collaborator

Choose a reason for hiding this comment

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

Couldn't you just do this for __CPROVER_assume(0) instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That would be a valid hack, but then it's only __CPROVER_assume(0) that actually makes the code thereafter unreachable, so it's a bit strange perhaps?

Fixes the declaration in builtin_headers.h. Type checking actually
ignored this declaration and would always generate the expression of the
correct type.
Makes GCC happier when doing library validation.

Our C front-end would implicitly generate nondet return values of the
correct type, so this does not actually change any verification
behaviour.
The uninitialised local variable can trip up GCC's validation. Use
a __VERIFIER_nondet_ function as is already done elsewhere.
These calls are wrapped in #ifdef LIBRARY_CHECK and exist for the sole
purpose of making library_check.sh not warn about `noreturn` functions
seemingly returning.
library/cprover.h exists for the sole purpose of syntax-checking the C
library using the system's C compiler. The declarations in there,
however, did not always match those of the authoritative
cprover_builtin_library.h. To avoid this split-brain problem, just
include cprover_builtin_library.h after providing a few declarations
otherwise generated by ansi_c_internal_additions.cpp.
@tautschnig tautschnig merged commit d0c403a into diffblue:develop Dec 5, 2021
@tautschnig tautschnig deleted the c-library-cleanup branch December 5, 2021 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants