Skip to content

Commit 622e2e3

Browse files
author
Daniel Kroening
authored
Merge branch 'develop' into show_functions_dfs
2 parents 1fab1c1 + 0e70863 commit 622e2e3

File tree

1,887 files changed

+38133
-57172
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,887 files changed

+38133
-57172
lines changed
File renamed without changes.

.travis.yml

+82-67
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,28 @@
11
language: cpp
22

3-
matrix:
3+
jobs:
44
include:
55

6-
# Alpine Linux with musl-libc using g++
7-
- os: linux
8-
sudo: required
9-
compiler: gcc
10-
cache: ccache
11-
services:
12-
- docker
13-
before_install:
14-
- docker pull diffblue/cbmc-builder:alpine-0.0.1
15-
env:
16-
- PRE_COMMAND="docker run -v ${TRAVIS_BUILD_DIR}:/cbmc -v ${HOME}/.ccache:/root/.ccache diffblue/cbmc-builder:alpine-0.0.1"
17-
- COMPILER="ccache g++"
18-
19-
# OS X using g++
20-
- os: osx
21-
sudo: false
22-
compiler: gcc
23-
cache: ccache
24-
before_install:
25-
#we create symlink to non-ccache gcc, to be used in tests
26-
- mkdir bin ; ln -s /usr/bin/gcc bin/gcc
27-
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
28-
- export PATH=/usr/local/opt/ccache/libexec:$PATH
29-
- ccache -M 1G
30-
env: COMPILER=g++
6+
- &linter-stage
7+
stage: Linter + Doxygen + non-debug Ubuntu/gcc-5 test
8+
env: NAME="CPP-LINT"
9+
install:
10+
script: scripts/travis_lint.sh
11+
before_cache:
3112

32-
# OS X using clang++
33-
- os: osx
34-
sudo: false
35-
compiler: clang
36-
cache: ccache
37-
before_install:
38-
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
39-
- export PATH=/usr/local/opt/ccache/libexec:$PATH
40-
- ccache -M 1G
41-
env:
42-
- COMPILER="ccache clang++ -Qunused-arguments -fcolor-diagnostics"
43-
- CCACHE_CPP2=yes
13+
- stage: Linter + Doxygen + non-debug Ubuntu/gcc-5 test
14+
env: NAME="DOXYGEN-CHECK"
15+
addons:
16+
apt:
17+
packages:
18+
- doxygen
19+
install:
20+
script: scripts/travis_doxygen.sh
21+
before_cache:
4422

4523
# Ubuntu Linux with glibc using g++-5
46-
- os: linux
24+
- stage: Linter + Doxygen + non-debug Ubuntu/gcc-5 test
25+
os: linux
4726
sudo: false
4827
compiler: gcc
4928
cache: ccache
@@ -58,10 +37,11 @@ matrix:
5837
before_install:
5938
- mkdir bin ; ln -s /usr/bin/gcc-5 bin/gcc
6039
# env: COMPILER=g++-5 SAN_FLAGS="-fsanitize=undefined -fno-sanitize-recover -fno-omit-frame-pointer"
61-
env: COMPILER="g++-5"
40+
env: COMPILER="ccache g++-5"
6241

6342
# Ubuntu Linux with glibc using g++-5, debug mode
64-
- os: linux
43+
- stage: Test different OS/CXX/Flags
44+
os: linux
6545
sudo: false
6646
compiler: gcc
6747
cache: ccache
@@ -77,12 +57,13 @@ matrix:
7757
- mkdir bin ; ln -s /usr/bin/gcc-5 bin/gcc
7858
# env: COMPILER=g++-5 SAN_FLAGS="-fsanitize=undefined -fno-sanitize-recover -fno-omit-frame-pointer"
7959
env:
80-
- COMPILER="g++-5"
60+
- COMPILER="ccache g++-5"
8161
- EXTRA_CXXFLAGS="-DDEBUG"
8262
script: echo "Not running any tests for a debug build."
8363

8464
# Ubuntu Linux with glibc using clang++-3.7
85-
- os: linux
65+
- stage: Test different OS/CXX/Flags
66+
os: linux
8667
sudo: false
8768
compiler: clang
8869
cache: ccache
@@ -105,7 +86,8 @@ matrix:
10586
- CCACHE_CPP2=yes
10687

10788
# Ubuntu Linux with glibc using clang++-3.7, debug mode
108-
- os: linux
89+
- stage: Test different OS/CXX/Flags
90+
os: linux
10991
sudo: false
11092
compiler: clang
11193
cache: ccache
@@ -129,41 +111,74 @@ matrix:
129111
- EXTRA_CXXFLAGS="-DDEBUG"
130112
script: echo "Not running any tests for a debug build."
131113

