[obv] Make 'disable_display' static.

Pedro Alves palves@redhat.com
Fri Jan 11 15:01:00 GMT 2013


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



More information about the Gdb-patches mailing list