avrdude-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avrdude-dev] avrdude on Solaris 10 x86?


From: Joerg Wunsch
Subject: Re: [avrdude-dev] avrdude on Solaris 10 x86?
Date: Wed, 2 Nov 2005 22:01:23 +0100
User-agent: Mutt/1.4.2.1i

As Joerg Wunsch wrote:

> > Why not just simply say bison is a prerequisite, and [b]yacc is
> > not supported? (And turning the bug into a feature. :-)

> Because byacc is indeed supported.  There aren't any special things
> needed, it's not quite clear why Solaris' yacc stumbles across it.
> It's probably just a minor implementation issue.

That's a quite nasty problem.

Their yacc generates the following code:

#define YYMAXDEPTH 150
...
YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv;

Looks all quite fine, doesn't it?

There's a damn pitfall in that.  config.h actually #defines YYSTYPE:

#if !defined(HAS_YYSTYPE)
#define YYSTYPE struct token_t *
#endif

So the above will eventually evaluate to

struct token_t * yy_yyv[150], *yyv = yy_yyv;

Obviously, their idea to merge two declarations into a single one hits
badly here.  We've now got an array of 150 pointers, and instead of
"yyv" being a pointer to the first element, it's a pointer to a struct
token_t, i.e. the same type as each array element, thus not compatible
with the type of the entire array.

Had they written

YYSTYPE yy_yyv[YYMAXDEPTH];
YYSTYPE *yyv = yy_yyv;

everything were fine.

Anybody here with a valid Solaris support contract? ;-)


OK, I cheated.  I added a

typedef struct token_t *token_p;

to config.h, and changed the #define to

#define YYSTYPE token_p

That way, it works as intented for all parser generators: Solaris
yacc, Berkeley yacc, and GNU bison.

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]