[En-Nut-Discussion] Compiling with GCC4

Harald Kipp harald.kipp at egnite.de
Tue Mar 7 21:03:57 CET 2006


Hi Vesa,

THanks a lot for your review.

At 21:36 07.03.2006 +0200, you wrote:

>clearer source tree approach. It would require more changes to tree now,
>but if the functionality is not broken, then it would result in clearer
>source tree in longer run. In my opinion data conversion casts should be
>avoided if it is possible or it doesn't make the intention clearer.

I fully agree. Minimal was meant as breaking as less as
possible with least effort. :-)


>I think that if there is a string, it should be type of char, and not
>unsigned char.

Agreed, if you mean displayable strings. If they contain
encoded values, things may become more difficult. The same
applies for check summing etc.


> > +#define strlen_P(x)             strlen((char *)(x))
> > +#define strcpy_P(x,y)           strcpy(x,(char *)(y))
>
>Why casts here? How big job it would be to change the users and not to
>add cast to the macro declarations?

As far as I recall it, the problem here is caused by the difference
between Harvard (prog_char) and non-Harvard Architectures (char).



> > diff -ruN nut/include/dev/chat.h nut-gcc4/include/dev/chat.h
> > --- nut/include/dev/chat.h    2005-04-30 19:42:41.000000000 +0200
> > +++ nut-gcc4/include/dev/chat.h    2006-03-07 18:57:40.000000000 +0100
>
>Why not change those params to char too ? I think this would eliminate
>needed cast in this function. It might also require changes to local
>variable types and used structures, but would be clearer.

I tried to change only things I'm able to overlook without
testing. Due to lack of time I'm currently unable to setup a
PPP environment.


> > diff -ruN nut/pro/wins.c nut-gcc4/pro/wins.c
> > --- nut/pro/wins.c    2005-11-24 10:46:55.000000000 +0100
> > +++ nut-gcc4/pro/wins.c    2006-03-07 19:20:26.000000000 +0100
>
>Why not change pkt->name's type to char too ? And depending on what
>encoded stores, it could also be changed to char.

Similar one. I didn't write this part and though I'm too scary.

To summarize, I needed GCC4 urgently, but didn't have the time to
test all changes. But, of course I'd welcome any additional improvement
if someone takes over the responsibility. :-) Unfortunately my time
is currently very limited.

Harald







More information about the En-Nut-Discussion mailing list