git: 5115511ed494 - main - Use __freebsd_kprintf__ with GCC 12+ similar to clang.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 22 Nov 2022 16:37:44 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=5115511ed4941684bc82b8a3c4b95e9a8931b940

commit 5115511ed4941684bc82b8a3c4b95e9a8931b940
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-11-22 16:36:12 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-11-22 16:36:12 +0000

    Use __freebsd_kprintf__ with GCC 12+ similar to clang.
---
 share/mk/bsd.sys.mk | 3 ++-
 sys/conf/kern.mk    | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
index f6303d7d06d7..aa2336700524 100644
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -222,7 +222,8 @@ CWARNFLAGS+=	-Wno-system-headers
 .endif	# gcc
 
 # How to handle FreeBSD custom printf format specifiers.
-.if ${COMPILER_TYPE} == "clang"
+.if ${COMPILER_TYPE} == "clang" || \
+    (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 120100)
 FORMAT_EXTENSIONS=	-D__printf__=__freebsd_kprintf__
 .else
 FORMAT_EXTENSIONS=	-fformat-extensions
diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk
index 4e33db93dafe..78dedb8ff496 100644
--- a/sys/conf/kern.mk
+++ b/sys/conf/kern.mk
@@ -91,7 +91,8 @@ CWARNFLAGS+=	-Wno-format-zero-length
 # to be disabled.  WARNING: format checking is disabled in this case.
 .if ${MK_FORMAT_EXTENSIONS} == "no"
 FORMAT_EXTENSIONS=	-Wno-format
-.elif ${COMPILER_TYPE} == "clang"
+.elif ${COMPILER_TYPE} == "clang" || \
+    (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 120100)
 FORMAT_EXTENSIONS=	-D__printf__=__freebsd_kprintf__
 .else
 FORMAT_EXTENSIONS=	-fformat-extensions