File tree Expand file tree Collapse file tree 2 files changed +32
-14
lines changed Expand file tree Collapse file tree 2 files changed +32
-14
lines changed Original file line number Diff line number Diff line change @@ -91,21 +91,9 @@ ifeq ($(BUILD_ENV),MinGW)
91
91
else
92
92
platform_unavail = library/java.io.c library/threads.c
93
93
endif
94
+
94
95
library_check : library/* .c
95
- for f in $( filter-out $( platform_unavail) , $^) ; do \
96
- echo " Checking $$ f" ; \
97
- cp $$ f __libcheck.c ; \
98
- perl -p -i -e ' s/(__builtin_[^v])/s$$1/' __libcheck.c ; \
99
- perl -p -i -e ' s/(__sync_)/s$$1/' __libcheck.c ; \
100
- perl -p -i -e ' s/(__noop)/s$$1/' __libcheck.c ; \
101
- $(CC ) -std=gnu99 -E -include library/cprover.h -D__CPROVER_bool=_Bool \
102
- -D__CPROVER_thread_local=__thread -DLIBRARY_CHECK -o __libcheck.i __libcheck.c ; \
103
- $(CC ) -S -Wall -Werror -pedantic -Wextra -std=gnu99 __libcheck.i -o __libcheck.s \
104
- -Wno-unused-label ; \
105
- ec=$$? ; \
106
- $(RM ) __libcheck.s __libcheck.i __libcheck.c ; \
107
- [ $$ ec -eq 0 ] || exit $$ ec ; \
108
- done
96
+ CC=$(CC ) RM=" $( RM) " ./library_check.sh $(filter-out $(platform_unavail ) , $^ )
109
97
touch $@
110
98
111
99
cprover_library.inc : library/converter$(EXEEXT ) library/* .c
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Note use of -Wno-nonnull-compare below: functions in string.c (and others) null-check their parameters,
4
+ # but some versions of libc tag them non-null, authorising the optimiser to discard those checks.
5
+ # This is acceptable to use because this version of the library is only for use by cbmc, which does
6
+ # not use the non-null attribute in this way.
7
+ # See https://clang.llvm.org/docs/AttributeReference.html#nonnull-gnu-nonnull
8
+
9
+ if echo " " | " $CC " -Werror -Wno-nonnull-compare -E - > /dev/null 2>&1 ; then
10
+ # Expected option for gcc
11
+ DISABLE_NONNULL_WARNING=-Wno-nonnull-compare
12
+ elif echo " " | " $CC " -Werror -Wno-tautological-pointer-compare -Wno-pointer-bool-conversion -E - > /dev/null 2>&1 ; then
13
+ # Expected option for clang
14
+ DISABLE_NONNULL_WARNING=" -Wno-tautological-pointer-compare -Wno-pointer-bool-conversion"
15
+ else
16
+ echo >&2 " Couldn't find compiler options to disable warnings regarding comparison vs. __nonnull__ pointers, this may cause test failures"
17
+ fi
18
+
19
+ for f in " $@ " ; do
20
+ echo " Checking $f "
21
+ cp $f __libcheck.c
22
+ perl -p -i -e ' s/(__builtin_[^v])/s$1/' __libcheck.c
23
+ perl -p -i -e ' s/(__sync_)/s$1/' __libcheck.c
24
+ perl -p -i -e ' s/(__noop)/s$1/' __libcheck.c
25
+ " $CC " -std=gnu99 -E -include library/cprover.h -D__CPROVER_bool=_Bool -D__CPROVER_thread_local=__thread -DLIBRARY_CHECK -o __libcheck.i __libcheck.c
26
+ " $CC " -S -Wall -Werror -pedantic -Wextra $DISABLE_NONNULL_WARNING -std=gnu99 __libcheck.i -o __libcheck.s -Wno-unused-label
27
+ ec=$?
28
+ $RM __libcheck.s __libcheck.i __libcheck.c
29
+ [ $ec -eq 0 ] || exit $ec
30
+ done
You can’t perform that action at this time.
0 commit comments