From owner-svn-src-all@FreeBSD.ORG Sun Oct 27 22:08:01 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id ECDF7174; Sun, 27 Oct 2013 22:08:01 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AC84A2077; Sun, 27 Oct 2013 22:08:01 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 796B03592F2; Sun, 27 Oct 2013 23:07:59 +0100 (CET) Received: by turtle.stack.nl (Postfix, from userid 1677) id 4CD12CB4E; Sun, 27 Oct 2013 23:07:59 +0100 (CET) Date: Sun, 27 Oct 2013 23:07:58 +0100 From: Jilles Tjoelker To: Bruce Evans Subject: Re: svn commit: r257203 - head/sys/arm/arm Message-ID: <20131027220758.GA12425@stack.nl> References: <201310270329.r9R3Tcoi076809@svn.freebsd.org> <20131028040222.G929@besplex.bde.org> <1382900401.1170.227.camel@revolution.hippie.lan> <20131028081925.C2294@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20131028081925.C2294@besplex.bde.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Ian Lepore X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Oct 2013 22:08:02 -0000 On Mon, Oct 28, 2013 at 08:43:37AM +1100, Bruce Evans wrote: > On Sun, 27 Oct 2013, Ian Lepore wrote: > >On Mon, 2013-10-28 at 04:42 +1100, Bruce Evans wrote: > >>On Sun, 27 Oct 2013, Ian Lepore wrote: > >> > >>>Log: > >>> Eliminate a compiler warning about extraneous parens. > >> > >>Wow, what flags give these warnings? > >--- busdma_machdep.o --- > >/local/build/staging/freebsd/dp10/src/sys/arm/arm/busdma_machdep.c:811:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] > > if ((map->pagesneeded == 0)) { > > ~~~~~~~~~~~~~~~~~^~~~ > Ahh. I guess what I really want is -Wredundant-parentheses > -Wredundant-braces ... The parser can easily tell what is redundant > than what is bogus since bogusness depends on style and too many > suboptions would be required to specify styles > (-Wparentheses[-operator][-context]. > Oops, the parser easily can't do this right because macro parameters > must usually have redundant parentheses and C parsers are specified > to act as if on the output of the preprocessor so they can't easily > either have a special case to ignore these redundant parentheses or > know that they aren't in the unpreprocessed source so they should be > ignored. > >/local/build/staging/freebsd/dp10/src/sys/arm/arm/busdma_machdep.c:811:24: note: remove extraneous parentheses around the comparison to silence this warning > > if ((map->pagesneeded == 0)) { > > ~ ^ ~ > >/local/build/staging/freebsd/dp10/src/sys/arm/arm/busdma_machdep.c:811:24: note: use '=' to turn this equality comparison into an assignment > > if ((map->pagesneeded == 0)) { > > ^~ > > = > >That's what the compiler had to say about it. I guess in somebody's > >mind if it's a probable error to have done > >... > This expression could be the result of a macro > #define ISZERO(x) ((x) == 0) > which for if (ISZERO(map->pagesneeded)) expands to almost the above. I > guess clang warns excessively about this. Clang takes advantage of its internal preprocessor to suppress certain warnings in results of macro expansion. In fact, this is what makes -Wparentheses-equality possible at all. It does not violate the C standard, since it is only used to decide whether to issue certain warnings and does not affect the semantics of the code. This check breaks down when the internal preprocessor is not used, such as with ccache. -- Jilles Tjoelker