Skip to content
Snippets Groups Projects
Commit 30ff4e8b authored by Kostyantyn Vorobyov's avatar Kostyantyn Vorobyov
Browse files

Added -q|--quiet option to e-acsl for quiet executions that output only

errors or warnings
parent 8f663dc7
No related branches found
No related tags found
No related merge requests found
......@@ -46,9 +46,9 @@ check_tool() {
# Getopt options
LONGOPTIONS="help,compile,compile-only,print,debug:,ocode:,oexec:,verbose:, \
frama-c-only,extra-cpp-args,rtl,frama-c-stdlib,full-mmodel,gmp,
frama-c-only,extra-cpp-args,rtl,frama-c-stdlib,full-mmodel,gmp,quiet,
ld-flags:,cpp-flags:"
SHORTOPTIONS="h,c,C,p,d:,o:,O:,v:,f,E:,R,L,M,l:,e:,g"
SHORTOPTIONS="h,c,C,p,d:,o:,O:,v:,f,E:,R,L,M,l:,e:,g,q"
# Prefix for an error message due to wrong arguments
ERROR="ERROR parsing arguments:"
......@@ -105,6 +105,7 @@ EACSL_CPP_FLAGS="
EACSL_LD_FLAGS="-lgmp -lm"
# Variables holding getopt options
OPTION_ECHO="set -x" # Echo executed commands to STDOUT
OPTION_INSTRUMENT=1 # Perform E-ACSL instrumentation
OPTION_PRINT= # Output instrumented code
OPTION_DEBUG= # Set frama-c debug flag
......@@ -162,6 +163,8 @@ manpage() {
echo " pass the specified flags to the linker"
echo " -e, --cpp-flags <FLAGS>"
echo " pass the specified flags to the pre-processor (compile-time)"
echo " -q, --quiet"
echo " suppress any output except for errors and warnings"
echo ""
echo "EXAMPLES:"
echo " # Instrument foo.c and output the instrumented code to a.out.frama.c"
......@@ -203,6 +206,13 @@ do
shift;
manpage;
;;
# Do not echo commands to STDOUT
--quiet|-q)
shift;
OPTION_ECHO=
OPTION_DEBUG="-debug 0"
OPTION_VERBOSE="-verbose 0"
;;
# Do compile instrumented code
--compile|-c)
shift;
......@@ -309,7 +319,7 @@ fi
# Instrument
if [ -n "$OPTION_INSTRUMENT" ]; then
(set -x; \
($OPTION_ECHO; \
$FRAMAC \
$FRAMAC_FLAGS \
$MACHDEP \
......@@ -336,14 +346,14 @@ if test -n "$OPTION_COMPILE" ; then
# Compile the original files only if the instrumentation option is given,
# otherwise the provided sources are assumed to be E-ACSL instrumented files
if [ -n "$OPTION_INSTRUMENT" ]; then
(set -x; $CC $CPPFLAGS $CFLAGS "$@" -o "$OPTION_OEXEC" $LDFLAGS);
error "fail to compile/link un-instrumented code" $?;
($OPTION_ECHO; $CC $CPPFLAGS $CFLAGS "$@" -o "$OPTION_OEXEC" $LDFLAGS);
error "fail to compile/link un-instrumented code: $@" $?;
else
OPTION_OCODE="$@"
fi
# Compile and link E-ACSL-instrumented file
(set -x; $CC $CPPFLAGS $CFLAGS $EACSL_CPP_FLAGS $RTL \
($OPTION_ECHO; $CC $CPPFLAGS $CFLAGS $EACSL_CPP_FLAGS $RTL \
"$OPTION_OCODE" -o "$OPTION_OEXEC.e-acsl" $LDFLAGS $EACSL_LD_FLAGS)
error "fail to compile/link instrumented code" $?;
error "fail to compile/link instrumented code: $@" $?;
fi
exit 0;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment