From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19811 invoked by alias); 18 May 2005 10:25:17 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 19674 invoked from network); 18 May 2005 10:25:09 -0000 Received: from unknown (HELO e35.co.us.ibm.com) (32.97.110.133) by sourceware.org with SMTP; 18 May 2005 10:25:09 -0000 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e35.co.us.ibm.com (8.12.10/8.12.9) with ESMTP id j4IAP8LK644360 for ; Wed, 18 May 2005 06:25:08 -0400 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay04.boulder.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j4IAP8LN223026 for ; Wed, 18 May 2005 04:25:08 -0600 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.12.11/8.13.3) with ESMTP id j4IAP7et019724 for ; Wed, 18 May 2005 04:25:07 -0600 Received: from imap.linux.ibm.com (imap.rtp.raleigh.ibm.com [9.42.107.100]) by d03av03.boulder.ibm.com (8.12.11/8.12.11) with ESMTP id j4IAOjnk019145; Wed, 18 May 2005 04:25:07 -0600 Received: by imap.linux.ibm.com (Postfix, from userid 48) id 035BE7C014; Wed, 18 May 2005 06:24:41 -0400 (EDT) Received: from ibmcsdl-9m89c83.cn.ibm.com (ibmcsdl-9m89c83.cn.ibm.com [9.181.134.123]) by imap.rtp.raleigh.ibm.com (IMP) with HTTP for ; Wed, 18 May 2005 06:24:41 -0400 Message-ID: <1116411881.428b17e9beb01@imap.linux.ibm.com> Date: Wed, 18 May 2005 15:43:00 -0000 From: Wu Zhou To: Mark Kettenis Cc: gdb-patches@sources.redhat.com Subject: Re: two questions about GDB coding standards MIME-Version: 1.0 Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.7 X-SW-Source: 2005-05/txt/msg00450.txt.bz2 Quoting Mark Kettenis : > The usage of sprintf is mainly historic, and a bad example that > shouldn't be followed. Patches to get rid of it are welcome, and > mostly obvious ;-). Whether xasprintf is the right replacement, > depends on the context. In some cases the usage of xsnprintf might be > more appropriate. The later is a version of snprintf that checks > whether the generated string fits in the buffer. Where can I find any document about xasprintf or xsnprintf? I can find xasprintf's definition in the source tree of libiberty, but didn't find any definition for xsnprintf. Where is it defined then? > As configure.ac says, -Wunused-variable is up for debate. Looks like > you just started that debate ;-). But before we enable it someone > will have to do the dirty work of finding most of the unused > variables, such that compiling with -Werror keeps being possible. > Elimination of unused variables is defenitely obvious, but watch out > for tricky #ifdef's. Sorry I didn't notice that this is mentioned in configure.ac. And my intention was also not to start debate. But I _do_ think that removing these unused variables might be achievable. My initial idea is to use static analysis tool to detect unused variables first. Then double check to eliminate these false negatives. and then use a script to remove the definition automatically. What is your thought on this? Please review and comment. Thanks. Cheers - Wu Zhou