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.
@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
/* 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. */