]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Silence GnuRegex warnings on gcc 12.1 (#1096)
authorFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 22 Jul 2022 23:12:33 +0000 (23:12 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Mon, 22 Aug 2022 15:09:12 +0000 (03:09 +1200)
GnuRegex does pointer magic that gcc 12.1 doesn't like.

    compat/GnuRegex.c: error: array subscript -1 is outside array bounds
    of 'const char[]' [-Werror=array-bounds]

    compat/GnuRegex.c: error: pointer may be used after 'realloc'
    [-Werror=use-after-free]

A long term fix is to unship GnuRegex which is an old
snapshot and is not maintained.

compat/GnuRegex.c

index 9ef932e5cae9ff063183870808df1b769c35b65f..82c912939f0835a5c8de0a77835ff0df4a3bece3 100644 (file)
 
 #if USE_GNUREGEX /* only if squid needs it. Usually not */
 
+/* Starting with v12.1, GCC warns of various problems with this ancient code. */
+/* GCC versions prior to v12.1 do not support these pragmas. */
+#if (__GNUC__ == 12 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 12)
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#pragma GCC diagnostic ignored "-Wuse-after-free"
+#endif
+
 #if !HAVE_ALLOCA
 #define REGEX_MALLOC 1
 #endif