Module Name:    src
Committed By:   rin
Date:           Thu Aug  3 13:33:27 UTC 2023

Modified Files:
        src/share/mk: bsd.own.mk

Log Message:
bsd.own.mk: Introduce CC_WNO_USE_AFTER_FREE for GCC12

-Wuse-after-free for GCC 12 is premature. It fires on a common idiom:

        newbuf = realloc(buf, size);
        p = newbuf + (p - buf);

Let shut this up for GCC 12 (with hoping it gets improved for 13!).


To generate a diff of this commit:
cvs rdiff -u -r1.1347 -r1.1348 src/share/mk/bsd.own.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1347 src/share/mk/bsd.own.mk:1.1348
--- src/share/mk/bsd.own.mk:1.1347	Tue Aug  1 06:52:06 2023
+++ src/share/mk/bsd.own.mk	Thu Aug  3 13:33:26 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1347 2023/08/01 06:52:06 mrg Exp $
+#	$NetBSD: bsd.own.mk,v 1.1348 2023/08/03 13:33:26 rin Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -697,6 +697,11 @@ CC_WNO_RETURN_LOCAL_ADDR=	${${ACTIVE_CC}
 CC_WNO_STRINGOP_OVERFLOW=	${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 7:? -Wno-stringop-overflow :}
 CC_WNO_STRINGOP_TRUNCATION=	${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 8:? -Wno-stringop-truncation :}
 
+# -Wuse-after-free for GCC 12 is premature. It fires on a common idiom:
+#	newbuf = realloc(buf, size); p = newbuf + (p - buf);
+# Let shut this up for GCC 12 (with hoping it gets improved for 13!).
+CC_WNO_USE_AFTER_FREE=	${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} == 12:? -Wno-use-after-free :}
+
 # For each ${MACHINE_CPU}, list the ports that use it.
 MACHINES.aarch64=	evbarm
 MACHINES.alpha=		alpha

Reply via email to