]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Allow disabling -gctf non-C warning [PR123259]
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Wed, 7 Jan 2026 05:53:23 +0000 (06:53 +0100)
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Wed, 7 Jan 2026 05:53:23 +0000 (06:53 +0100)
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.

gcc/doc/invoke.texi
gcc/toplev.cc

index bae66ba6c45f9f23f3c97cc55eb292474db502db..f6c79b051d06710ce0bddf6df7f10536edc99133 100644 (file)
@@ -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
index 1eaaffdb3cf20c9f474aa99b00ee5684ca97c3ef..9c93eb8ce1dc297366eb2da51ec43ad7455ed2a7 100644 (file)
@@ -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.  */