132-
- env: NAME="CPP-LINT"
114+
- stage: Test different OS/CXX/Flags
115+
os: linux
116+
cache: ccache
117+
env:
118+
- BUILD_SYSTEM=cmake
119+
addons:
120+
apt:
121+
sources:
122+
- ubuntu-toolchain-r-test
123+
packages:
124+
- g++-5
133125
install:
134-
script: scripts/travis_lint.sh
135-
before_cache:
126+
- cmake -H. -Bbuild '-DCMAKE_BUILD_TYPE=Release' '-DCMAKE_CXX_COMPILER=g++-5'
127+
- cmake --build build -- -j4
128+
script: (cd build; ctest -V -L CORE)
136129

137-
- env: NAME="DOXYGEN-CHECK"
130+
# Run Coverity
131+
- stage: Test different OS/CXX/Flags
132+
os: linux
133+
sudo: required
134+
compiler: gcc
135+
cache: ccache
138136
addons:
139137
apt:
138+
sources:
139+
- ubuntu-toolchain-r-test
140140
packages:
141-
- doxygen
142-
install:
143-
script: scripts/travis_doxygen.sh
144-
before_cache:
141+
- libwww-perl
142+
- g++-5
143+
coverity_scan:
144+
project:
145+
name: "diffblue/cbmc"
146+
description: "Travis build of ${TRAVIS_COMMIT}"
147+
notification_email: "[email protected]"
148+
build_command_prepend: "make -C src minisat2-download"
149+
build_command: "make -C src -j2"
150+
branch_pattern: "develop"
151+
before_install:
152+
- |
153+
if [[ "${TRAVIS_EVENT_TYPE}" != "cron" ]]
154+
then
155+
echo "This is not a cron build and build is not needed."
156+
travis_terminate 0
157+
fi
158+
- mkdir bin ; ln -s /usr/bin/gcc-5 bin/gcc
159+
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 90
160+
- g++ --version
161+
# Coverity runs as part of before_script
162+
env:
163+
- NAME="COVERITY_SCAN"
164+
- COMPILER="ccache g++"
165+
script: echo "This is coverity build. No need for tests."
145166

146167
allow_failures:
147-
- env: NAME="CPP-LINT"
148-
install:
149-
script: scripts/travis_lint.sh
150-
before_cache:
168+
- <<: *linter-stage
151169

152170
install:
153-
- COMMAND="make -C src minisat2-download" &&
154-
eval ${PRE_COMMAND} ${COMMAND}
155-
- COMMAND="make -C src CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -Werror -pedantic -O2 -g $EXTRA_CXXFLAGS\" -j2" &&
156-
eval ${PRE_COMMAND} ${COMMAND}
157-
- COMMAND="make -C src CXX=\"$COMPILER\" CXXFLAGS=\"$FLAGS $EXTRA_CXXFLAGS\" -j2 clobber.dir memory-models.dir musketeer.dir" &&
158-
eval ${PRE_COMMAND} ${COMMAND}
171+
- ccache --max-size=1G
172+
- make -C src minisat2-download
173+
- make -C src/ansi-c library_check
174+
- make -C src "CXX=${COMPILER}" "CXXFLAGS=-Wall -Werror -pedantic -O2 -g ${EXTRA_CXXFLAGS}" -j2
175+
- make -C src "CXX=${COMPILER}" "CXXFLAGS=-Wall -Werror -pedantic -O2 -g ${EXTRA_CXXFLAGS}" -j2 clobber.dir memory-models.dir
159176

160177
script:
161178
- if [ -e bin/gcc ] ; then export PATH=$PWD/bin:$PATH ; fi ;
162-
COMMAND="env UBSAN_OPTIONS=print_stacktrace=1 make -C regression test CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -Werror -pedantic -O2 -g $EXTRA_CXXFLAGS\"" &&
163-
eval ${PRE_COMMAND} ${COMMAND}
164-
- COMMAND="make -C unit CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -Werror -pedantic -O2 -g $EXTRA_CXXFLAGS\" -j2" &&
165-
eval ${PRE_COMMAND} ${COMMAND}
166-
- COMMAND="make -C unit test" && eval ${PRE_COMMAND} ${COMMAND}
179+
- env UBSAN_OPTIONS=print_stacktrace=1 make -C regression test "CXX=${COMPILER}" "CXXFLAGS=-Wall -Werror -pedantic -O2 -g ${EXTRA_CXXFLAGS}"
180+
- make -C unit "CXX=${COMPILER}" "CXXFLAGS=-Wall -Werror -pedantic -O2 -g ${EXTRA_CXXFLAGS}" -j2
181+
- make -C unit test
167182

