This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR debug/38757 gcc does not emit DW_LANG_C99
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Mark Wielaard <mjw at redhat dot com>
- Cc: Richard Biener <richard dot guenther at gmail 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: Wed, 12 Nov 2014 17:31:49 +0100
- Subject: Re: [PATCH] PR debug/38757 gcc does not emit DW_LANG_C99
- Authentication-results: sourceware.org; auth=none
- References: <1412763235-23197-1-git-send-email-mjw at redhat dot com> <1413189233 dot 5534 dot 23 dot camel at bordewijk dot wildebeest dot org> <1415803819 dot 4965 dot 13 dot camel at bordewijk dot wildebeest dot org> <20141112145413 dot GG5026 at tucnak dot redhat dot com> <CAFiYyc0cHUZ95cF+=XGF-OLp9qdJ4-JO46EEP1O5d8uCH-cuqw at mail dot gmail dot com> <20141112153352 dot GI5026 at tucnak dot redhat dot com> <1415807199 dot 4965 dot 16 dot camel at bordewijk dot wildebeest dot org>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Nov 12, 2014 at 04:46:39PM +0100, Mark Wielaard wrote:
> I don't mind changing the language hook to return the actual DW_LANG_*
> constant directly, that seems like a nice cleanup.
>
> But I don't think we can just replace TRANSLATION_UNIT_LANGUAGE and
> lang_hooks.name. The name is (explicitly) const and isused to identify
It is const char *name; , so it isn't const, just what it points is const.
So you can change if (just after parsing the options set
lang_hooks.name = "GNU C11";
or similar).
> the frontend used for a particular language in various places (for
> example some backends seem to use it to write out some language/abi
> information, or to detect when to use IEEE compliance mode, pch uses it
> to match whether a header can be reused, the constant folder uses it to
> make some decisions, etc.
If Richard prefers to use lang_hooks.name, I'd just change all the users
of lang_hooks.name or TRANSLATION_UNIT_LANGUAGE that need changing.
For PCH it is ok as is, parsing a header can depend on the language version,
for the cases that strcmp (lang_hooks.name, "GNU C++") I'd replace it
with strncmp (lang_hooks.name, "GNU C++", 7), you are not going to change
the ObjC/ObjC++ stuff, just in dwarf2out.c in addition to handling the new
names you also need to do something better for the LTO merging of
TRANSLATION_UNIT_LANGUAGE - say if merging "GNU C", "GNU C99" and "GNU C11",
pick up the newest out of those, if C++ is mixed into it, pick probably the
highest C++ version.
>
> So shall I change the patch so that the lang hook explicitly encodes the
> DW_LANG_* constant/language standard variant in use, but keep
> lang_hooks.name as is to not break any other users?
Jakub