We previously renamed all occurrences in goto functions, but did not
consider the initial values of symbols with static lifetime, which are
stored in the symbol table. To make this reasonably efficient, make
rename_symbolt::operator() expose the return value (and document the
methods).
To test this, include the test suite in Makefile-based test set-ups
(CMake was already done), and fix the chain.sh file.
Previously, if we compiled a file called
foo/bar/baz/main.c
containing a static function called `qux`, that function's name would be
mangled to
__CPROVER_file_local_foo_bar_baz_main_c_qux
This commit changes the behaviour so that only the basename is used to
mangle the function name:
__CPROVER_file_local_main_c_qux
This is so that users writing CBMC proofs for file-local functions don't
have to worry about where the goto-binary was compiled.
This switch makes goto-cc do three things:
- retain the implementations of all static functions.
- mangle the names of all static functions.
- unset the file_local flag on all static function symbols.
This feature is intended to help users writing CBMC checks for
file-local functions (i.e., those declared as `static` in the C
language). The intended workflow is: compile the code under test with
the -fkeep-static-functions flag. Then link the code under test with
the 'harness' file, again using the flag. This allows the harness to
call into static functions in the codebase under test.