diff mbox series

ctf: Do not warn for CTF not supported for GNU GIMPLE

Message ID 1632855067-7525-1-git-send-email-indu.bhagat@oracle.com
State New
Headers show
Series ctf: Do not warn for CTF not supported for GNU GIMPLE | expand

Commit Message

Indu Bhagat Sept. 28, 2021, 6:51 p.m. UTC
CTF is supported for C only.  Currently, a warning is emitted if the -gctf
command line option is specified for a non-C frontend.  This warning is also
used by the GCC testsuite framework - it skips adding -gctf to the list of
debug flags for automated testing, if CTF is not supported for the frontend.

The following warning, however, is not useful in case of LTO:

"lto1: note: CTF debug info requested, but not supported for ‘GNU GIMPLE’
frontend"

This patch disables the generation of the above warning for GNU GIMPLE.

Bootstrapped and regression tested on x86_64.

gcc/ChangeLog:

	* toplev.c (process_options): Do not warn for GNU GIMPLE.
---
 gcc/toplev.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Richard Biener Sept. 29, 2021, 7:14 a.m. UTC | #1
On Tue, Sep 28, 2021 at 8:52 PM Indu Bhagat via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> CTF is supported for C only.  Currently, a warning is emitted if the -gctf
> command line option is specified for a non-C frontend.  This warning is also
> used by the GCC testsuite framework - it skips adding -gctf to the list of
> debug flags for automated testing, if CTF is not supported for the frontend.
>
> The following warning, however, is not useful in case of LTO:
>
> "lto1: note: CTF debug info requested, but not supported for ‘GNU GIMPLE’
> frontend"
>
> This patch disables the generation of the above warning for GNU GIMPLE.
>
> Bootstrapped and regression tested on x86_64.
>
> gcc/ChangeLog:
>
>         * toplev.c (process_options): Do not warn for GNU GIMPLE.
> ---
>  gcc/toplev.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/gcc/toplev.c b/gcc/toplev.c
> index e1688aa..511a343 100644
> --- a/gcc/toplev.c
> +++ b/gcc/toplev.c
> @@ -1416,14 +1416,16 @@ process_options (void)
>         debug_info_level = DINFO_LEVEL_NONE;
>      }
>
> -  /* CTF is supported for only C at this time.
> -     Compiling with -flto results in frontend language of GNU GIMPLE.  */
> +  /* CTF is supported for only C at this time.  */
>    if (!lang_GNU_C ()
>        && ctf_debug_info_level > CTFINFO_LEVEL_NONE)
>      {
> -      inform (UNKNOWN_LOCATION,
> -             "CTF debug info requested, but not supported for %qs frontend",
> -             language_string);
> +      /* Compiling with -flto results in frontend language of GNU GIMPLE.  It
> +        is not useful to warn in that case.  */
> +      if (!startswith (lang_hooks.name, "GNU GIMPLE"))

please use in_lto_p instead

OK with that change.

> +       inform (UNKNOWN_LOCATION,
> +               "CTF debug info requested, but not supported for %qs frontend",
> +               language_string);
>        ctf_debug_info_level = CTFINFO_LEVEL_NONE;
>      }
>
> --
> 1.8.3.1
>
Indu Bhagat Sept. 29, 2021, 3:54 p.m. UTC | #2
On 9/29/21 12:14 AM, Richard Biener wrote:
> On Tue, Sep 28, 2021 at 8:52 PM Indu Bhagat via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
>>
>> CTF is supported for C only.  Currently, a warning is emitted if the -gctf
>> command line option is specified for a non-C frontend.  This warning is also
>> used by the GCC testsuite framework - it skips adding -gctf to the list of
>> debug flags for automated testing, if CTF is not supported for the frontend.
>>
>> The following warning, however, is not useful in case of LTO:
>>
>> "lto1: note: CTF debug info requested, but not supported for ‘GNU GIMPLE’
>> frontend"
>>
>> This patch disables the generation of the above warning for GNU GIMPLE.
>>
>> Bootstrapped and regression tested on x86_64.
>>
>> gcc/ChangeLog:
>>
>>          * toplev.c (process_options): Do not warn for GNU GIMPLE.
>> ---
>>   gcc/toplev.c | 12 +++++++-----
>>   1 file changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/gcc/toplev.c b/gcc/toplev.c
>> index e1688aa..511a343 100644
>> --- a/gcc/toplev.c
>> +++ b/gcc/toplev.c
>> @@ -1416,14 +1416,16 @@ process_options (void)
>>          debug_info_level = DINFO_LEVEL_NONE;
>>       }
>>
>> -  /* CTF is supported for only C at this time.
>> -     Compiling with -flto results in frontend language of GNU GIMPLE.  */
>> +  /* CTF is supported for only C at this time.  */
>>     if (!lang_GNU_C ()
>>         && ctf_debug_info_level > CTFINFO_LEVEL_NONE)
>>       {
>> -      inform (UNKNOWN_LOCATION,
>> -             "CTF debug info requested, but not supported for %qs frontend",
>> -             language_string);
>> +      /* Compiling with -flto results in frontend language of GNU GIMPLE.  It
>> +        is not useful to warn in that case.  */
>> +      if (!startswith (lang_hooks.name, "GNU GIMPLE"))
> 
> please use in_lto_p instead
> 
> OK with that change.
> 

in_lto_p is set later in lto_init () (when its time for do_compile ()).

in_lto_p's updated value is not available at this point in 
process_options ().

>> +       inform (UNKNOWN_LOCATION,
>> +               "CTF debug info requested, but not supported for %qs frontend",
>> +               language_string);
>>         ctf_debug_info_level = CTFINFO_LEVEL_NONE;
>>       }
>>
>> --
>> 1.8.3.1
>>
Richard Biener Sept. 30, 2021, 7:27 a.m. UTC | #3
On Wed, Sep 29, 2021 at 5:55 PM Indu Bhagat <indu.bhagat@oracle.com> wrote:
>
> On 9/29/21 12:14 AM, Richard Biener wrote:
> > On Tue, Sep 28, 2021 at 8:52 PM Indu Bhagat via Gcc-patches
> > <gcc-patches@gcc.gnu.org> wrote:
> >>
> >> CTF is supported for C only.  Currently, a warning is emitted if the -gctf
> >> command line option is specified for a non-C frontend.  This warning is also
> >> used by the GCC testsuite framework - it skips adding -gctf to the list of
> >> debug flags for automated testing, if CTF is not supported for the frontend.
> >>
> >> The following warning, however, is not useful in case of LTO:
> >>
> >> "lto1: note: CTF debug info requested, but not supported for ‘GNU GIMPLE’
> >> frontend"
> >>
> >> This patch disables the generation of the above warning for GNU GIMPLE.
> >>
> >> Bootstrapped and regression tested on x86_64.
> >>
> >> gcc/ChangeLog:
> >>
> >>          * toplev.c (process_options): Do not warn for GNU GIMPLE.
> >> ---
> >>   gcc/toplev.c | 12 +++++++-----
> >>   1 file changed, 7 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/gcc/toplev.c b/gcc/toplev.c
> >> index e1688aa..511a343 100644
> >> --- a/gcc/toplev.c
> >> +++ b/gcc/toplev.c
> >> @@ -1416,14 +1416,16 @@ process_options (void)
> >>          debug_info_level = DINFO_LEVEL_NONE;
> >>       }
> >>
> >> -  /* CTF is supported for only C at this time.
> >> -     Compiling with -flto results in frontend language of GNU GIMPLE.  */
> >> +  /* CTF is supported for only C at this time.  */
> >>     if (!lang_GNU_C ()
> >>         && ctf_debug_info_level > CTFINFO_LEVEL_NONE)
> >>       {
> >> -      inform (UNKNOWN_LOCATION,
> >> -             "CTF debug info requested, but not supported for %qs frontend",
> >> -             language_string);
> >> +      /* Compiling with -flto results in frontend language of GNU GIMPLE.  It
> >> +        is not useful to warn in that case.  */
> >> +      if (!startswith (lang_hooks.name, "GNU GIMPLE"))
> >
> > please use in_lto_p instead
> >
> > OK with that change.
> >
>
> in_lto_p is set later in lto_init () (when its time for do_compile ()).
>
> in_lto_p's updated value is not available at this point in
> process_options ().

I see - a bit ugly IMHO but I guess the patch is OK then.

Thanks,
Richard.

> >> +       inform (UNKNOWN_LOCATION,
> >> +               "CTF debug info requested, but not supported for %qs frontend",
> >> +               language_string);
> >>         ctf_debug_info_level = CTFINFO_LEVEL_NONE;
> >>       }
> >>
> >> --
> >> 1.8.3.1
> >>
>
diff mbox series

Patch

diff --git a/gcc/toplev.c b/gcc/toplev.c
index e1688aa..511a343 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1416,14 +1416,16 @@  process_options (void)
 	debug_info_level = DINFO_LEVEL_NONE;
     }
 
-  /* CTF is supported for only C at this time.
-     Compiling with -flto results in frontend language of GNU GIMPLE.  */
+  /* CTF is supported for only C at this time.  */
   if (!lang_GNU_C ()
       && ctf_debug_info_level > CTFINFO_LEVEL_NONE)
     {
-      inform (UNKNOWN_LOCATION,
-	      "CTF debug info requested, but not supported for %qs frontend",
-	      language_string);
+      /* Compiling with -flto results in frontend language of GNU GIMPLE.  It
+	 is not useful to warn in that case.  */
+      if (!startswith (lang_hooks.name, "GNU GIMPLE"))
+	inform (UNKNOWN_LOCATION,
+		"CTF debug info requested, but not supported for %qs frontend",
+		language_string);
       ctf_debug_info_level = CTFINFO_LEVEL_NONE;
     }