Re: [9fans] porting help please (gcc void pointer handling)

2009-09-10 Thread Fernan Bolando
On Thu, Sep 10, 2009 at 2:17 AM, ron minnich wrote: > On Wed, Sep 9, 2009 at 9:27 AM, Fernan Bolando wrote: > >> I am trying to port nhc98 the bytecode haskell compiler. >> I am hoping to avoid changing those definition because I think those >> are generated by the >> haskell compiler and then fed

Re: [9fans] porting help please (gcc void pointer handling)

2009-09-10 Thread erik quanstrom
On Thu Sep 10 05:37:12 EDT 2009, com...@panix.com wrote: > In article , > erik quanstrom wrote: > >> gcc happily compiles a definition like > >> #define CT_v249((void*)startLabel+464) > >> > > > >no it doesn't. > > > >$ cat > x.c > >char *startlab; > >long long offset = (void*)startlab+464; >

Re: [9fans] porting help please (gcc void pointer handling)

2009-09-10 Thread Greg Comeau
In article <1d5d51400909090803n4c4d5b7ewba9dfe0573d02...@mail.gmail.com>, Fernan Bolando wrote: >On Wed, Sep 9, 2009 at 4:36 PM, Greg Comeau wrote: >> In article <1d5d51400909080844q1bee4c3s114ccc5e51ce5...@mail.gmail.com>, >> Fernan Bolando wrote: >>>...error: initializer is not a constant: F0_P

Re: [9fans] porting help please (gcc void pointer handling)

2009-09-10 Thread Greg Comeau
In article <1d5d51400909090927u2a4e6742k9614b79df841d...@mail.gmail.com>, Fernan Bolando wrote: >I am trying to port nhc98 the bytecode haskell compiler. >I am hoping to avoid changing those definition because I think those >are generated by the >haskell compiler and then fed to the C compiler. So

Re: [9fans] porting help please (gcc void pointer handling)

2009-09-10 Thread Greg Comeau
In article <1d5d51400909090843h2905057et1a60474702faf...@mail.gmail.com>, Fernan Bolando wrote: >>> gcc happily compiles a definition like >>> #define CT_v249 =A0 =A0 =A0 ((void*)startLabel+464) >I may not have posted the appropriate section of the code but, the app >that I am porting have a bunch

Re: [9fans] porting help please (gcc void pointer handling)

2009-09-10 Thread Greg Comeau
In article , roger peppe wrote: >2009/9/9 erik quanstrom : >>> gcc happily compiles a definition like >>> #define CT_v249 =C2=A0 =C2=A0 =C2=A0 ((void*)startLabel+464) >> >> no it doesn't. > >yes it does: > >% cat > x.c >void *f(void *v){return v + 23;} >% gcc -Wall -c x.c >% use -pedantic: q.c:1:

Re: [9fans] porting help please (gcc void pointer handling)

2009-09-10 Thread Greg Comeau
In article , erik quanstrom wrote: >> gcc happily compiles a definition like >> #define CT_v249 ((void*)startLabel+464) >> > >no it doesn't. > >$ cat > x.c >char *startlab; >long long offset = (void*)startlab+464; >[...] >$ gcc -Wall x.c >x.c:2: error: initializer element is not constant

Re: [9fans] porting help please (gcc void pointer handling)

2009-09-09 Thread ron minnich
On Wed, Sep 9, 2009 at 9:27 AM, Fernan Bolando wrote: > I am trying to port nhc98 the bytecode haskell compiler. > I am hoping to avoid changing those definition because I think those > are generated by the > haskell compiler and then fed to the C compiler. So there are a whole > bunch of them.

Re: [9fans] porting help please (gcc void pointer handling)

2009-09-09 Thread Charles Forsyth
>I am trying to port nhc98 the bytecode haskell compiler. i see. that makes it much harder to try my suggestion. i wonder why the compiler doesn't generate char* (or unsigned char*) for those defines? perhaps directly changing that would be better. if it needed a void* result then #define CT_v249

Re: [9fans] porting help please (gcc void pointer handling)

2009-09-09 Thread Fernan Bolando
On Thu, Sep 10, 2009 at 12:08 AM, Charles Forsyth wrote: > you might consider using a sed script to change the CT_.* style #defines, > and run the sed script from the mkfile/makefile, so although the > porting is (in your sense) `destructive' it's done by changing the > original source file automat

Re: [9fans] porting help please (gcc void pointer handling)

2009-09-09 Thread Charles Forsyth
you might consider using a sed script to change the CT_.* style #defines, and run the sed script from the mkfile/makefile, so although the porting is (in your sense) `destructive' it's done by changing the original source file automatically. you could sed (say) from a .h.orig to a .h using a single

Re: [9fans] porting help please (gcc void pointer handling)

2009-09-09 Thread roger peppe
2009/9/9 erik quanstrom : >> gcc happily compiles a definition like >> #define CT_v249       ((void*)startLabel+464) > > no it doesn't. yes it does: % cat > x.c void *f(void *v){return v + 23;} % gcc -Wall -c x.c %

Re: [9fans] porting help please (gcc void pointer handling)

2009-09-09 Thread Fernan Bolando
On Wed, Sep 9, 2009 at 11:35 PM, erik quanstrom wrote: >> gcc happily compiles a definition like >> #define CT_v249       ((void*)startLabel+464) >> > > no it doesn't. > > $ cat > x.c > char    *startlab; > long long offset = (void*)startlab+464; > [...] > $ gcc -Wall x.c > x.c:2: error: initialize

Re: [9fans] porting help please (gcc void pointer handling)

2009-09-09 Thread Charles Forsyth
>is it valid just to add to make the porting non-destructive? >#ifdef Plan9 >#define void unsigned char >#endif not really, as a global define. it's legal to write Type *t; t = malloc(sizeof(*t)); and that won't work unless malloc returns a real void* (only void* is compatible wi

Re: [9fans] porting help please (gcc void pointer handling)

2009-09-09 Thread erik quanstrom
> gcc happily compiles a definition like > #define CT_v249 ((void*)startLabel+464) > no it doesn't. $ cat > x.c char*startlab; long long offset = (void*)startlab+464; [...] $ gcc -Wall x.c x.c:2: error: initializer element is not constant [...] - erik

Re: [9fans] porting help please (gcc void pointer handling)

2009-09-09 Thread Fernan Bolando
On Wed, Sep 9, 2009 at 4:36 PM, Greg Comeau wrote: > In article <1d5d51400909080844q1bee4c3s114ccc5e51ce5...@mail.gmail.com>, > Fernan Bolando wrote: >>...error: initializer is not a constant: F0_Prelude_46primLeave >>--h file --- >>#define VAP_TAG  1 >>#define WORDSHIFT  5 >>#define WORDSIZE   (1

Re: [9fans] porting help please

2009-09-09 Thread Greg Comeau
In article <1d5d51400909080844q1bee4c3s114ccc5e51ce5...@mail.gmail.com>, Fernan Bolando wrote: >...error: initializer is not a constant: F0_Prelude_46primLeave >--h file --- >#define VAP_TAG 1 >#define WORDSHIFT 5 >#define WORDSIZE (1<#define WORDMASK (WORDSIZE-1) >#define NS (WORDSI

Re: [9fans] porting help please

2009-09-09 Thread Greg Comeau
In article <1d5d51400909080844q1bee4c3s114ccc5e51ce5...@mail.gmail.com>, Fernan Bolando wrote: >error: initializer is not a constant: F0_Prelude_46primLeave BTW, I would have thought you received a diagnostic about an implicit function declaration or something along those lines too, so you may ha