* Question about default_elf_asm_named_section function
@ 2011-10-13 11:41 Iyer, Balaji V
2011-10-14 6:59 ` Ian Lance Taylor
0 siblings, 1 reply; 5+ messages in thread
From: Iyer, Balaji V @ 2011-10-13 11:41 UTC (permalink / raw)
To: 'gcc@gcc.gnu.org'
Hello Everyone,
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 ?
Thanks,
Balaji V. Iyer.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question about default_elf_asm_named_section function
2011-10-13 11:41 Question about default_elf_asm_named_section function Iyer, Balaji V
@ 2011-10-14 6:59 ` Ian Lance Taylor
2011-10-14 17:34 ` Iyer, Balaji V
0 siblings, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 2011-10-14 6:59 UTC (permalink / raw)
To: Iyer, Balaji V; +Cc: 'gcc@gcc.gnu.org'
"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
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Question about default_elf_asm_named_section function
2011-10-14 6:59 ` Ian Lance Taylor
@ 2011-10-14 17:34 ` Iyer, Balaji V
2011-10-15 6:08 ` Ian Lance Taylor
0 siblings, 1 reply; 5+ messages in thread
From: Iyer, Balaji V @ 2011-10-14 17:34 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: 'gcc@gcc.gnu.org'
Can I submit a patch for it? Or is it a small thing that patch is not necessary?
Thanks,
Balaji V. Iyer.
-----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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question about default_elf_asm_named_section function
2011-10-14 17:34 ` Iyer, Balaji V
@ 2011-10-15 6:08 ` Ian Lance Taylor
2011-10-15 8:58 ` Iyer, Balaji V
0 siblings, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 2011-10-15 6:08 UTC (permalink / raw)
To: Iyer, Balaji V; +Cc: 'gcc@gcc.gnu.org'
"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
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Question about default_elf_asm_named_section function
2011-10-15 6:08 ` Ian Lance Taylor
@ 2011-10-15 8:58 ` Iyer, Balaji V
0 siblings, 0 replies; 5+ messages in thread
From: Iyer, Balaji V @ 2011-10-15 8:58 UTC (permalink / raw)
To: Ian Lance Taylor
Cc: 'gcc@gcc.gnu.org', GCC Patches (gcc-patches@gcc.gnu.org)
[-- Attachment #1: Type: text/plain, Size: 2319 bytes --]
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 #2: default_elf_asm_patch.txt --]
[-- Type: text/plain, Size: 388 bytes --]
diff --git a/gcc/varasm.c b/gcc/varasm.c
index e83bebb..94c865c 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -6142,7 +6142,7 @@ default_no_named_section (const char *name ATTRIBUTE_UNUSED,
void
default_elf_asm_named_section (const char *name, unsigned int flags,
- tree decl ATTRIBUTE_UNUSED)
+ tree decl)
{
char flagchars[10], *f = flagchars;
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-10-14 20:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-13 11:41 Question about default_elf_asm_named_section function Iyer, Balaji V
2011-10-14 6:59 ` Ian Lance Taylor
2011-10-14 17:34 ` Iyer, Balaji V
2011-10-15 6:08 ` Ian Lance Taylor
2011-10-15 8:58 ` Iyer, Balaji V
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).