[PATCH:libXaw3d] Make laygram.y compatible with bison 2.3 and older

walter harms wharms at bfs.de
Sun Sep 4 07:27:19 PDT 2011



Am 04.09.2011 03:25, schrieb Gaetan Nadon:
> On Sat, 2011-09-03 at 11:34 -0700, Alan Coopersmith wrote:
> 
>> bison 2.3b added %name-prefix "prefix" and deprecated the older
>> %name-prefix="prefix" form, but we don't have a check for the bison
>> version in autoconf.
>>
>> Without this fix, older bison gives the cryptic error:
>> .../src/laygram.y:1.14-20: syntax error, unexpected string, expecting =
>>
>> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
>> ---
>>
>> Tested on Solaris with bison 2.3, not tested on a later bison with the new
>> syntax supported.   I'm not sure this is the best way to do this, but it
>> works for me - if anyone has a better idea, lets hear it.
>>
>>  src/laygram.y |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/src/laygram.y b/src/laygram.y
>> index 3644dd4..48cbc16 100644
>> --- a/src/laygram.y
>> +++ b/src/laygram.y
>> @@ -1,4 +1,4 @@
>> -%name-prefix "LayYY"
>> +%name-prefix="LayYY"
>>  %defines
>>  %{
>>  #include    <X11/Xlib.h>
> 
> I have tested the following 3 options on Linux with bison 2.4.1:
> 
> 1) The patch, as is. Works as advertised.
> 
> 2) Using AM_YFLAGS = -d -p "LayYY" in lieu of %name-prefix "LayYY" in
> laygram.y. Looks the same as with the patch to me.
> 
> 3) Removing all traces of LayYY.  It builds, but I have no idea if it is
> correct. No other modules using lex & yacc use this prefix. I suppose we
> don't know why it was done in the first place. The stripped library has
> the same size, so it's a good start.
> 
> 
>         diff --git a/src/Layout.c b/src/Layout.c
>         index 398d9ac..d6c5613 100644
>         --- a/src/Layout.c
>         +++ b/src/Layout.c
>         @@ -98,9 +98,9 @@ static void LayoutLayout (LayoutWidget, Bool);
>          static void LayoutGetNaturalSize (LayoutWidget, Dimension *, Dimension *);
>          static void LayoutFreeLayout (BoxPtr);
>          
>         -extern void LayYYsetsource(char *);
>         -extern void LayYYsetdest(LayoutPtr *);
>         -extern int LayYYparse(void);
>         +extern void yysetsource(char *);
>         +extern void yysetdest(LayoutPtr *);
>         +extern int yyparse(void);
>          

IMHO to have yyparse() etc. is ok. If someone complains we/you can
revert the change. cleaning up seems more important now.

What confuses me is why does it come up here (Layout.c)
I would expect it with Layout.h

re,
 wh
	


>          #ifdef MOTIF
>          #define SuperClass ((ConstraintWidgetClass)&xmManagerClassRec)
>         @@ -211,11 +211,11 @@ CvtStringToLayout (Display *dpy, XrmValue *args, Cardinal *num_args,
>          {
>              static BoxPtr tmp;
>          
>         -    LayYYsetsource ((char *) from->addr);
>         +    yysetsource ((char *) from->addr);
>              if (!to->addr) to->addr = (XtPointer)&tmp;
>         -    LayYYsetdest ((BoxPtr *) to->addr);
>         +    yysetdest ((BoxPtr *) to->addr);
>              to->size = sizeof (BoxPtr *);
>         -    return  LayYYparse() ? FALSE : TRUE;
>         +    return  yyparse() ? FALSE : TRUE;
>          }
>          
>          /*ARGSUSED*/
>         diff --git a/src/laygram.y b/src/laygram.y
>         index 48cbc16..6fe3c6e 100644
>         --- a/src/laygram.y
>         +++ b/src/laygram.y
>         @@ -1,4 +1,3 @@
>         -%name-prefix="LayYY"
>          %defines
>          %{
>          #include    <X11/Xlib.h>
>         @@ -12,8 +11,6 @@
>          #include    <X11/Xmu/Converters.h>
>          #include    <X11/Xaw3d/LayoutP.h>
>          
>         -#define yysetdest LayYYsetdest
>         -#define yywrap LayYYwrap
>          
>          static LayoutPtr    *dest;
>          
>         diff --git a/src/laylex.l b/src/laylex.l
>         index e357207..27727c0 100644
>         --- a/src/laylex.l
>         +++ b/src/laylex.l
>         @@ -1,4 +1,3 @@
>         -%option prefix="LayYY"
>          %option outfile="lex.yy.c"
>          %{
>          #ifndef FLEX_SCANNER
>         @@ -14,10 +13,6 @@
>          #include    <X11/Xaw3d/LayoutP.h>
>          #include    "laygram.h"
>          
>         -#define yylval LayYYlval
>         -#define yyerror LayYYerror
>         -#define yysetsource LayYYsetsource
>         -
>          static char *yysourcebase, *yysource;
>          
>          #ifndef FLEX_SCANNER
> 
> 
> 
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel


More information about the xorg-devel mailing list