[gcc r16-6532] Allow disabling -gctf non-C warning [PR123259]
Rainer Orth
ro@gcc.gnu.org
Wed Jan 7 05:53:52 GMT 2026
https://gcc.gnu.org/g:026c00babbe16d5a8525d2e59066d381615705c4
commit r16-6532-g026c00babbe16d5a8525d2e59066d381615705c4
Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date: Wed Jan 7 06:53:23 2026 +0100
Allow disabling -gctf non-C warning [PR123259]
In mixed-language builds it may be difficult to restrict -gctf to only
C-language sources. However, the
cc1plus: note: CTF debug info requested, but not supported for ‘GNU C++17’ frontend
warning for non-C languages, which is perfectly benign, may confuse
parts of the build, so it may be useful to disable it.
This patch applies the existing -Wno-complain-wrong-lang option to
suppress it.
Bootstrapped without regressions on i386-pc-solaris2.11
sparc-sun-solaris2.11, also with C/C++-only bootstraps that apply
-gctf/-gsctf via STAGE[23]_CFLAGS and STAGE[23]_TFLAGS.
2025-12-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
gcc:
PR debug/123259
* toplev.cc (process_options): Guard CTF non-C warning by
-Wcomplain-wrong-lang.
* doc/invoke.texi (Warning Options, -Wno-complain-wrong-lang):
Document effect on -gctf/-gsctf.
Diff:
---
gcc/doc/invoke.texi | 4 ++++
gcc/toplev.cc | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index bae66ba6c45f..f6c79b051d06 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -10153,6 +10153,10 @@ The latter front end diagnoses
@samp{f951: Warning: command-line option '-fno-rtti' is valid for C++/D/ObjC++ but not for Fortran},
which may be disabled with @option{-Wno-complain-wrong-lang}.
+This option can also be used to disable warnings like
+@samp{cc1plus: note: CTF debug info requested, but not supported for 'GNU C++20' frontend}
+produced by @option{-gctf} or @option{-gsctf} for unsupported languages.
+
@opindex Wcompare-distinct-pointer-types
@item -Wcompare-distinct-pointer-types @r{(C and Objective-C only)}
Warn if pointers of distinct types are compared without a cast. This
diff --git a/gcc/toplev.cc b/gcc/toplev.cc
index 1eaaffdb3cf2..9c93eb8ce1dc 100644
--- a/gcc/toplev.cc
+++ b/gcc/toplev.cc
@@ -1436,7 +1436,8 @@ process_options ()
/* CTF is supported for only C at this time. */
if (!lang_GNU_C ()
- && ctf_debug_info_level > CTFINFO_LEVEL_NONE)
+ && ctf_debug_info_level > CTFINFO_LEVEL_NONE
+ && warn_complain_wrong_lang)
{
/* Compiling with -flto results in frontend language of GNU GIMPLE. It
is not useful to warn in that case. */
More information about the Gcc-cvs
mailing list