Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: Eli Zaretskii <eliz@gnu.org>, Yao Qi <yao@codesourcery.com>,
	       gdb-patches@sourceware.org
Subject: Re: [obv] Make 'disable_display' static.
Date: Fri, 11 Jan 2013 15:01:00 -0000	[thread overview]
Message-ID: <50F02907.6070303@redhat.com> (raw)
In-Reply-To: <87d2xbu6l3.fsf@fleche.redhat.com>

On 01/11/2013 02:39 PM, Tom Tromey wrote:
>>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
> 
> Eli>   . why is it a good idea to go hunting for functions not used outside
> Eli>     its source file and make them static?  I don't see this
> Eli>     requirement in any coding standards document pertinent to GDB.
> 
> I don't hunt for these but I sometimes trip across them by accident.
> 
> Eli>   . if this is NOT mandated by any coding standards we try to enforce,
> Eli>     why is this an "obvious" patch?
> 
> In general the less scope an object has, the simpler it is to reason
> about it.  The "static" indicates immediately that it is private to the
> file.
> 
> Eli> The reason I'm asking is that, in general, whoever wrote that function
> Eli> could have judged it to be generally useful and export-worthy.
> 
> It's trivial to re-export an object should the need arise.
> 
> In fact I think it is better to have the discussion around exporting
> objects than around making them static.  The default ought to be static,
> as much as possible, to reduce the size of a module's API.

I agree.

On 01/11/2013 11:32 AM, Joel Brobecker wrote:

> It also helps the compiler, because it is now able to notify us
> when a symbol is no longer referenced, and thus a candidate
> for deletion. Without making them "static", we don't get the
> compiler warning.

I agree.  That's why we use "-Wunused-function", and part of
the reason for -Wmissing-prototypes too.

-- 
Pedro Alves


  reply	other threads:[~2013-01-11 15:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-11  2:14 Yao Qi
2013-01-11  8:07 ` Eli Zaretskii
2013-01-11  8:51   ` Yao Qi
2013-01-11 10:22     ` Eli Zaretskii
2013-01-11 11:32   ` Joel Brobecker
2013-01-11 14:39   ` Tom Tromey
2013-01-11 15:01     ` Pedro Alves [this message]
2013-01-11 15:27     ` Gary Benson

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=50F02907.6070303@redhat.com \
    --to=palves@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    --cc=yao@codesourcery.com \
    /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