This is the mail archive of the gcc@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: Question about default_elf_asm_named_section function


Attached, please find a patch fixing this issue.

2011-10-14  Balaji V. Iyer  <balaji.v.iyer@intel.com>

	* varasm.c (default_elf_asm_named_section): Removed ATTRIBUTE_UNUSED tag 
	before decl.


Thanks,

Balaji V. Iyer.


-----Original Message-----
From: Ian Lance Taylor [mailto:iant@google.com] 
Sent: Friday, October 14, 2011 4:29 PM
To: Iyer, Balaji V
Cc: 'gcc@gcc.gnu.org'
Subject: Re: Question about default_elf_asm_named_section function

"Iyer, Balaji V" <balaji.v.iyer@intel.com> writes:

> Can I submit a patch for it? Or is it a small thing that patch is not necessary?

I will preapprove such a patch for anybody with commit access.

Ian

> -----Original Message-----
> From: Ian Lance Taylor [mailto:iant@google.com] 
> Sent: Friday, October 14, 2011 12:38 AM
> To: Iyer, Balaji V
> Cc: 'gcc@gcc.gnu.org'
> Subject: Re: Question about default_elf_asm_named_section function
>
> "Iyer, Balaji V" <balaji.v.iyer@intel.com> writes:
>
>> 	This email is in reference to the "default_elf_asm_named_section" function in the varasm.c file. 
>>
>> This function is defined like this:
>>
>> void
>> default_elf_asm_named_section (const char *name, unsigned int flags,
>>                                tree decl ATTRIBUTE_UNUSED)
>>
>>
>> But, inside the function, there is this if-statement:
>>
>>
>>       if (HAVE_COMDAT_GROUP && (flags & SECTION_LINKONCE))
>>         {
>>           if (TREE_CODE (decl) == IDENTIFIER_NODE)
>>             fprintf (asm_out_file, ",%s,comdat", IDENTIFIER_POINTER (decl));
>>           else
>>             fprintf (asm_out_file, ",%s,comdat",
>>                      IDENTIFIER_POINTER (DECL_COMDAT_GROUP (decl)));
>>         }
>>
>>
>> The decl is set with "ATTRIBUTE_UNUSED" but the if-statement is using "decl." Should we remove the attribute unused tag near the "tree decl" or is the if-statement a deadcode that should never be ?
>
>
> ATTRIBUTE_UNUSED does not mean "this parameter is never used."  It means "this parameter may not be used."  The difference is due to #ifdefs--if a parameter is only used in code that is something #ifdef'ed out, then the parameter should be marked as ATTRIBUTE_UNUSED.
>
> In this case the parameter is always used, so we might as well remove the ATTRIBUTE_UNUSED.
>
> Ian

Attachment: default_elf_asm_patch.txt
Description: default_elf_asm_patch.txt


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