168183
before_cache:
169184
- ccache -s

CHANGELOG

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* GOTO-INSTRUMENT: New option --remove-function-body
1111
* GOTO-INSTRUMENT: New option --use-all-headers, changed --use-system-headers to
1212
--no-system-headers
13+
* GOTO-INSTRUMENT: dump-c can output the generated environment via --harness
1314

1415

1516
5.7

CMakeLists.txt

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
cmake_minimum_required(VERSION 3.2)
2+
3+
find_program(CCACHE_PROGRAM ccache)
4+
if(CCACHE_PROGRAM)
5+
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
6+
message(STATUS "Rule launch compile: ${CCACHE_PROGRAM}")
7+
endif()
8+
9+
set(CMAKE_EXPORT_COMPILE_COMMANDS true)
10+
11+
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
12+
13+
include(GNUInstallDirs)
14+
15+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
16+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
17+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
18+
19+
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
20+
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"
21+
)
22+
# Ensure NDEBUG is not set for release builds
23+
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
24+
# Enable lots of warnings
25+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wpedantic -Werror")
26+
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
27+
# This would be the place to enable warnings for Windows builds, although
28+
# config.inc doesn't seem to do that currently
29+
endif()
30+
31+
set(enable_cbmc_tests on CACHE BOOL "Whether CBMC tests should be enabled")
32+
33+
set(sat_impl "minisat2" CACHE STRING
34+
"This setting controls the SAT library which is used. Valid values are 'minisat2' and 'glucose'"
35+
)
36+
37+
add_subdirectory(src)
38+
39+
if(${enable_cbmc_tests})
40+
enable_testing()
41+
endif()
42+
add_subdirectory(unit)
43+
add_subdirectory(regression)

COMPILING

+48-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ Follow these instructions:
171171
BUILD_ENV = MSVC
172172

173173
Open the Visual Studio Command prompt, and then bash.exe -login from
174-
Cygwin from in there.
174+
Cygwin from in there.
175175

176176
3) Type cd src; make - that should do it.
177177

@@ -183,6 +183,53 @@ can be used for building with MSBuild. Note that you still need to run
183183
flex/bison using "make generated_files" before opening the project.
184184

185185

186+
WORKING WITH CMAKE (EXPERIMENTAL)
187+
---------------------------------
188+
189+
There is an experimental build based on CMake instead of hand-written
190+
makefiles. It should work on a wider variety of systems than the standard
191+
makefile build, and can integrate better with IDEs and static-analysis tools.
192+
193+
0) Run `cmake --version`. If you get a command-not-found error, or the installed
194+
version is lower than 3.2, go and install a new version. Most Linux
195+
distributions have a package for CMake, and Mac users can get it through
196+
Homebrew. Windows users should download it manually from cmake.org.
197+
198+
1) Create a directory to store your build:
199+
`mkdir build`
200+
Run this from the *top level* folder of the project. This is different from
201+
the other builds, which require you to `cd src` first.
202+
203+
2) Generate build files with CMake:
204+
`cmake -H. -Bbuild`
205+
This command tells CMake to use the configuration in the current directory,
206+
and to generate build files into the `build` directory.
207+
This is the point to specify custom build settings, such as compilers and
208+
build back-ends. You can use clang (for example) by adding the argument
209+
`-DCMAKE_CXX_COMPILER=clang++` to the command line. You can also tell
210+
CMake to generate IDE projects by supplying the `-G` flag.
211+
Run `cmake -G` for a comprehensive list of supported back-ends.
212+
213+
Generally it is not necessary to manually specify individual compiler or
214+
linker flags, as CMake defines a number of "build modes" including Debug
215+
and Release modes. To build in a particular mode, add the flag
216+
`-DCMAKE_BUILD_TYPE=Debug` (or `Release`) to the initial invocation.
217+
218+
If you *do* need to manually add flags, use `-DCMAKE_CXX_FLAGS=...` and
219+
`-DCMAKE_EXE_LINKER_FLAGS=...`. This is useful for enabling clang's
220+
sanitizers.
221+
222+
Finally, to enable building universal binaries on macOS, you can pass the
223+
flag `-DCMAKE_OSX_ARCHITECTURES=i386;x86_64`. If you don't supply this flag,
224+
the build will just be for the architecture of your machine.
225+
226+
3) Run the build:
227+
`cmake --build build`
228+
This command tells CMake to invoke the correct tool to run the build in the
229+
`build` directory. You can also use the build back-end directly by invoking
230+
`make`, `ninja`, or opening the generated IDE project as appropriate.
231+
232+
186233
WORKING WITH ECLIPSE
187234
--------------------
188235

