From a2bb66c3558be224f3537296ee0ebec179164f57 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 9 Oct 2019 10:07:50 -0400 Subject: Add a "COCCI" macro that we tell coccinelle is always defined. This will let us give specific in-file equivalents to given macros or preprocessor directives, to make things parse. --- scripts/coccinelle/apply.sh | 2 +- scripts/coccinelle/try_parse.sh | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'scripts/coccinelle') diff --git a/scripts/coccinelle/apply.sh b/scripts/coccinelle/apply.sh index 82e773dc39..f531d7fa32 100755 --- a/scripts/coccinelle/apply.sh +++ b/scripts/coccinelle/apply.sh @@ -6,4 +6,4 @@ top="$(dirname "$0")/../.." spatch -macro_file_builtins "$top"/scripts/coccinelle/tor-coccinelle.h \ - -I "$top" -I "$top"/src -I "$top"/ext "$@" + -I "$top" -I "$top"/src -I "$top"/ext --defined COCCI "$@" diff --git a/scripts/coccinelle/try_parse.sh b/scripts/coccinelle/try_parse.sh index 3033242946..0f91e31702 100755 --- a/scripts/coccinelle/try_parse.sh +++ b/scripts/coccinelle/try_parse.sh @@ -10,14 +10,16 @@ exitcode=0 for fn in "$@"; do if spatch -macro_file_builtins "$top"/scripts/coccinelle/tor-coccinelle.h \ - -I "$top" -I "$top"/src -I "$top"/ext --parse-c "$fn" \ + -I "$top" -I "$top"/src -I "$top"/ext --defined COCCI \ + --parse-c "$fn" \ 2>/dev/null | grep "perfect = 1" > /dev/null; then : # it's perfect else echo "$fn" if test "${VERBOSE}" != ""; then spatch -macro_file_builtins "$top"/scripts/coccinelle/tor-coccinelle.h \ - -I "$top" -I "$top"/src -I "$top"/ext --parse-c "$fn" + -I "$top" -I "$top"/src -I "$top"/ext --defined COCCI \ + --parse-c "$fn" fi exitcode=1 fi -- cgit v1.2.3-54-g00ecf