Re: [RFA/DWARF2] Handle nested subprograms in CU pc bound calculation

Joel Brobecker
2008-09-30T17:07:31Z

Hello Pierre,

> Could you please also allow it for pascal language?
> Nested functions/procedures are also allowed in pascal.

Up to now, I think only Pascal expressed interest in handling nested
subprograms besides Ada. The problem is that this change is not the only
piece of the whole puzzle. There are other changes, one of them
submitted recently, where we had to add some exceptions. With that
in mind, I checked my patch in as is for now.

But now that we have another language interested in spending the CPU
time in handling these subprograms, we might want to introduce a new
function that, given a CU (or a language), return true if we should
handle nested subprogram, and use that function throughout, instead
of hard-coding the language test.

static int
dwarf2_handle_nested_subprograms (enum language lang)
{
return (lang == langauge_ada || lang == language_pascal);
}

Would you like to do that? I can try to point out all the locations
where the check for Ada should be replaced by a call to this function.

Actually, now that I think of it, a slightly cleaner approach would
probably be to extend the language vector to add a flag set to non-zero
for the languages that want nested-subprogram handling. The only slight
issue is that the CU references the language enum, which means we need
to go from that enum to the language_defn to get access to the flag.

What do others think?

--
Joel