]> 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)
committerSquid Anubis <squid-anubis@squid-cache.org>
Fri, 22 Jul 2022 23:12:42 +0000 (23:12 +0000)
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 911c810dfdb0e2a47168747a7bea055998130fad..fd0366408961b243d14edb5e123ee01a518b71f2 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