This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 1/2] PR debug/38757 gcc does not emit DW_LANG_C99.
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Mark Wielaard <mjw at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>, Aldy Hernandez <aldyh at redhat dot com>
- Date: Fri, 21 Nov 2014 12:48:12 +0100
- Subject: Re: [PATCH 1/2] PR debug/38757 gcc does not emit DW_LANG_C99.
- Authentication-results: sourceware.org; auth=none
- References: <CAFiYyc1jaramU-ax-Hm1Jn3Fq83RQfiRk67AWG9om=2PEDJd0Q at mail dot gmail dot com> <1416522612-29823-1-git-send-email-mjw at redhat dot com> <20141121075607 dot GA1745 at tucnak dot redhat dot com>
On Fri, Nov 21, 2014 at 8:56 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Nov 20, 2014 at 11:30:11PM +0100, Mark Wielaard wrote:
>> --- a/gcc/config/avr/avr-c.c
>> +++ b/gcc/config/avr/avr-c.c
>> @@ -386,7 +386,8 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
>> (as mentioned in ISO/IEC DTR 18037; Annex F.2) which is not
>> implemented in GCC up to now. */
>>
>> - if (!strcmp (lang_hooks.name, "GNU C"))
>> + if (strncmp (lang_hooks.name, "GNU C", 5) == 0
>> + && strncmp (lang_hooks.name, "GNU C++", 7) != 0)
>
> I wonder if the tests for C language shouldn't be better done
> as (strncmp (lang_hooks.name, "GNU C", 5) == 0
> && strchr ("0123456789", lang_hooks.name[5]) != NULL)
> or (strncmp (lang_hooks.name, "GNU C", 5) == 0
> && (ISDIGIT (lang_hooks.name[5]) || lang_hooks.name[5] == '\0'))
> to make it explicit what we are looking for, not what we aren't.
Or even make that a helper function in langhooks.[ch]
lang_GNU_C (), lang_GNU_CXX ()
>> + either, so for now use 0. Match GNU C++ first, since it needs to
>> + be compared with strncmp, like GNU C, which has the same prefix. */
>> + if (! strncmp (language_string, "GNU C++", 7)
>> + || ! strcmp (language_string, "GNU Objective-C++"))
>
> Wrong formatting, || should be below ! on the previous line.
>
>> + i = 9;
>> + else if (! strncmp (language_string, "GNU C", 5)
>> || ! strcmp (language_string, "GNU GIMPLE")
>> || ! strcmp (language_string, "GNU Go"))
>
> And here too. But if you use a different check for C (see above), you could
> avoid moving the C++ case first.
>
>> --- a/gcc/langhooks.h
>> +++ b/gcc/langhooks.h
>> @@ -261,7 +261,8 @@ struct lang_hooks_for_lto
>>
>> struct lang_hooks
>> {
>> - /* String identifying the front end. e.g. "GNU C++". */
>> + /* String identifying the front end. e.g. "GNU C++".
>> + Might include language version being used. */
>
> As we no longer have GNU C++ as any name, using it as an example
> is weird. So,
> /* String identifying the front end and optionally language standard
> version, e.g. "GNU C++98" or "GNU Java". */
> ?
>
> LGTM otherwise.
Yes, otherwise looks good.
Thanks,
Richard.
> Jakub