From owner-freebsd-current@FreeBSD.ORG Mon Jul 1 14:33:14 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C4AA648D for ; Mon, 1 Jul 2013 14:33:14 +0000 (UTC) (envelope-from onwahe@gmail.com) Received: from mail-qe0-x230.google.com (mail-qe0-x230.google.com [IPv6:2607:f8b0:400d:c02::230]) by mx1.freebsd.org (Postfix) with ESMTP id 8ADF61E75 for ; Mon, 1 Jul 2013 14:33:14 +0000 (UTC) Received: by mail-qe0-f48.google.com with SMTP id 2so1695540qea.21 for ; Mon, 01 Jul 2013 07:33:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=2fkuGdpQOnDkY72Wc9/1MdQHpkGL+3iKLO/HRot2DiE=; b=kRvp/Jo4NbAwbkB4upas3LMvDNkAcYHhmkoknvrpJhmJp4HEMYZvQ4jaL+eTuLuiQ7 AN9PdQjRSiPVekkI3W7x3X7zalLY/y5Nq3wpLrUIYJzBCiFvL1DKfWlIT+suWXUzZ+fh qMfxKq2E7SyekVo6ZEJdYHUlYxAMUh9BLX+fSqXx6ypph84XJrkhfFaJMQg8JEJ/QFcO 4Gz8/OkFFcXM4t4q9PMaroHpdFOWyhYN1bG4+g4CxZH1z9XVq1k/O6DfWk43xgLRAg6K o3BOBp18+NjwEFS/n4rUanxhAnP6x42/l26zbHCo3Yk66m6SnRyV8MzpANA3Dnl/esDy u0vw== MIME-Version: 1.0 X-Received: by 10.224.67.4 with SMTP id p4mr8436182qai.84.1372689194051; Mon, 01 Jul 2013 07:33:14 -0700 (PDT) Received: by 10.49.73.194 with HTTP; Mon, 1 Jul 2013 07:33:13 -0700 (PDT) In-Reply-To: References: Date: Mon, 1 Jul 2013 16:33:13 +0200 Message-ID: Subject: Re: too many warnigns for variable 'cons_next_next' From: Svatopluk Kraus To: Sergey Kandaurov Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 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, 01 Jul 2013 14:33:14 -0000 On Mon, Jul 1, 2013 at 3:40 PM, Sergey Kandaurov wrote: > On 1 July 2013 17:11, Svatopluk Kraus wrote: > > Hi, > > > > could somebody help me, please, with too many following warnings: > > sys/buf_ring.h:189:33: warning: variable 'cons_next_next' set but not > used > > > > As the warning is produced by header which is included a lot, the > important > > warnings are visible poorly among them. I think that > buf_ring_dequeue_sc() > > in sys/buf_ring.h could be change to suppress the warning this way: > > static __inline void * > > buf_ring_dequeue_sc(struct buf_ring *br) > > { > > - uint32_t cons_head, cons_next, cons_next_next; > > + uint32_t cons_head, cons_next, cons_next_next __unused; > > uint32_t prod_tail; > > void *buf; > > > > cons_head = br->br_cons_head; > > prod_tail = br->br_prod_tail; > > > > + if (cons_head == prod_tail) > > + return (NULL); > > > > cons_next = (cons_head + 1) & br->br_cons_mask; > > - cons_next_next = (cons_head + 2) & br->br_cons_mask; > > > > - if (cons_head == prod_tail) > > - return (NULL); > > #ifdef PREFETCH_DEFINED > > + cons_next_next = (cons_head + 2) & br->br_cons_mask; > > if (cons_next != prod_tail) { > > prefetch(br->br_ring[cons_next]); > > if (cons_next_next != prod_tail) > > prefetch(br->br_ring[cons_next_next]); > > } > > #endif > > > > Why not put its declaration under #ifdef as well? YMMV. > > -- > wbr, > pluknet > It's possible too. But, why not to do some optimalization at the same time? Svata