Re: Compiler warning cleanup - unitilized const variables, pointer type mismatch - Mailing list pgsql-hackers

From Michael Meskes
Subject Re: Compiler warning cleanup - unitilized const variables, pointer type mismatch
Date
Msg-id 20090528124723.GA23989@feivel.credativ.lan
Whole thread Raw
In response to Re: Compiler warning cleanup - unitilized const variables, pointer type mismatch  (Zdenek Kotala <Zdenek.Kotala@Sun.COM>)
Responses Re: Compiler warning cleanup - unitilized const variables, pointer type mismatch  (Zdenek Kotala <Zdenek.Kotala@Sun.COM>)
Re: Compiler warning cleanup - unitilized const variables, pointer type mismatch  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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:

# 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.

Michael
-- 
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go VfL Borussia! Go SF 49ers! Use Debian GNU/Linux! Use PostgreSQL!


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: User-facing aspects of serializable transactions
Next
From: Aidan Van Dyk
Date:
Subject: Re: PostgreSQL Developer meeting minutes up