ps2dev / gsKit

gsKit is a C interface to the PS2 Graphics Synthesizer
Other
103 stars 27 forks source link

Error in >=gcc5 toolchain #24

Closed AKuHAK closed 3 years ago

AKuHAK commented 5 years ago

In latest ps2toolchain I got this error

In file included from gsCore.c:15:
/gsKit/ee/gs/include/gsInline.h: In function 'gsKit_heap_alloc':
/gsKit/ee/gs/include/gsInline.h:34:37: error: lvalue required as left operand of assignment
   (u8*)gsGlobal->CurQueue->pool_cur += 16;
                                     ^~
/gsKit/ee/gs/include/gsInline.h:54:36: error: lvalue required as left operand of assignment
  (u8*)gsGlobal->CurQueue->pool_cur += bsize;
                                    ^~
/gsKit/ee/gs/include/gsInline.h: In function 'gsKit_heap_alloc_dma':
/gsKit/ee/gs/include/gsInline.h:82:36: error: lvalue required as left operand of assignment
  (u8*)gsGlobal->CurQueue->pool_cur += bsize;
                                    ^~
/gsKit/ee/gs/include/gsInline.h:84:36: error: lvalue required as left operand of assignment
  (u8*)gsGlobal->CurQueue->pool_cur += 16;
                                    ^~
/gsKit/ee/Rules.make:54: recipe for target 'gsCore.o' failed

I am just not completely sure that it can be fixed in such way:

   *(u8*)gsGlobal->CurQueue->pool_cur += 16;
sp193 commented 5 years ago

You must expand the expression. This is the functionally-equivalent expression:

gsGlobal->CurQueue->pool_cur = (void*)((u8*)gsGlobal->CurQueue->pool_cur + 16);

...of:

(u8*)gsGlobal->CurQueue->pool_cur += 16;

If you dereference, then you will end up increasing the value pointed to by pool_cur by 16, instead of increasing the pointer itself.

rickgaiser commented 4 years ago

@AKuHAK is this now working for you? I'm not getting this error.