diff --git a/Makefile.coq.local b/Makefile.coq.local index 9bdf479c97e7167dbc2a56a39fc3f40b7d932cb4..bfb9a8545291275e4b800ffc5a2d58d6b928715e 100644 --- a/Makefile.coq.local +++ b/Makefile.coq.local @@ -7,12 +7,12 @@ MAKE_REF:= # Run tests interleaved with main build. They have to be in the same target for this. real-all: style $(if $(NO_TEST),,test) -style: $(VFILES) +style: $(VFILES) coq-lint.sh # Make sure everything imports the options, and all Instance/Argument/Hint are qualified. $(SHOW)"Performing some style checks..." $(HIDE)for FILE in $(VFILES); do \ if ! fgrep -q 'From iris.prelude Require Import options.' "$$FILE"; then echo "ERROR: $$FILE does not import 'options'."; echo; exit 1; fi ; \ - if egrep -n '^\s*((Existing\s+|Program\s+)Instance|Arguments|Remove|Hint\s+(Extern|Constructors|Resolve|Immediate|Mode|Opaque|Transparent|Unfold)|(Open|Close)\s+Scope|Opaque|Transparent)\b' "$$FILE"; then echo "ERROR: $$FILE contains 'Instance'/'Arguments'/'Hint' or another side-effect without locality (see above)."; echo "Please add 'Global' or 'Local' as appropriate."; echo; exit 1; fi \ + ./coq-lint.sh "$$FILE"; \ done # Make sure main Iris does not import other Iris packages. $(HIDE)if egrep 'iris\.(heap_lang|deprecated|staging)' --include "*.v" -R iris; then echo "ERROR: Iris may not import modules from other Iris packages (see above for violations)."; echo; exit 1; fi diff --git a/coq-lint.sh b/coq-lint.sh new file mode 100755 index 0000000000000000000000000000000000000000..18a36adeaea3cf6b314264e871d4270d89c46d9f --- /dev/null +++ b/coq-lint.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -e +## A simple shell script checking for some common Coq issues. + +FILE="$1" + +if egrep -n '^\s*((Existing\s+|Program\s+)Instance|Arguments|Remove|Hint\s+(Extern|Constructors|Resolve|Immediate|Mode|Opaque|Transparent|Unfold)|(Open|Close)\s+Scope|Opaque|Transparent)\b' "$FILE"; then + echo "ERROR: $FILE contains 'Instance'/'Arguments'/'Hint' or another side-effect without locality (see above)." + echo "Please add 'Global' or 'Local' as appropriate." + echo + exit 1 +fi