This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR debug/38757 gcc does not emit DW_LANG_C99


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]