public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: "Iyer\, Balaji V" <balaji.v.iyer@intel.com>
Cc: "'gcc\@gcc.gnu.org'" <gcc@gcc.gnu.org>
Subject: Re: Question about default_elf_asm_named_section function
Date: Fri, 14 Oct 2011 06:59:00 -0000	[thread overview]
Message-ID: <mcrwrc86vdm.fsf@coign.corp.google.com> (raw)
In-Reply-To: <2950715866004049A240A2F9BB410E7315F42971CC@azsmsx502.amr.corp.intel.com>	(Balaji V. Iyer's message of "Wed, 12 Oct 2011 15:14:35 -0700")

"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

  reply	other threads:[~2011-10-14  4:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-13 11:41 Iyer, Balaji V
2011-10-14  6:59 ` Ian Lance Taylor [this message]
2011-10-14 17:34   ` Iyer, Balaji V
2011-10-15  6:08     ` Ian Lance Taylor
2011-10-15  8:58       ` Iyer, Balaji V

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mcrwrc86vdm.fsf@coign.corp.google.com \
    --to=iant@google.com \
    --cc=balaji.v.iyer@intel.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).