Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 41092633714; Thu, 28 May 2009 11:33:59 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 20417-02; Thu, 28 May 2009 11:33:57 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gmp-eb-inf-2.sun.com (gmp-eb-inf-2.sun.com [192.18.6.24]) by mail.postgresql.org (Postfix) with ESMTP id 6794E6335B4; Thu, 28 May 2009 11:33:57 -0300 (ADT) Received: from fe-emea-09.sun.com (gmp-eb-lb-1-fe3.eu.sun.com [192.18.6.10]) by gmp-eb-inf-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n4SEXhfh008907; Thu, 28 May 2009 14:33:55 GMT MIME-version: 1.0 Content-transfer-encoding: 8BIT Content-type: text/plain; charset=UTF-8 Received: from conversion-daemon.fe-emea-09.sun.com by fe-emea-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.02 64bit (built Apr 16 2009)) id <0KKC00G00YWSJP00@fe-emea-09.sun.com>; Thu, 28 May 2009 15:33:43 +0100 (BST) Received: from [192.168.1.100] ([unknown] [89.102.157.161]) by fe-emea-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.02 64bit (built Apr 16 2009)) with ESMTPSA id <0KKC003GCZ3X9B00@fe-emea-09.sun.com>; Thu, 28 May 2009 15:33:33 +0100 (BST) Date: Thu, 28 May 2009 16:34:38 +0200 From: Zdenek Kotala Subject: Re: Compiler warning cleanup - unitilized const variables, pointer type mismatch In-reply-to: <20090528124723.GA23989@feivel.credativ.lan> To: Michael Meskes Cc: "pgsql-hackers@postgresql.org" Message-id: <1243521278.22457.13.camel@localhost> X-Mailer: Evolution 2.26.1.1 References: <1243501880.1372.23.camel@localhost> <20090528113347.GB9247@feivel.credativ.lan> <1243511467.1372.43.camel@localhost> <20090528124723.GA23989@feivel.credativ.lan> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200905/1238 X-Sequence-Number: 138780 Michael Meskes píše v čt 28. 05. 2009 v 14:47 +0200: > On Thu, May 28, 2009 at 01:51:07PM +0200, Zdenek Kotala wrote: > > Problem is with YYLLOC_DEFAULT. When I look on macro definition > > > > #define YYLLOC_DEFAULT(Current, Rhs, N) \ > > Current.first_line = Rhs[1].first_line; \ > > Current.first_column = Rhs[1].first_column; \ > > Current.last_line = Rhs[N].last_line; \ > > Current.last_column = Rhs[N].last_column; > > > > It seems to me that it is OK, because 1 is used as a index which finally > > point on yyerror_range[0]. > > Wait, this is the bison definition. Well to be more precise the bison > definition in your bison version. Mine is different: I took it from documentation. I have same as you in generated code. > # define YYLLOC_DEFAULT(Current, Rhs, N) \ > do \ > if (YYID (N)) \ > { \ > (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ > (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ > (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ > (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ > } \ > else \ > { \ > (Current).first_line = (Current).last_line = \ > YYRHSLOC (Rhs, 0).last_line; \ > (Current).first_column = (Current).last_column = \ > YYRHSLOC (Rhs, 0).last_column; \ > } \ > while (YYID (0)) > > Having said that, it doesn't really matter as we redefine the macro: > > #define YYLLOC_DEFAULT(Current, Rhs, N) \ > do { \ > if (N) \ > (Current) = (Rhs)[1]; \ > else \ > (Current) = (Rhs)[0]; \ > } while (0) > > I have to admit that those version look strikingly unsimilar to me. There is no > reference to Rhs[N] in our macro at all. But then I have no idea whether this > is needed. Current is only int. See gramparse.h. I think we could rewrite it this way: #define YYLLOC_DEFAULT(Current, Rhs, N) \ do { \ if (N) \ (Current) = (Rhs)[1]; \ else \ (Current) = (Rhs)[N]; \ } while (0) It is same result and compiler is quite. Zdenek