]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add a "COCCI" macro that we tell coccinelle is always defined.
authorNick Mathewson <nickm@torproject.org>
Wed, 9 Oct 2019 14:07:50 +0000 (10:07 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 22 Oct 2019 13:24:25 +0000 (09:24 -0400)
This will let us give specific in-file equivalents to given macros
or preprocessor directives, to make things parse.

scripts/coccinelle/apply.sh
scripts/coccinelle/try_parse.sh

index 82e773dc3925699c92846f9dfd9e74264b8da49a..f531d7fa32f6997c1a4c482aacb1491a3bae3d5b 100755 (executable)
@@ -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 "$@"
index 3033242946f07d7d25f69b5a203c48252a4e12e7..0f91e31702bde408a9d5f935dec9726298d927cd 100755 (executable)
@@ -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