This is the mail archive of the
mailing list for the GCC project.
Re: Inconsistency between code and docs
On Thu, Oct 18, 2012 at 8:02 AM, Paulo Matos <email@example.com> wrote:
> I have found a strange inconsistency between code and docs for TARGET_ASM_NAMED_SECTION.
> Docs say (http://gcc.gnu.org/onlinedocs/gcc-4.7.1/gccint/File-Framework.html#index-TARGET_005fASM_005fNAMED_005fSECTION-4472):
> " If decl is non-NULL, it is the VAR_DECL or FUNCTION_DECL with which this section is associated."
> However, in dwarf2out.c, line 21030 we have the following code:
> tree comdat_key = get_identifier (ref->info);
> /* Terminate the previous .debug_macinfo section. */
> dw2_asm_output_data (1, 0, "End compilation unit");
> targetm.asm_out.named_section (DEBUG_MACRO_SECTION,
> | SECTION_LINKONCE,
> This passes comdat_key to named_section hook which expected either a VAR_DECL or a FUNCTION_DECL.
> I noticed as I am using DECL_ATTRIBUTES inside the hook on decl and it failed with checking enabled as an IDENTIFIER_NODE (as passed by dwarf2out.c) is not a DECL.
> It seems to me to be a bug of dwarf2out.c since it should maybe generate a VAR_DECL instead of an IDENTIFIER_NODE. Is this the case?
I think the bug is in the documentation, and that
TARGET_ASM_NAMED_SECTION should accept an IDENTIFIER_NODE.