#!/bin/sh

# These were not important
#WARN_OPTS="-Wall -Wextra -Wsign-compare -Werror-implicit-function-declaration -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations -Wdeclaration-after-statement -Wold-style-definition -Wno-missing-field-initializers -Wno-unused-parameter -Wno-attributes -Wno-long-long -Winline"
#MISC_OPTS="-DHAVE_CONFIG_H"
#OPT_OPTS="-feliminate-unused-debug-types -O2 -pipe"
#OPT_OPTS="-O2 -pipe"

ARCH_OPTS="-march=armv7ve -marm -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a15"
OPT_OPTS="-O2"
DBG_OPTS="-g"

arm-linux-gnueabihf-gcc $ARCH_OPTS $WARN_OPTS $MISC_OPT $OPT_OPTS $DBG_OPTS -o test-fail test.c
arm-linux-gnueabihf-objdump -d test-fail >test-fail.dis

valgrind --leak-resolution=high --track-origins=yes --trace-children=yes --leak-check=full --error-limit=no ./test-fail arg1 arg2 arg3

OPT_OPTS=""

arm-linux-gnueabihf-gcc $ARCH_OPTS $WARN_OPTS $MISC_OPT $OPT_OPTS $DBG_OPTS -o test-ok test.c
arm-linux-gnueabihf-objdump -d test-ok >test-ok.dis

valgrind --leak-resolution=high --track-origins=yes --trace-children=yes --leak-check=full --error-limit=no ./test-ok arg1 arg2 arg3

