From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21275 invoked by alias); 11 Jan 2013 11:32:57 -0000 Received: (qmail 21257 invoked by uid 22791); 11 Jan 2013 11:32:56 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 11 Jan 2013 11:32:51 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id B48D02E63B; Fri, 11 Jan 2013 06:32:50 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id tDNipTdtfPPk; Fri, 11 Jan 2013 06:32:50 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 3F7642E19C; Fri, 11 Jan 2013 06:32:50 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 5B4F5C23AD; Fri, 11 Jan 2013 15:32:44 +0400 (RET) Date: Fri, 11 Jan 2013 11:32:00 -0000 From: Joel Brobecker To: Eli Zaretskii Cc: Yao Qi , gdb-patches@sourceware.org Subject: Re: [obv] Make 'disable_display' static. Message-ID: <20130111113244.GL6143@adacore.com> References: <1357870430-19757-1-git-send-email-yao@codesourcery.com> <838v80gn16.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <838v80gn16.fsf@gnu.org> User-Agent: Mutt/1.5.21 (2010-09-15) 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/msg00216.txt.bz2 > . why is it a good idea to go hunting for functions not used outside > its source file and make them static? I don't see this > requirement in any coding standards document pertinent to GDB. I think it is a good idea, because it helps us (developers) a lot when we see that a variable or function is static, and thus only referenced within the unit. 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. More generally, I think that everything should be static/const by default, and anything that is not needs to explained (when not obvious, or course). > . if this is NOT mandated by any coding standards we try to enforce, > why is this an "obvious" patch? I do not necessarily consider these patches obvious, because I've seen emails on this list suggesting that we seem to be flexible with uncontributed code which might be needing the symbol to be exported rather than static. But I think that they generally go in the right direction and should be encouraged. -- Joel