README.md

+29-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[![Build Status][travis_img]][travis] [![Build Status][appveyor_img]][appveyor]
2+
[![Build Status][coverity_img]][coverity]
23

34
[CProver Wiki](http://www.cprover.org/wiki)
45

@@ -15,11 +16,38 @@ and passing the resulting equation to a decision procedure.
1516

1617
For full information see [cprover.org](http://www.cprover.org/cbmc).
1718

19+
Versions
20+
========
21+
22+
Get the [latest release](https://github.com/diffblue/cbmc/releases)
23+
* Releases are tested and for production use.
24+
25+
Get the current *develop* version: `git clone https://github.com/diffblue/cbmc.git`
26+
* Develop versions are not recommended for production use.
27+
28+
Report bugs
29+
===========
30+
31+
If you encounter a problem please file a bug report:
32+
* Create an [issue](https://github.com/diffblue/cbmc/issues)
33+
34+
Contributing to the code base
35+
=============================
36+
37+
1. Fork the repository
38+
2. Clone the repository `git clone [email protected]:YOURNAME/cbmc.git`
39+
3. Create a branch from the `develop` branch (default branch)
40+
4. Make your changes (follow the [coding guidelines](https://github.com/diffblue/cbmc/blob/develop/CODING_STANDARD.md))
41+
5. Push your changes to your branch
42+
6. Create a Pull Request targeting the `develop` branch
43+
1844
License
1945
=======
2046
4-clause BSD license, see `LICENSE` file.
2147

2248
[travis]: https://travis-ci.org/diffblue/cbmc
2349
[travis_img]: https://travis-ci.org/diffblue/cbmc.svg?branch=master
2450
[appveyor]: https://ci.appveyor.com/project/diffblue/cbmc/
25-
[appveyor_img]: https://ci.appveyor.com/api/projects/status/github/diffblue/cbmc?svg=true&branch=master
51+
[appveyor_img]: https://ci.appveyor.com/api/projects/status/github/diffblue/cbmc?svg=true&branch=master
52+
[coverity]: https://scan.coverity.com/projects/diffblue-cbmc
53+
[coverity_img]: https://scan.coverity.com/projects/13552/badge.svg

appveyor.yml

+1-13
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,6 @@ build_script:
6060
test_script:
6161
- cmd: |
6262
cd regression
63-
sed -i "s/goto-cc\/goto-cc/goto-cc\/goto-cl/" ansi-c/Makefile
64-
sed -i "s/goto-cc\/goto-cc/goto-cc\/goto-cl/" cpp/Makefile
65-
sed -i "s/goto-cc\/goto-cc/goto-cc\/goto-cl/" goto-instrument/chain.sh
66-
sed -i "15s/.*/$goto_cc $name.c/" goto-instrument/chain.sh
67-
sed -i "16i mv $name.exe $name.gb" goto-instrument/chain.sh
68-
sed -i "23s/.*/ $goto_cc ${name}-mod.c/" goto-instrument/chain.sh
69-
sed -i "24i mv ${name}-mod.exe $name-mod.gb" goto-instrument/chain.sh
70-
cat goto-instrument/chain.sh
71-
72-
sed -i "s/goto-cc\/goto-cc/goto-cc\/goto-cl/" goto-instrument-typedef/chain.sh || true
73-
sed -i "12s/.*/$GC $NAME.c --function fun/" goto-instrument-typedef/chain.sh || true
74-
sed -i "13i mv $NAME.exe $NAME.gb" goto-instrument-typedef/chain.sh || true
75-
cat goto-instrument-typedef/chain.sh || true
7663
7764
rem HACK disable failing tests
7865
rmdir /s /q ansi-c\arch_flags_mcpu_bad
@@ -109,6 +96,7 @@ test_script:
10996
rmdir /s /q cbmc-java\classpath1
11097
rmdir /s /q cbmc-java\jar-file3
11198
rmdir /s /q cbmc-java\tableswitch2
99+
rmdir /s /q goto-gcc
112100
rmdir /s /q goto-instrument\slice08
113101
114102
make test

regression/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tests.log

0 commit comments

Comments
 (0)