[M3devel] a note on parse.c "GTY" use

Jay K jay.krell at cornell.edu
Thu May 27 15:07:10 CEST 2010


Hm. Alternatively we could possibly use the data C types...

 - Jay


----------------------------------------
> From: jay.krell at cornell.edu
> To: m3devel at elegosoft.com
> Date: Thu, 27 May 2010 12:54:39 +0000
> Subject: [M3devel] a note on parse.c "GTY" use
>
>
> I am striving to have one parse.c be portable between gcc 4.5, gcc 4.2, and possibly gcc 4.3.
> I already established 4.3/4.2 portability a year or so ago.
>
>
> The main "indefinitely sticky" motivation is that Apple is only on 4.2 and they have a lot of changes.
>   That I wouldn't want to merge.
> We should imho, use their code for Darwin platforms, or at least Darwin/arm.
>    Mainline FSF seems to work fine for Darwin/ppc/x86 so I'm not advocating change there.
>
>
>
> "indefinitely sticky" meaning, not really indefinite, but we aren't in control.
> Presumably they'll move up to a newer version but I have no idea when.
>
>
>
> Granted, Modula-3/iphone/pod/pad is seemingly nowhere.
> A year or so ago I ran cm3 on my iPhone, got the usual "unable to find cm3.cfg", which is
> exactly what you want to see when all you have is cm3 and no config files or source, and got distracted after that :)
>
>
> An alternate motivation would be if we want to more easily move between 4.3 and 4.5.
> This one we are more control of. If 4.5 has a few problems on a few platforms, we can
> decide to debug and fix, or use 4.3 selectively.
> I don't forsee problems major here though.
>
>
> "Much ado about not much" -- more background than conclusion:
>
>
> Gcc has some internal garbage collector. You have to annotate your code a bit for it.
>
> In gcc 4.2/4.3 you say:
>
> struct foo GTY()) { int field; } and such
>
>
> In 4.5 you say:
> struct GTY()) foo { int field; } and such
>
>
> The thing that scans your code I don't think knows much C.
> I wasn't not able use #ifdef to guide it to varying versions.
>
>
> Therefore, I've isolated 4.3 vs. 4.5-specific uses of GTY to their own files.
> It's just a few lines.
> But it is not how you would structure the code if not for this goal of working with multiple versions.
>
>
> Generally otherwise I'll use #ifdef and have src/m3makefile #define whatever.
>  Possibly prepending to parse.c, yucky, but oh well.
> A read only source tree is ideal, granted, but I do what I can..
>
>
> GTY is presumably "garbabe collected type" or such.
>
>
>
>  - Jay
>
 		 	   		  


More information about the M3devel mailing list