Skip to content

Fix library check #1443

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 2 commits into from
Oct 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ansi-c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ list(REMOVE_ITEM library_check_sources ${platform_unavail})

add_custom_command(
DEPENDS ${library_check_sources}
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/library_check.sh ${library_check_sources}
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/library_check.sh ${CMAKE_C_COMPILER} ${library_check_sources}
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/library-check.stamp
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/library-check.stamp
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
Expand Down
2 changes: 1 addition & 1 deletion src/ansi-c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ else
platform_unavail = library/java.io.c library/threads.c
endif
library_check: library/*.c
./library_check.sh $(filter-out $(platform_unavail), $^)
./library_check.sh $(CC) $(filter-out $(platform_unavail), $^)
touch $@

cprover_library.inc: library/converter$(EXEEXT) library/*.c
Expand Down
8 changes: 6 additions & 2 deletions src/ansi-c/library_check.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#!/usr/bin/env bash

CC=$1
shift

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/(_mm_.fence)/s$1/' __libcheck.c
perl -p -i -e 's/(__sync_)/s$1/' __libcheck.c
perl -p -i -e 's/(__noop)/s$1/' __libcheck.c
cc -std=gnu99 -E -include library/cprover.h -D__CPROVER_bool=_Bool -D__CPROVER_thread_local=__thread -DLIBRARY_CHECK -o __libcheck.i __libcheck.c
cc -S -Wall -Werror -pedantic -Wextra -std=gnu99 __libcheck.i -o __libcheck.s -Wno-unused-label
$CC -std=gnu99 -E -include library/cprover.h -D__CPROVER_bool=_Bool -D__CPROVER_thread_local=__thread -DLIBRARY_CHECK -o __libcheck.i __libcheck.c
$CC -S -Wall -Werror -pedantic -Wextra -std=gnu99 __libcheck.i -o __libcheck.s -Wno-unused-label
ec="${?}"
rm __libcheck.s __libcheck.i __libcheck.c
[ "${ec}" -eq 0 ] || exit "${ec}"
Expand Down