From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26059 invoked by alias); 11 Jan 2013 15:01:58 -0000 Received: (qmail 26021 invoked by uid 22791); 11 Jan 2013 15:01:57 -0000 X-SWARE-Spam-Status: No, hits=-7.7 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 11 Jan 2013 15:01:23 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0BF0tjP002573 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 11 Jan 2013 10:00:55 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r0BF0N87004851; Fri, 11 Jan 2013 10:00:40 -0500 Message-ID: <50F02907.6070303@redhat.com> Date: Fri, 11 Jan 2013 15:01:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Tom Tromey CC: Eli Zaretskii , Yao Qi , gdb-patches@sourceware.org Subject: Re: [obv] Make 'disable_display' static. References: <1357870430-19757-1-git-send-email-yao@codesourcery.com> <838v80gn16.fsf@gnu.org> <87d2xbu6l3.fsf@fleche.redhat.com> In-Reply-To: <87d2xbu6l3.fsf@fleche.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2013-01/txt/msg00224.txt.bz2 On 01/11/2013 02:39 PM, Tom Tromey wrote: >>>>>> "Eli" == Eli Zaretskii 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