add "make c99" to convert back
This commit is contained in:
parent
9f01ba14bc
commit
17a846f2bc
@ -61,6 +61,9 @@ matrix:
|
||||
# We have only one program and the variable $BUILDOPTIONS
|
||||
# has only the options to that program: testme.sh
|
||||
|
||||
# Check c89 <-> c99 roundtrip
|
||||
- env: BUILDOPTIONS='--c89-c99-roundtrip'
|
||||
|
||||
# Check source code format
|
||||
- env: BUILDOPTIONS='--format'
|
||||
addons:
|
||||
|
18
makefile
18
makefile
@ -154,8 +154,9 @@ perlcritic:
|
||||
|
||||
c89:
|
||||
@echo "Applying substitutions for c89 compatibility..."
|
||||
@if grep mp_bool tommath.h > /dev/null; then echo "Already applied"; exit 1; fi
|
||||
@sed -i \
|
||||
-e 's/#include <stdbool.h>//g' \
|
||||
-e '/#include <stdbool.h>/d' \
|
||||
-e 's/#include <stdint.h>/#include "tommath_c89.h"/g' \
|
||||
-e 's/bool/mp_bool/g' \
|
||||
-e 's/true/MP_YES/g' \
|
||||
@ -175,6 +176,21 @@ c89:
|
||||
@echo "typedef __UINT64_TYPE__ mp_u64;" >> tommath_c89.h
|
||||
|
||||
|
||||
c99:
|
||||
@echo "Applying substitutions for c99 compatibility..."
|
||||
@if ! grep mp_bool tommath.h > /dev/null; then echo "Already applied"; exit 1; fi
|
||||
@sed -i \
|
||||
-e 's/#include "tommath_c89.h"/#include <stdint.h>\n#include <stdbool.h>/g' \
|
||||
-e 's/mp_bool/bool/g' \
|
||||
-e 's/MP_YES/true/g' \
|
||||
-e 's/MP_NO/false/g' \
|
||||
-e 's/false_/MP_NO_/g' \
|
||||
-e 's/mp_u\([0-9][0-9]*\)/uint\1_t/g' \
|
||||
-e 's/mp_i\([0-9][0-9]*\)/int\1_t/g' \
|
||||
*.c *.h demo/*.c demo/*.h etc/*.c
|
||||
@rm -f tommath_c89.h
|
||||
|
||||
|
||||
astyle:
|
||||
@echo " * run astyle on all sources"
|
||||
@astyle --options=astylerc --formatted $(OBJECTS:.o=.c) tommath*.h demo/*.c etc/*.c mtest/mtest.c
|
||||
|
12
testme.sh
12
testme.sh
@ -196,6 +196,7 @@ VALGRIND_OPTS=" --leak-check=full --show-leak-kinds=all --error-exitcode=1 "
|
||||
VALGRIND_BIN=""
|
||||
CHECK_FORMAT=""
|
||||
C89=""
|
||||
C89_C99_ROUNDTRIP=""
|
||||
TUNE_CMD="./etc/tune -t -r 10 -L 3"
|
||||
|
||||
alive_pid=0
|
||||
@ -221,6 +222,9 @@ do
|
||||
--c89)
|
||||
C89="1"
|
||||
;;
|
||||
--c89-c99-roundtrip)
|
||||
C89_C99_ROUNDTRIP="1"
|
||||
;;
|
||||
--with-cc=*)
|
||||
COMPILERS="$COMPILERS ${1#*=}"
|
||||
;;
|
||||
@ -297,6 +301,14 @@ function _check_git() {
|
||||
|
||||
[[ "$C89" == "1" ]] && make c89
|
||||
|
||||
if [[ "$C89_C99_ROUNDTRIP" == "1" ]]
|
||||
then
|
||||
make c89
|
||||
make c99
|
||||
_check_git "make c89; make c99"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
if [[ "$CHECK_FORMAT" == "1" ]]
|
||||
then
|
||||
make astyle
|
||||
|
Loading…
Reference in New Issue
Block a user