]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
CI: Fix gperf 3.2 output filter (#2081)
authorAmos Jeffries <yadij@users.noreply.github.com>
Mon, 9 Jun 2025 04:49:04 +0000 (04:49 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Wed, 11 Jun 2025 01:26:33 +0000 (13:26 +1200)
gperf 3.2 now provides properly compiler and C++ version scoped
fallthrough attributes. Our filter to convert the gperf 3.1 and
older output for C++17 attribute requirements is now broken and
produces compiler errors due to listing '[[fallback]];' on two
consecutive lines.

scripts/source-maintenance.sh

index e2cca2e16449b5f243f65695802a34246dcb0b7e..ea2d890f56c4f61a7a8aff1a0d9d820bc7421610 100755 (executable)
@@ -662,8 +662,15 @@ generateRawGperfFile ()
     echo "/* $GeneratedByMe */"
     echo
 
-    (cd `dirname $gperfFile` && gperf -m 100000 `basename $gperfFile`) | \
-        sed 's@/[*]FALLTHROUGH[*]/@[[fallthrough]];@g'
+    if test `gperf --version | head -1 | cut -d ' ' -f 3 | cut -d. -f '-2' | sed -e 's/\.//'` -lt 32 ; then
+        # We configure C++ compilers to complain about missing '[[fallthrough]]' attribute
+        # where old gperf versions use a '/*FALLTHROUGH*/' code comment.
+        (cd `dirname $gperfFile` && gperf -m 100000 `basename $gperfFile`) | \
+            sed -e 's@/[*]FALLTHROUGH[*]/@[[fallthrough]];@g'
+    else
+        # gperf 3.2+ provide fallthrough attributes
+        (cd `dirname $gperfFile` && gperf -m 100000 `basename $gperfFile`)
+    fi
 }
 
 generateGperfFile ()