From owner-freebsd-current@FreeBSD.ORG Mon Feb 2 21:35:45 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F64510656D2 for ; Mon, 2 Feb 2009 21:35:45 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: from mail-gx0-f21.google.com (mail-gx0-f21.google.com [209.85.217.21]) by mx1.freebsd.org (Postfix) with ESMTP id 118068FC18 for ; Mon, 2 Feb 2009 21:35:44 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: by gxk14 with SMTP id 14so1765821gxk.19 for ; Mon, 02 Feb 2009 13:35:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=oq7DBobIXZbv1Yoc/DGneUC2sS/5q28foema1pJrU9I=; b=S9O4j1x6crq4sR1R7HO+ssygIQGvLxnva+xGqPfzXdEU5EgESjhR5H2uOpc+v2LEd0 yHxyKLuO/1FosLiNPvb93ebhg6KaFullLudM+L5GkmQrQTQRcWJpw6+9KQDyGBOqUBWc T/2b3+uoUT4WbN5zUghxP0tm52FrqIgpoO/r8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=svLROWzGYNnvsNxjXtq0qVULNQTFnGPAn6s68ZqR0cH5FpOezuFoZbSaaGU/9M8Ul5 U0WH7XdggMfl3V7cBFGngsv0B+6UdDjEL4R7RKti6wxB2p61F13kagJLPmRGOE30Cqld CsxPrvRRwctRJmrTaCSkFKEMLRYaLUWV4xMoQ= MIME-Version: 1.0 Received: by 10.150.205.21 with SMTP id c21mr2331432ybg.175.1233610544311; Mon, 02 Feb 2009 13:35:44 -0800 (PST) In-Reply-To: <49874CA8.5090605@gmx.de> References: <49874CA8.5090605@gmx.de> Date: Mon, 2 Feb 2009 13:35:44 -0800 Message-ID: From: Maksim Yevmenkin To: Christoph Mallon Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: FreeBSD Hackers , FreeBSD Current Subject: Re: write-only variables in src/sys/ - possible bugs X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Feb 2009 21:35:46 -0000 On Mon, Feb 2, 2009 at 11:42 AM, Christoph Mallon wrote: > Hi, > > I compiled a list of all local variables in src/sys/ (r188000), which are > only written to, but never read. This is more than the GCC warning, which > only complains about variables, which are only declared (and maybe > initialised) and not used otherwise. In contrast this list contains > variables with the following usage pattern: > > int w = 42; // GCC warns about this ... > int x; // ... but not this > x = 23; > x++; > return 0; > > The list contains about 700 entries. About three dozen concern variables > named 'error'. Here's one *example* from the list: > > sys/dev/kbdmux/kbdmux.c:1304 > > In the function kbdmux_modevent() the variable 'error' is assigned values > eight times, but at the end of the function there is just a return 0; and > the variable is never read. Probably the value should be returned. fixed. thanks for reporting! thanks, max