[master] 80071c567 Pre-process <pcre2.h> for FlexeLint

Poul-Henning Kamp phk at FreeBSD.org
Wed Jul 7 08:14:07 UTC 2021


commit 80071c567a60fe6729513631f51ae6b05eb9abed
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Jul 7 08:13:18 2021 +0000

    Pre-process <pcre2.h> for FlexeLint

diff --git a/tools/flint_skel.sh b/tools/flint_skel.sh
index 9d45f87dd..d6d3031f1 100755
--- a/tools/flint_skel.sh
+++ b/tools/flint_skel.sh
@@ -6,12 +6,27 @@ if [ "x$1" = "x-ok" -a -f _.fl ] ; then
 	exit 0
 fi
 
+
 d=$(dirname $0)
-l=1
 if [ $d = ../../tools ] ; then
     l=2
+    IARG="-I. -I../../include -I../.."
+else
+    l=1
+    IARG="-I. -I../include -I.."
 fi
 
+IARG="${IARG} -I/usr/local/include"
+
+# Flexelint do not grok the macro-stacking in pcre2.h
+# Solve it by running it through CPP first.
+
+echo '
+#include "config.h"
+#include <pcre2.h>
+' | cc $IARG -E - |
+    sed '/^# [0-9]/d' > pcre2.h
+
 flexelint \
 	-D__FLEXELINT__ \
 	$(if [ $l -eq 2 ] ; then echo ../../flint.lnt ; fi) \
@@ -19,18 +34,12 @@ flexelint \
 	flint.lnt \
 	-zero \
 	-I. \
-	$(if [ $l -eq 2 ] ; then
-	      echo -I../../include
-	      echo -I../..
-	  else
-	      echo -I../include
-	      echo -I..
-	  fi
-	) \
-	-I/usr/local/include \
+        ${IARG} \
 	$FLOPS \
 	2>&1 | tee _.fl
 
+rm -f pcre2.h
+
 if [ -f _.fl.old ] ; then
 	diff -u _.fl.old _.fl
 fi


More information about the varnish-commit mailing list